Last active
July 16, 2018 11:24
-
-
Save DazWilkin/218fc2a6d8af3da54367d085ddf5b0f4 to your computer and use it in GitHub Desktop.
Cloud Deployment Manager & Kubernetes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def GenerateConfig(context): | |
"""Generate YAML resource configuration.""" | |
cluster_name = context.properties['CLUSTER_NAME'] | |
cluster_zone = context.properties['CLUSTER_ZONE'] | |
number_of_nodes = context.properties['NUM_NODES'] | |
resources = [] | |
resources.append({ | |
'name': cluster_name, | |
'type': 'container.v1.cluster', | |
'properties': { | |
'zone': cluster_zone, | |
'cluster': { | |
'name': cluster_name, | |
'initialNodeCount': number_of_nodes, | |
'nodeConfig': { | |
'oauthScopes': [ | |
'https://www.googleapis.com/auth/' + scope | |
for scope in [ | |
'compute', | |
'devstorage.read_only', | |
'logging.write', | |
'monitoring' | |
] | |
] | |
} | |
} | |
} | |
}) | |
outputs.append({ | |
'name': 'endpoint', | |
'value': '$(ref.' + cluster_name + '.endpoint)' | |
}) | |
return {'resources': resources, 'outputs': outputs} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment