github.com/openshift/installer@v1.4.17/upi/gcp/02_lb_int.py (about)

     1  def GenerateConfig(context):
     2  
     3      backends = []
     4      for zone in context.properties['zones']:
     5          backends.append({
     6              'group': '$(ref.' + context.properties['infra_id'] + '-master-' + zone + '-ig' + '.selfLink)'
     7          })
     8  
     9      resources = [{
    10          'name': context.properties['infra_id'] + '-cluster-ip',
    11          'type': 'compute.v1.address',
    12          'properties': {
    13              'addressType': 'INTERNAL',
    14              'region': context.properties['region'],
    15              'subnetwork': context.properties['control_subnet']
    16          }
    17      }, {
    18          # Refer to docs/dev/kube-apiserver-health-check.md on how to correctly setup health check probe for kube-apiserver
    19          'name': context.properties['infra_id'] + '-api-internal-health-check',
    20          'type': 'compute.v1.healthCheck',
    21          'properties': {
    22              'httpsHealthCheck': {
    23                  'port': 6443,
    24                  'requestPath': '/readyz'
    25              },
    26              'type': "HTTPS"
    27          }
    28      }, {
    29          'name': context.properties['infra_id'] + '-api-internal',
    30          'type': 'compute.v1.regionBackendService',
    31          'properties': {
    32              'backends': backends,
    33              'healthChecks': ['$(ref.' + context.properties['infra_id'] + '-api-internal-health-check.selfLink)'],
    34              'loadBalancingScheme': 'INTERNAL',
    35              'region': context.properties['region'],
    36              'protocol': 'TCP',
    37              'timeoutSec': 120
    38          }
    39      }, {
    40          'name': context.properties['infra_id'] + '-api-internal-forwarding-rule',
    41          'type': 'compute.v1.forwardingRule',
    42          'properties': {
    43              'backendService': '$(ref.' + context.properties['infra_id'] + '-api-internal.selfLink)',
    44              'IPAddress': '$(ref.' + context.properties['infra_id'] + '-cluster-ip.selfLink)',
    45              'loadBalancingScheme': 'INTERNAL',
    46              'ports': ['6443','22623'],
    47              'region': context.properties['region'],
    48              'subnetwork': context.properties['control_subnet']
    49          }
    50      }]
    51  
    52      for zone in context.properties['zones']:
    53          resources.append({
    54              'name': context.properties['infra_id'] + '-master-' + zone + '-ig',
    55              'type': 'compute.v1.instanceGroup',
    56              'properties': {
    57                  'namedPorts': [
    58                      {
    59                          'name': 'ignition',
    60                          'port': 22623
    61                      }, {
    62                          'name': 'https',
    63                          'port': 6443
    64                      }
    65                  ],
    66                  'network': context.properties['cluster_network'],
    67                  'zone': zone
    68              }
    69          })
    70  
    71      return {'resources': resources}