From 27e811f38e8cd6cf7fa22726d25e85cbd8171655 Mon Sep 17 00:00:00 2001 From: Nicu Reut Date: Tue, 20 Jan 2026 13:17:01 +0000 Subject: [PATCH] Add support to upgrade node pools in place Node pool recreation should be done by creating a new pool and then deleting the old one. WIth static names this cannot be done. [static] Signed-off-by: Nicu Reut --- cluster/expected/cluster/expected.json | 4 +- cluster/pulumi/cluster/src/nodePools.ts | 84 ++++++++++++++----------- 2 files changed, 48 insertions(+), 40 deletions(-) diff --git a/cluster/expected/cluster/expected.json b/cluster/expected/cluster/expected.json index b26cc46f05..362997ed73 100644 --- a/cluster/expected/cluster/expected.json +++ b/cluster/expected/cluster/expected.json @@ -9,7 +9,7 @@ }, "cluster": "cn-mocknet", "initialNodeCount": 0, - "name": "cn-apps-pool", + "namePrefix": "cn-apps-pool", "nodeConfig": { "labels": { "cn_apps": "true" @@ -38,7 +38,7 @@ }, "cluster": "cn-mocknet", "initialNodeCount": 1, - "name": "cn-infra-pool", + "namePrefix": "cn-infra-pool", "nodeConfig": { "labels": { "cn_infra": "true" diff --git a/cluster/pulumi/cluster/src/nodePools.ts b/cluster/pulumi/cluster/src/nodePools.ts index f62adfddd6..19d3875b60 100644 --- a/cluster/pulumi/cluster/src/nodePools.ts +++ b/cluster/pulumi/cluster/src/nodePools.ts @@ -11,51 +11,59 @@ export function installNodePools(): void { ? `projects/${GCP_PROJECT}/locations/${config.requireEnv('CLOUDSDK_COMPUTE_ZONE')}/clusters/${clusterName}` : clusterName; - new gcp.container.NodePool('cn-apps-node-pool', { - name: 'cn-apps-pool', - cluster, - nodeConfig: { - machineType: gkeClusterConfig.nodePools.apps.nodeType, - taints: [ - { - effect: 'NO_SCHEDULE', - key: 'cn_apps', - value: 'true', + new gcp.container.NodePool( + 'cn-apps-node-pool', + { + namePrefix: 'cn-apps-pool', + cluster, + nodeConfig: { + machineType: gkeClusterConfig.nodePools.apps.nodeType, + taints: [ + { + effect: 'NO_SCHEDULE', + key: 'cn_apps', + value: 'true', + }, + ], + labels: { + cn_apps: 'true', }, - ], - labels: { - cn_apps: 'true', + }, + initialNodeCount: 0, + autoscaling: { + minNodeCount: gkeClusterConfig.nodePools.apps.minNodes, + maxNodeCount: gkeClusterConfig.nodePools.apps.maxNodes, }, }, - initialNodeCount: 0, - autoscaling: { - minNodeCount: gkeClusterConfig.nodePools.apps.minNodes, - maxNodeCount: gkeClusterConfig.nodePools.apps.maxNodes, - }, - }); + { aliases: [{ name: 'cn-apps-pool' }] } + ); - new gcp.container.NodePool('cn-infra-node-pool', { - name: 'cn-infra-pool', - cluster, - nodeConfig: { - machineType: gkeClusterConfig.nodePools.infra.nodeType, - taints: [ - { - effect: 'NO_SCHEDULE', - key: 'cn_infra', - value: 'true', + new gcp.container.NodePool( + 'cn-infra-node-pool', + { + namePrefix: 'cn-infra-pool', + cluster, + nodeConfig: { + machineType: gkeClusterConfig.nodePools.infra.nodeType, + taints: [ + { + effect: 'NO_SCHEDULE', + key: 'cn_infra', + value: 'true', + }, + ], + labels: { + cn_infra: 'true', }, - ], - labels: { - cn_infra: 'true', + }, + initialNodeCount: 1, + autoscaling: { + minNodeCount: gkeClusterConfig.nodePools.infra.minNodes, + maxNodeCount: gkeClusterConfig.nodePools.infra.maxNodes, }, }, - initialNodeCount: 1, - autoscaling: { - minNodeCount: gkeClusterConfig.nodePools.infra.minNodes, - maxNodeCount: gkeClusterConfig.nodePools.infra.maxNodes, - }, - }); + { aliases: [{ name: 'cn-infra-pool' }] } + ); new gcp.container.NodePool('gke-node-pool', { name: 'gke-pool',