Skip to content

Commit

Permalink
add support for specify machine_type and cluster_version when using c…
Browse files Browse the repository at this point in the history
…luster.py to create a GKE cluster
  • Loading branch information
carolynhu committed Feb 11, 2020
1 parent 3c0648a commit 0f4f455
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
4 changes: 3 additions & 1 deletion examples/v2/gke/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ When ready, deploy with the following command:

NAME="your-name"
ZONE="your-zone"
CLUSTER_VERSION="your-cluster-version"
MACHINE_TYPE="your-machine-type"
gcloud deployment-manager deployments create ${NAME} \
--template cluster.py \
--properties zone:${ZONE}
--properties zone:${ZONE},clusterVersion:${CLUSTER_VERSION},machineType:${MACHINE_TYPE}

This will result in two resources:

Expand Down
2 changes: 2 additions & 0 deletions examples/v2/gke/python/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,10 @@ def GenerateConfig(context):
'zone': context.properties['zone'],
'cluster': {
'name': cluster_name,
'initialClusterVersion': context.properties['clusterVersion'],
'initialNodeCount': context.properties['initialNodeCount'],
'nodeConfig': {
'machineType': context.properties['machineType'],
'oauthScopes': [
'https://www.googleapis.com/auth/' + s
for s in [
Expand Down
6 changes: 6 additions & 0 deletions examples/v2/gke/python/cluster.py.schema
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ properties:
zone:
type: string
description: Zone in which the cluster should run.
clusterVersion:
type: string
description: The initial Kubernetes version for this cluster.
machineType:
type: string
description: A set of virtualized hardware resources available to VM instance.
initialNodeCount:
type: integer
description: Initial number of nodes desired in the cluster.
Expand Down
2 changes: 2 additions & 0 deletions examples/v2/gke/python/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ resources:
type: cluster.py
properties:
zone: ZONE_TO_RUN
clusterVersion: CLUSTER_VERSION
machineType: MACHINE_TYPE

0 comments on commit 0f4f455

Please sign in to comment.