pulumi / templates

Templates used by `pulumi new`
Apache License 2.0
106 stars 66 forks source link

pulumi gcp yaml example is broke #793

Closed bdmorin closed 1 month ago

bdmorin commented 5 months ago

General Feedback

I've been trying to get a new GKE cluster defined using YAML, and despite troubleshooting, I can't get even the default example to work.

View in Browser (Ctrl+O): https://app.pulumi.com/pangeam/pangeam/k8s/previews/f3daf889-c98b-4a90-8941-c84b7ef5c0fc

 Type                 Name         Plan     Info
 pulumi:pulumi:Stack  pangeam-k8s           8 messages

Diagnostics: pulumi:pulumi:Stack (pangeam-k8s): Error: Property serviceaccount does not exist on 'gcp:container/NodePoolNodeConfig:NodePoolNodeConfig' on Pulumi.yaml line 68: 68: oauthScopes: 69: - https://www.googleapis.com/auth/cloud-platform 70: serviceaccount: ${gke-nodepool-sa.email} Cannot assign '{cluster: string, nodeConfig: {oauthScopes: List, serviceaccount: string}, nodeCount: number}' to 'gcp:container/nodePool:NodePool': nodeConfig: Cannot assign '{oauthScopes: List, serviceaccount: string}' to 'gcp:container/NodePoolNodeConfig:NodePoolNodeConfig': Existing properties are: serviceAccount, localSsdCount, loggingVariant, nodeGroup, spot and 34 others

Resources: 1 unchanged


This is the stanza that's autogenerated

Create a new service account for the nodepool

gke-nodepool-sa: properties: accountId: ${gke-cluster.name}-np-1-sa displayName: Nodepool 1 Service Account type: gcp:serviceaccount:Account


So i changed it to .accountId 

then i get this.

❯ pulumi preview Previewing update (k8s)

View in Browser (Ctrl+O): https://app.pulumi.com/pangeam/pangeam/k8s/previews/601e0499-8b43-421d-9d20-9e2a7818e906

 Type                 Name         Plan     Info
 pulumi:pulumi:Stack  pangeam-k8s           8 messages

Diagnostics: pulumi:pulumi:Stack (pangeam-k8s): Error: Property serviceaccount does not exist on 'gcp:container/NodePoolNodeConfig:NodePoolNodeConfig' on Pulumi.yaml line 68: 68: oauthScopes: 69: - https://www.googleapis.com/auth/cloud-platform 70: serviceaccount: ${gke-nodepool-sa.accountId} Cannot assign '{cluster: string, nodeConfig: {oauthScopes: List, serviceaccount: string}, nodeCount: number}' to 'gcp:container/nodePool:NodePool': nodeConfig: Cannot assign '{oauthScopes: List, serviceaccount: string}' to 'gcp:container/NodePoolNodeConfig:NodePoolNodeConfig': Existing properties are: serviceAccount, localSsdCount, loggingVariant, nodeGroup, spot and 34 others

Resources: 1 unchanged



I read the nodepool docs and it appears right. 

I've been trying to troubleshoot this all day, and I can't figure out what's wrong. 
cnunciato commented 3 months ago

Thanks for filing this @bdmorin! And apologies for the rough edges on this.

I'm assuming this is based on the kubernetes-gcp-yaml template, as that's the only one that contains a reference to gke-nodepool-sa.

Running this myself, I do see there's a typo in the program: It should be serviceaccount, not serviceAccount. Will get a fix in for that now.

When I make that change, I'm able to preview and deploy the template using the defaults:

$ pulumi up --yes
Previewing update (dev)

View in Browser (Ctrl+O): https://app.pulumi.com/christian-pulumi-corp/kubernetes-gcp-yaml-72f8d81/dev/previews/7b18bf80-85ba-4736-b55d-60294d5e06c5

     Type                           Name                             Plan       
 +   pulumi:pulumi:Stack            kubernetes-gcp-yaml-72f8d81-dev  create     
 +   ├─ gcp:compute:Network         gke-network                      create     
 +   ├─ gcp:compute:Subnetwork      gke-subnet                       create     
 +   ├─ gcp:container:Cluster       gke-cluster                      create     
 +   ├─ gcp:serviceaccount:Account  gke-nodepool-sa                  create     
 +   └─ gcp:container:NodePool      gke-nodepool                     create     

Outputs:
    clusterId  : output<string>
    clusterName: "gke-cluster-60794b1"
    kubeconfig : [secret]
    networkId  : output<string>
    networkName: "gke-network-50e9a24"

Resources:
    + 6 to create

Updating (dev)

View in Browser (Ctrl+O): https://app.pulumi.com/christian-pulumi-corp/kubernetes-gcp-yaml-72f8d81/dev/updates/1

     Type                           Name                             Status             
 +   pulumi:pulumi:Stack            kubernetes-gcp-yaml-72f8d81-dev  created (819s)     
 +   ├─ gcp:compute:Network         gke-network                      created (22s)      
 +   ├─ gcp:compute:Subnetwork      gke-subnet                       created (11s)      
 +   ├─ gcp:container:Cluster       gke-cluster                      created (671s)     
 +   ├─ gcp:serviceaccount:Account  gke-nodepool-sa                  created (11s)      
 +   └─ gcp:container:NodePool      gke-nodepool                     created (94s)      

Outputs:
    clusterId  : "projects/pulumi-development/locations/us-central1/clusters/gke-cluster-c0fd9c9"
    clusterName: "gke-cluster-c0fd9c9"
    kubeconfig : [secret]
    networkId  : "projects/pulumi-development/global/networks/gke-network-8bc1414"
    networkName: "gke-network-8bc1414"

Resources:
    + 6 created

Duration: 13m41s

I'll therefore assume the template works and that the fix I'm about to submit resolves the issue. If that doesn't work for you, though, feel free to reopen with any additional details you can provide. Thanks again!