google/resource-snippets/container-v1/gke_provider_cluster.jinja (105 lines of code) (raw):
# Copyright 2017 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
resources:
- name: {{ env["deployment"] }}
{% if properties["apiVersion"] == "v1beta1" %}
type: gcp-types/container-v1beta1:projects.locations.clusters
{% else %}
type: gcp-types/container-v1:projects.zones.clusters
{% endif %}
properties:
{% if properties["apiVersion"] == "v1beta1" %}
parent: projects/{{ env["project"] }}/locations/{{ properties["location"] }}
{% else %}
zone: {{ properties["zone"] }}
{% endif %}
cluster:
{% if properties["monitoringService"] %}
monitoringService: {{ properties["monitoringService"] }}
{% endif %}
{% if properties["loggingService"] %}
loggingService: {{ properties["loggingService"] }}
{% endif %}
{% if properties["httpLoadBalancing"] is defined %}
addonsConfig:
httpLoadBalancing:
disabled: {{ not properties["httpLoadBalancing"] }}
{% endif %}
{% if properties["locations"] %}
locations: {{ properties["locations"].split(",") }}
{% endif %}
{% if properties["currentMasterVersion"] %}
currentMasterVersion: {{ properties["currentMasterVersion"] }}
{% endif %}
{% if properties["initialClusterVersion"] %}
initialClusterVersion: {{ properties["initialClusterVersion"] }}
{% endif %}
{% if properties["maintenanceWindowDuration"] %}
maintenancePolicy:
window:
dailyMaintenanceWindow:
startTime: 00:00
duration: {{ properties["maintenanceWindowDuration"] }}
{% endif %}
nodePools:
- name: {{ env["deployment"] }}np
config:
machineType: g1-small
diskSizeGb: 10
oauthScopes:
- https://www.googleapis.com/auth/devstorage.read_only
imageType: {{ properties["imageType"] }}
{% if properties["nodeVersion"] %}
version: {{ properties["nodeVersion"] }}
{% endif %}
initialNodeCount: 1
autoscaling:
enabled: {{ properties["autoscaling"] }}
{% if properties["autoscaling"] %}
minNodeCount: 1
maxNodeCount: 2
{% endif %}
management:
autoUpgrade: {{ properties["autoUpgrade"] }}
autoRepair: {{ properties["autoRepair"] }}
- name: {{ env["deployment"] }}-gke-type
type: gcp-types/deploymentmanager-v2beta:typeProviders
properties:
descriptorUrl: https://$(ref.{{ env["deployment"] }}.endpoint)/openapi/v2
options:
validationOptions:
schemaValidation: IGNORE_WITH_WARNINGS
inputMappings:
- fieldName: Authorization
location: HEADER
value: >
$.concat("Bearer ", $.googleOauth2AccessToken())
- fieldName: metadata.resourceVersion
location: BODY
methodMatch: ^(put|patch)$
value: $.resource.self.metadata.resourceVersion
- fieldName: id
location: PATH
methodMatch: ^(put|get|delete|post|patch)$
value: $.resource.properties.id
- fieldName: name
location: PATH
methodMatch: ^(put|get|delete|post|patch)$
value: $.resource.properties.metadata.name
- fieldName: namespace
location: PATH
methodMatch: ^(put|get|delete|post|patch)$
value: $.resource.properties.namespace
customCertificateAuthorityRoots:
- $(ref.{{env["deployment"]}}.masterAuth.clusterCaCertificate)