Skip to content

Commit

Permalink
[DM] [FIX] GKE optional property at v1.12+
Browse files Browse the repository at this point in the history
Fixed GKE outputs: #436 GKE >1.12 versions are not creating ClientCer…
  • Loading branch information
ocsig committed May 19, 2019
2 parents 168fc34 + 6a458bf commit 27ec954
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions dm/templates/gke/gke.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.
""" This template creates a Google Kubernetes Engine cluster. """

from packaging import version

def generate_config(context):
""" Entry point for the deployment resources. """
Expand Down Expand Up @@ -82,7 +83,7 @@ def generate_config(context):
'legacyAbac',
'networkPolicy',
'ipAllocationPolicy',
'masterAuthorizedNetworksConfig'
'masterAuthorizedNetworksConfig',
'maintenancePolicy',
'podSecurityPolicyConfig',
'privateCluster',
Expand Down Expand Up @@ -112,13 +113,18 @@ def generate_config(context):
'endpoint',
'instanceGroupUrls',
'clusterCaCertificate',
'clientCertificate',
'clientKey',
'currentMasterVersion',
'currentNodeVersion',
'servicesIpv4Cidr'
]

if (
version.parse(propc.get('initialClusterVersion').split('-')[0]) < version.parse("1.12") or
propc.get('masterAuth', {}).get('clientCertificateConfig', False)
):
output_props.append('clientCertificate')
output_props.append('clientKey')

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

Expand Down

0 comments on commit 27ec954

Please sign in to comment.