0

I created a Deployment Manager Template (python) to create a GKE Zonal cluster (v1beta1 feature). When I run gcloud deployment-manager deployments create <deploymentname> --config <config.yaml>, GKE cluster is created as expected.

I used type:gcp-types/container-v1beta1:projects.zones.clusters in my python template.

However, when I run the delete command on DM i.e. gcloud deployment-manager deployments delete <deploymentname> I get the following error:

Error says that field name could not be found. However, I did specify name in my config.yaml file.

  Error in Operation [operation-1536152440470-5751f5c88f9f3-5ca3a167-d12a593d]: errors:
   - code: RESOURCE_ERROR
     location: /deployments/test-project-gke-xhqgxn6pkd/resources/test-gkecluster-xhqgxn6pkd
     message: "{"ResourceType":"gcp-types/container-v1beta1:projects.zones.clusters"
       ,"ResourceErrorCode":"400","ResourceErrorMessage":{"code":400,"message"
       :"Invalid JSON payload received. Unknown name "name": Cannot bind query
        parameter. Field 'name' could not be found in request message.","status"
       :"INVALID_ARGUMENT","details":[{"@type":"type.googleapis.com/google.rpc.BadRequest"
       ,"fieldViolations":[{"description":"Invalid JSON payload received. Unknown
        name "name": Cannot bind query parameter. Field 'name' could not be found
        in request message."}]}],"statusMessage":"Bad Request","requestPath"
       :"https://container.googleapis.com/v1beta1/projects/test-project/zones/us-east1-b/clusters/"
       ,"httpMethod":"GET"}}"

Here's the sample config.yaml

imports:
  - path: templates/gke/gke.py
    name: gke.py
resources:
  - name: ${CLUSTER_NAME}
    type: gke.py
    properties:
      zone: ${ZONE}
      cluster:
        name: ${CLUSTER_NAME}
        description: test gke cluster
        network: ${NETWORK_NAME}
        subnetwork: ${SUBNET_NAME}
        initialClusterVersion: ${CLUSTER_VERSION}
        nodePools:
          - name: ${NODEPOOL_NAME}
            initialNodeCount: ${NODE_COUNT}
            config:
            machineType: ${MACHINE_TYPE}
            diskSizeGb: 100
            imageType: cos
            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
            localSsdCount: ${LOCALSSD_COUNT}

Any ideas what I'm missing here?

Adam Ocsvari
  • 8,056
  • 2
  • 17
  • 30
obfuscate
  • 130
  • 7
  • Do you use "gcloud deployment-manager deployments delete " or "gcloud deployment-manager deployments delete deploymentname" (without <>)? – Roman Patutin Sep 05 '18 at 14:15
  • without <>, also ${var_name} are just placeholders – obfuscate Sep 05 '18 at 15:04
  • Can you delete 'deployment' using Google Cloud Console or you need only command line way? – Roman Patutin Sep 05 '18 at 18:19
  • when you create your cluster using the DM, which cluster name did it create, I did use the [DM for GKE](https://github.com/GoogleCloudPlatform/deploymentmanager-samples/tree/master/examples/v2/gke) and i was able to delete using **gcloud deployment-manager deployments delete ${NAME}** since set it in the beginning. – Alioua Sep 05 '18 at 20:51
  • Cluster was created successfully with name defined in `${CLUSTER_NAME}` in `config.yaml`. `${CLUSTER_NAME}` is usually of this format `cluster-{random 10 char string}` – obfuscate Sep 05 '18 at 22:05
  • Can you add the python template where you used to create the cluster using the DM? or did you use the [Google Cloud Platform one](https://github.com/GoogleCloudPlatform/deploymentmanager-samples/tree/master/examples/v2/gke) (the 3 file *.yaml, *.py and *.py.schema) – Alioua Sep 06 '18 at 17:56
  • 1
    I did another test - this time changed the cluster to `regional` - the only changes I made were - change type to type:gcp-types/container-v1beta1:projects.location.clusters - add property called `parent` which is `projects/{projectid}/locations/{region} and this time the dm `delete` operation completes successfully. I think I'm pretty sure it's the `zonal` cluster definition that has this issue with `delete`. Yes, I'm using the 3 file one (yaml, py and py.schema) – obfuscate Sep 06 '18 at 18:05
  • the DM that I tried from [**GoogleCloudPlatform/deploymentmanager-samples**](https://github.com/GoogleCloudPlatform/deploymentmanager-samples/tree/master/examples/v2/gke) is working fine, I suggest you to compare between them, I can help you if you using different Py file. – Alioua Sep 07 '18 at 17:35
  • @Alioua Thanks for the pointers and time. I did a few more tests and I narrowed down the cause to the provider `type` - if `type:gcp-types/container-v1beta1:projects.zones.clusters` is used in the py file `dm delete` fails with the above error in question. If I change this to `container.v1.cluster`, both `dm create` and `dm delete` works fine. Zonal cluster is created as expected as well. However, for Regional clusters using `type:gcp-types/container-v1beta1:projects.locations.clusters` works as expected i.e. dm `create` and `delete` works fine. – obfuscate Sep 09 '18 at 16:25
  • Yes, the resources type to create a zonal cluster it should be "container.v1.cluster" and for the regional cluster is should be "gcp-types/container-v1beta1:projects.locations.clusters". – Alioua Sep 10 '18 at 17:32
  • True, but if I use `container.v1.cluster` I won't be able to query any of the `beta` output properties for instance `durationWindow` of `maintenancePolicy` – obfuscate Sep 11 '18 at 19:45
  • Across checking the [container.v1.cluster API](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.zones.clusters) documentation, you have the "maintenancePolicy" and the DailyMaintenanceWindow { "startTime": string, "duration": string, } – Alioua Sep 12 '18 at 23:06

0 Answers0