GKE Creation from Cloud Deployment Manager

12/10/2018
Waiting for create [operation-1544424409972-57ca55456bd22-84bb0f13-64975fdc]...failed.
ERROR: (gcloud.deployment-manager.deployments.create) Error in Operation [operation-1544424409972-57ca55456bd22-84bb0f13-64975fdc]: errors:
- code: CONDITION_NOT_MET
  location: /deployments/infrastructure/resources/practice-gke-clusters->$.properties->$.cluster.name
  message: |-
    InputMapping for field [cluster.name] for method [create] could not be set from input, mapping was: [$.ifNull($.resource.properties.cluster.name, $.resource.name)
    ], and evaluation context was:
    {
      "deployment" : {
        "id" : 4291795636642362677,
        "name" : "infrastructure"
      },
      "intent" : "CREATE",
      "matches" : [ ],
      "project" : "resources-practice",
      "requestId" : "",
      "resource" : {
        "name" : "practice-gke-clusters",
        "properties" : {
          "initialNodeCount" : 1,
          "location" : "asia-east2-a",
          "loggingService" : "logging.googleapis.com",
          "monitoringService" : "monitoring.googleapis.com",
          "network" : "$(ref.practice-gke-network.selfLink)",
          "subnetwork" : "$(ref.practice-gke-network-subnet-1.selfLink)"
        },
        "self" : { }
      }
    }

I always experience this when I try to create a GKE out of deployment manager w/ the jinja template below

resources:
- name: practice-gke-clusters
  type: container.v1.cluster
  properties: 
    network: $(ref.practice-gke-network.selfLink)
    subnetwork: $(ref.practice-gke-network-subnet-1.selfLink)
    initialNodeCount: 1
    loggingService: logging.googleapis.com
    monitoringService: monitoring.googleapis.com
    location: asia-east2-a
-- Dean Christian Armada
google-cloud-platform
google-deployment-manager
google-kubernetes-engine

1 Answer

12/10/2018

You are missing:

properties:
    cluster:
        name: practice-gke-clusters
        initialNodeCount: 3
        nodeConfig:
            oauthScopes:
            - https://www.googleapis.com/auth/compute
            - https://www.googleapis.com/auth/devstorage.read_only
            - https://www.googleapis.com/auth/logging.write
            - https://www.googleapis.com/auth/monitoring

Modify the initialNodeCount and oauthScopes as required.

-- John Hanley
Source: StackOverflow