Hi all, I have created a GKE cluster via Pulumi. Having issue with NodeConfig (Changes to this prope...
b
Hi all, I have created a GKE cluster via Pulumi. Having issue with NodeConfig (Changes to this property makes replacement) Ref: https://www.pulumi.com/registry/packages/gcp/api-docs/container/cluster/#nodeconfig_go My NodeConfig, nodeConfig: { LoggingVariant: "DEFAULT" preemptible : false serviceAccount: "svc-test@test-project.iam.gserviceaccount.com" spot : false } Once the cluster is created, NodeConfig value it set to null in the state - have verified in the google storage pulumi stack ("nodeConfig": null) So when i make pulumi up, pulumi finds the configuration changes in NodeConfig causing cluster replacement behaviour. PULUMI-GCP SDK VERSION : V7.29.0 Can someone help regarding this issue?
Copy code
Detailed Process :

1) Initial GKE cluster creation

Previewing update (gke):
     Type                          Name                            Plan
+   pulumi:pulumi:Stack           test-project-dev                create
+   ├─ pulumi:providers:gcp       customGcpProvider               create
+   ├─ orgn:gcp:GKECluster        gke-cluster-name                create
+   │  └─ gcp:container:Cluster   gke-cluster-name                create
+   └─ orgn:gcp:GKENodePool       nodepool1                       create
+      └─ gcp:container:NodePool  nodepool1                       create

Resources:
    + 6 to create

Do you want to perform this update? yes
Updating (gke):
     Type                          Name                            Status
+   pulumi:pulumi:Stack           test-project-dev                created (6s)
+   ├─ pulumi:providers:gcp       customGcpProvider               created (1s)
+   ├─ orgn:gcp:GKECluster        gke-cluster-name                created (1s)
+   │  └─ gcp:container:Cluster   gke-cluster-name                created (495s)
+   └─ orgn:gcp:GKENodePool       nodepool1                       created (1s)
+      └─ gcp:container:NodePool  nodepool1                       created (92s)

Resources:
    + 6 created

Duration: 10m6s

------

2) Next moment have triggered pulumi up (Without any changes)

Previewing update (gke):
     Type                         Name                            Plan        Info
     pulumi:pulumi:Stack          test-project-dev
~   ├─ pulumi:providers:gcp       customGcpProvider               update      [diff: +project,region,version]
     └─ orgn:gcp:GKECluster       gke-cluster-name
+-     └─ gcp:container:Cluster   gke-cluster-name                replace     [diff: +nodeConfig~nodeConfig]
 
 
Resources:
    ~ 1 to update
    +-1 to replace
    2 changes. 4 unchanged

Do you want to perform this update? details

pulumi:pulumi:Stack: (same)
[urn=urn:pulumi:gke::my-project::pulumi:pulumi:Stack::test-project-dev]
~ pulumi:providers:gcp: (update)
    [id=3dbd24e7-bdc2-4ca7-9000-be2460b07a6d]
    [urn=urn:pulumi:gke::my-project::pulumi:providers:gcp::customGcpProvider]
    + project: "test-project"
    + region : "us-west1"
    + version: "7.29.0"
    --gcp:container/cluster:Cluster: (delete-replaced)
        [id=projects/test-project/locations/us-west1/clusters/gke-cluster-name]
        [urn=urn:pulumi:gke::my-project::orgn:gcp:GKECluster$gcp:container/cluster:Cluster::gke-cluster-name]
        [provider=urn:pulumi:gke::my-project::pulumi:providers:gcp::customGcpProvider::3dbd24e7-bdc2-4ca7-9000-be2460b07a6d]
    +-gcp:container/cluster:Cluster: (replace)
        [id=projects/test-project/locations/us-west1/clusters/gke-cluster-name]
        [urn=urn:pulumi:gke::my-project::orgn:gcp:GKECluster$gcp:container/cluster:Cluster::gke-cluster-name]
        [provider=urn:pulumi:gke::my-project::pulumi:providers:gcp::customGcpProvider::3dbd24e7-bdc2-4ca7-9000-be2460b07a6d]
        + nodeConfig: {
            + loggingVariant: "DEFAULT"
            + preemptible   : false
            + serviceAccount: "svc-test@test-project.iam.gserviceaccount.com"
            + spot          : false
        }
        + nodeConfig: {
            + loggingVariant: "DEFAULT"
            + preemptible   : false
            + serviceAccount: "svc-test@test-project.iam.gserviceaccount.com"
            + spot          : false
        }
    ++gcp:container/cluster:Cluster: (create-replacement)
        [id=projects/test-project/locations/us-west1/clusters/gke-cluster-name]
        [urn=urn:pulumi:gke::my-project::orgn:gcp:GKECluster$gcp:container/cluster:Cluster::gke-cluster-name]
        [provider=urn:pulumi:gke::my-project::pulumi:providers:gcp::customGcpProvider::3dbd24e7-bdc2-4ca7-9000-be2460b07a6d]
        + nodeConfig: {
            + loggingVariant: "DEFAULT"
            + preemptible   : false
            + serviceAccount: "svc-test@test-project.iam.gserviceaccount.com"
            + spot          : false
        }
        + nodeConfig: {
            + loggingVariant: "DEFAULT"
            + preemptible   : false
            + serviceAccount: "svc-test@test-project.iam.gserviceaccount.com"
            + spot          : false
        }

Do you want to perform this update? yes
Updating (gke):
     Type                         Name                            Status              Info
     pulumi:pulumi:Stack          test-project-gke
~   ├─ pulumi:providers:gcp       customGcpProvider               updated (1s)        [diff: +project,region,version]
     └─ orgn:gcp:GKECluster       gke-cluster-name 
+-     └─ gcp:container:Cluster   gke-cluster-name                replaced (505s)     [diff: +nodeConfig~nodeConfig]
 
 
Resources:
    ~ 1 updated
    +-1 replaced
    2 changes. 4 unchanged
 
Duration: 10m49s
d
It looks like you have an explicit NodePool, so you shouldn't be setting NodeConfig on the cluster
b
I need to set a cluster Service Account, that's via NodeConfig
@little-cartoon-10569 Can you share your thoughts?
l
I have no GCS or GKE experience, and very limited Kubernetes experience. You correctly point out that nodeConfig is a replacement-triggering property. And since you want it to have a value but it starts off without one, it looks like Pulumi is doing the correct thing.
Is the problem that you don't want the cluster to have a null nodeConfig initially? You're setting it but it's null anyway?
If that's the problem, can you post your code (in a Slack Text Snippet widget) that defines your cluster? If your nodeConfig is defined elsewhere, can you includes that snippet too?
b
After each pulumi up, at the end the value is been set to null.
Cluster creation snippet, clusterArgs := &container.ClusterArgs{ Name: pulumi.String(clusterName), Description: pulumi.String(fmt.Sprintf("%s Cluster", clusterName)), Project: pulumi.String(projectId), Location: pulumi.String(region), NodeLocations: pulumi.ToStringArray(nodeLocation), LoggingService: pulumi.String("none"), MonitoringService: pulumi.String("none"), RemoveDefaultNodePool: pulumi.Bool(true), InitialNodeCount: pulumi.Int(1), MinMasterVersion: pulumi.String(kubernetesVersion), NodeConfig: container.ClusterNodeConfigArgs{ LoggingVariant: pulumi.String("DEFAULT"), Preemptible: pulumi.Bool(false), Spot: pulumi.Bool(false), ServiceAccount: pulumi.String("svc-test@test-project.iam.gserviceaccount.com"), } .... } gkeCluster, err := container.NewCluster(ctx, clusterName, clusterArgs, ) if err != nil { return nil, err }
l
How can it be null? It's obviously set to a constant non-null value!
That's a bug.
b
From Pulumi state,
Yeah seems like a bug. So should i reachout Pulumi Github to file an issue?
l
Yep, I think so. You're putting a value in there, null is in there, something must be wrong.
👍 1
b
Thanks for ur time @little-cartoon-10569
Seems this issue is already filed. https://github.com/pulumi/pulumi-gcp/issues/1355 https://github.com/pulumi/pulumi-gcp/issues/744 Thanks @little-cartoon-10569
d
This is expected behaviour, you have RemoveDefaultNodePool set to true, which will delete the node pool gke creates. As you're using explicit node pools, you need to remove NodeConfig from the cluster