mirror of
https://github.com/openshift/installer.git
synced 2026-02-05 06:46:36 +01:00
72 lines
2.7 KiB
Python
72 lines
2.7 KiB
Python
def GenerateConfig(context):
|
|
|
|
backends = []
|
|
for zone in context.properties['zones']:
|
|
backends.append({
|
|
'group': '$(ref.' + context.properties['infra_id'] + '-master-' + zone + '-instance-group' + '.selfLink)'
|
|
})
|
|
|
|
resources = [{
|
|
'name': context.properties['infra_id'] + '-cluster-ip',
|
|
'type': 'compute.v1.address',
|
|
'properties': {
|
|
'addressType': 'INTERNAL',
|
|
'region': context.properties['region'],
|
|
'subnetwork': context.properties['control_subnet']
|
|
}
|
|
}, {
|
|
# Refer to docs/dev/kube-apiserver-health-check.md on how to correctly setup health check probe for kube-apiserver
|
|
'name': context.properties['infra_id'] + '-api-internal-health-check',
|
|
'type': 'compute.v1.healthCheck',
|
|
'properties': {
|
|
'httpsHealthCheck': {
|
|
'port': 6443,
|
|
'requestPath': '/readyz'
|
|
},
|
|
'type': "HTTPS"
|
|
}
|
|
}, {
|
|
'name': context.properties['infra_id'] + '-api-internal-backend-service',
|
|
'type': 'compute.v1.regionBackendService',
|
|
'properties': {
|
|
'backends': backends,
|
|
'healthChecks': ['$(ref.' + context.properties['infra_id'] + '-api-internal-health-check.selfLink)'],
|
|
'loadBalancingScheme': 'INTERNAL',
|
|
'region': context.properties['region'],
|
|
'protocol': 'TCP',
|
|
'timeoutSec': 120
|
|
}
|
|
}, {
|
|
'name': context.properties['infra_id'] + '-api-internal-forwarding-rule',
|
|
'type': 'compute.v1.forwardingRule',
|
|
'properties': {
|
|
'backendService': '$(ref.' + context.properties['infra_id'] + '-api-internal-backend-service.selfLink)',
|
|
'IPAddress': '$(ref.' + context.properties['infra_id'] + '-cluster-ip.selfLink)',
|
|
'loadBalancingScheme': 'INTERNAL',
|
|
'ports': ['6443','22623'],
|
|
'region': context.properties['region'],
|
|
'subnetwork': context.properties['control_subnet']
|
|
}
|
|
}]
|
|
|
|
for zone in context.properties['zones']:
|
|
resources.append({
|
|
'name': context.properties['infra_id'] + '-master-' + zone + '-instance-group',
|
|
'type': 'compute.v1.instanceGroup',
|
|
'properties': {
|
|
'namedPorts': [
|
|
{
|
|
'name': 'ignition',
|
|
'port': 22623
|
|
}, {
|
|
'name': 'https',
|
|
'port': 6443
|
|
}
|
|
],
|
|
'network': context.properties['cluster_network'],
|
|
'zone': zone
|
|
}
|
|
})
|
|
|
|
return {'resources': resources}
|