google-cloud-platformspinnakerspinnaker-halyard

Spinnaker bakery error: Subnetwork should be specified for custom subnetmode network, invalid


I have installed Spinnaker version: 1.14.11 (local) from scratch on a GCP VM and did hal config. Spinnaker is able to see the compute instances and network in the project. Spinnaker also works fine creating server group / LB and firewall. but once I setup the pipeline to bake and deploy, it fails with the following error.

==> googlecompute: Checking image does not exist...
==> googlecompute: Creating temporary SSH key for instance...
==> googlecompute: Using image: ubuntu-1604-xenial-v20190628
==> googlecompute: Creating instance...
    googlecompute: Loading zone: us-east1-b
    googlecompute: Loading machine type: n1-standard-1
    googlecompute: Requesting instance creation...
==> googlecompute: Error creating instance: googleapi: Error 400: Invalid value for field 'resource.networkInterfaces[0]': '{  "network": "projects/pg-us-p-app-xxxx/global/networks/devops",  "accessConfig": [{    "type": "...'. Subnetwork should be specified for custom subnetmode network, invalid
Build 'googlecompute' errored: Error creating instance: googleapi: Error 400: Invalid value for field 'resource.networkInterfaces[0]': '{  "network": "projects/pg-us-p-app-xxxx/global/networks/devops",  "accessConfig": [{    "type": "...'. Subnetwork should be specified for custom subnetmode network, invalid

==> Some builds didn't complete successfully and had errors:
--> googlecompute: Error creating instance: googleapi: Error 400: Invalid value for field 'resource.networkInterfaces[0]': '{  "network": "projects/pg-us-p-app-xxxx/global/networks/devops",  "accessConfig": [{    "type": "...'. Subnetwork should be specified for custom subnetmode network, invalid

==> Builds finished but no artifacts were created.


gcloud compute networks list  | grep devops
devops                       CUSTOM       REGIONAL

HAL config:


google:
      enabled: true
      accounts:
      - name: my-gce-account
        requiredGroupMembership: []
        providerVersion: V1
        permissions: {}
        project: pg-us-p-app-xxxx
        jsonPath: /home/spinnaker/.gcp/gce.json
        alphaListed: false
        imageProjects: []
        consul:
          enabled: false
          agentEndpoint: localhost
          agentPort: 8500
          datacenters: []
      primaryAccount: my-gce-account
      bakeryDefaults:
        templateFile: gce.json
        baseImages: []
        zone: us-east1-b
        network: "devops"
        useInternalIp: true

devops is a custom VPC network, where should I provide the Subnetwork? or how to fix this error?

Please advise.


Solution

  • Managed to resolved this issue by passing "gce_subnetwork" as an "Extended Attributes" under "Bake Configuration" in the pipeline.

    Hope this might help some.