Skip to content

Commit

Permalink
[DM][BugFix] GKE template examples (#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
bohdanyurov-gl authored and ocsig committed Jun 30, 2019
1 parent 46ced05 commit 9c31921
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 34 deletions.
1 change: 0 additions & 1 deletion dm/templates/gke/examples/gke_regional.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ resources:
- name: myk8sregional
type: gke.py
properties:
clusterLocationType: Regional
region: us-east1
cluster:
name: myk8sregional
Expand Down
18 changes: 8 additions & 10 deletions dm/templates/gke/examples/gke_regional_private.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,22 @@ resources:
- name: myk8sregional
type: gke.py
properties:
clusterLocationType: Regional
region: us-east1
cluster:
name: myk8sregional
description: my awesome k8s cluster
network: <FIXME:network_name>
subnetwork: <FIXME:subnet_name>
initialClusterVersion: 1.10.6-gke.3
nodePools:
- name: default
initialNodeCount: 1
autoscaling:
enabled: True
minNodeCount: 1
maxNodeCount: 2
management:
autoUpgrade: True
autoRepair: True
config:
localSsdCount: 1
oauthScopes:
Expand All @@ -46,21 +51,14 @@ resources:
locations:
- us-east1-c
- us-east1-b
autoScaling:
enabled: True
minNodeCount: 1
maxNodeCount: 2
management:
autoUpgrade: True
autoRepair: True
masterAuth:
username: <FIXME:user_name>
password: <FIXME:password>
loggingService: logging.googleapis.com
monitoringService: monitoring.googleapis.com
privateClusterConfig:
enablePrivateNodes: True
masterIpv4CidrBlock: 172.16.0.0/28
masterIpv4CidrBlock: 172.16.0.0/28
clusterIpv4Cidr: 10.0.0.0/11
ipAllocationPolicy:
useIpAliases: True
Expand Down
7 changes: 3 additions & 4 deletions dm/templates/gke/gke.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ def generate_config(context):
if properties.get('zone'):
# https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.zones.clusters
gke_cluster['type'] = 'gcp-types/container-v1beta1:projects.zones.clusters'
# TODO: remove, this is a bug
gke_cluster['properties']['zone'] = properties.get('zone')
else:
# https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.locations.clusters
gke_cluster['type'] = 'gcp-types/container-v1beta1:projects.locations.clusters'
Expand Down Expand Up @@ -124,15 +126,12 @@ def generate_config(context):
output_props.append('clientCertificate')
output_props.append('clientKey')

if not propc.get('ipAllocationPolicy', {}).get('useIpAliases', False):
output_props.append('nodeIpv4CidrSize')

for outprop in output_props:
output_obj = {}
output_obj['name'] = outprop
ma_props = ['clusterCaCertificate', 'clientCertificate', 'clientKey']
if outprop in ma_props:
output_obj['value'] = '$(ref.' + name + \
output_obj['value'] = '$(ref.' + context.env['name'] + \
'.masterAuth.' + outprop + ')'
elif outprop == 'instanceGroupUrls':
output_obj['value'] = '$(ref.' + context.env['name'] + \
Expand Down
20 changes: 1 addition & 19 deletions dm/templates/gke/gke.py.schema
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,6 @@ additionalProperties: false
required:
- cluster

oneOf:
- allOf:
- properties:
clusterLocationType:
default: Regional
enum: ["Regional"]
- oneOf:
- required:
- location
- required:
- region
- allOf:
- properties:
clusterLocationType:
enum: ["Zonal"]
- required:
- zone

definitions:
locations:
type: array
Expand Down Expand Up @@ -465,7 +447,7 @@ properties:
Issue a client certificate.
initialClusterVersion:
type: string
default: 1.9.7-gke.6
default: latest
description: |
The initial Kubernetes version for this cluster. Valid versions are those found in validMasterVersions
returned by getServerConfig. The version can be upgraded over time; such upgrades are reflected
Expand Down

0 comments on commit 9c31921

Please sign in to comment.