Skip to content

Commit 9bf8215

Browse files
committed
add support for specifying machine_type and cluster_version when using cluster.py to create a GKE cluster
1 parent 3c0648a commit 9bf8215

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

examples/v2/gke/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ When ready, deploy with the following command:
1818

1919
NAME="your-name"
2020
ZONE="your-zone"
21+
CLUSTER_VERSION="your-cluster-version"
22+
MACHINE_TYPE="your-machine-type"
2123
gcloud deployment-manager deployments create ${NAME} \
2224
--template cluster.py \
23-
--properties zone:${ZONE}
25+
--properties zone:${ZONE},clusterVersion:${CLUSTER_VERSION},machineType:${MACHINE_TYPE}
2426

2527
This will result in two resources:
2628

examples/v2/gke/python/cluster.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,10 @@ def GenerateConfig(context):
3636
'zone': context.properties['zone'],
3737
'cluster': {
3838
'name': cluster_name,
39+
'initialClusterVersion': context.properties['clusterVersion'],
3940
'initialNodeCount': context.properties['initialNodeCount'],
4041
'nodeConfig': {
42+
'machineType': context.properties['machineType'],
4143
'oauthScopes': [
4244
'https://www.googleapis.com/auth/' + s
4345
for s in [

examples/v2/gke/python/cluster.py.schema

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ properties:
2828
zone:
2929
type: string
3030
description: Zone in which the cluster should run.
31+
clusterVersion:
32+
type: string
33+
description: The initial Kubernetes version for this cluster.
34+
machineType:
35+
type: string
36+
description: A set of virtualized hardware resources available to VM instance.
3137
initialNodeCount:
3238
type: integer
3339
description: Initial number of nodes desired in the cluster.

examples/v2/gke/python/cluster.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,6 @@ resources:
2020
type: cluster.py
2121
properties:
2222
zone: ZONE_TO_RUN
23+
clusterVersion: CLUSTER_VERSION
24+
machineType: MACHINE_TYPE
2325

0 commit comments

Comments
 (0)