From 4a96cb9d078f608bd1fbb9247e70d8ec204490a3 Mon Sep 17 00:00:00 2001 From: kasun Date: Mon, 1 Jun 2026 02:19:43 +0200 Subject: [PATCH 1/5] fix: bumbed compilerOptions target --- k8s-bootstrap/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/k8s-bootstrap/tsconfig.json b/k8s-bootstrap/tsconfig.json index 80b5662..5e2c0b7 100644 --- a/k8s-bootstrap/tsconfig.json +++ b/k8s-bootstrap/tsconfig.json @@ -2,7 +2,7 @@ "compilerOptions": { "strict": true, "outDir": "bin", - "target": "es2020", + "target": "es2024", "module": "nodenext", "moduleResolution": "nodenext", "sourceMap": true, From c8e688b9ff483142c9b4b4ce77b5e01061fd4e8c Mon Sep 17 00:00:00 2001 From: kasun Date: Mon, 1 Jun 2026 02:20:06 +0200 Subject: [PATCH 2/5] fix: resolved sonarqube warning --- k8s-bootstrap/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/k8s-bootstrap/index.ts b/k8s-bootstrap/index.ts index 343d541..2a27337 100644 --- a/k8s-bootstrap/index.ts +++ b/k8s-bootstrap/index.ts @@ -228,6 +228,6 @@ const getKubeconfig = new command.remote.Command( export const kubeconfig = pulumi.secret( getKubeconfig.stdout.apply((kc) => - kc.replace(/127\.0\.0\.1/g, master1Ip).trim(), + kc.replaceAll("127.0.0.1", master1Ip).trim(), ), ); From e6d2b6154af9a9fc44829bc44bc836ed6b7d1ec0 Mon Sep 17 00:00:00 2001 From: kasun Date: Mon, 1 Jun 2026 03:14:55 +0200 Subject: [PATCH 3/5] fix: added instance ips from stack and fixed type issues --- k8s-bootstrap/index.ts | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/k8s-bootstrap/index.ts b/k8s-bootstrap/index.ts index 2a27337..0eb11d7 100644 --- a/k8s-bootstrap/index.ts +++ b/k8s-bootstrap/index.ts @@ -23,11 +23,11 @@ const pve2ApiToken = infraRef.requireOutput( ) as pulumi.Output; // Node IPs — static DHCP leases set in the router -const master1Ip = config.require("master1Ip"); -const master2Ip = config.require("master2Ip"); -const master3Ip = config.require("master3Ip"); -const worker1Ip = config.require("worker1Ip"); -const worker2Ip = config.require("worker2Ip"); +const master1Ip = infraRef.requireOutput("master1Ip"); +const master2Ip = infraRef.requireOutput("master2Ip"); +const master3Ip = infraRef.requireOutput("master3Ip"); +const worker1Ip = infraRef.requireOutput("worker1Ip"); +const worker2Ip = infraRef.requireOutput("worker2Ip"); // Pre-shared k3s cluster token const k3sToken = config.requireSecret("k3sToken"); @@ -47,7 +47,8 @@ const worker1VmId = vmIdsOutput.apply((ids) => String(ids.worker1)); const worker2VmId = vmIdsOutput.apply((ids) => String(ids.worker2)); // SSH connection helper -function conn(ip: string): command.types.input.remote.ConnectionArgs { +function conn( + ip: pulumi.Input): command.types.input.remote.ConnectionArgs { return { host: ip, user: "ubuntu", privateKey: ciRunnerPrivateKey }; } @@ -97,7 +98,7 @@ const allStarts = [ const waitMaster1Ssh = new command.local.Command( "wait-ssh-master-1", { - create: `for i in $(seq 1 60); do (timeout 5 bash -c "echo > /dev/tcp/${master1Ip}/22") 2>/dev/null && exit 0; sleep 5; done; exit 1`, + create: pulumi.interpolate`for i in $(seq 1 60); do (timeout 5 bash -c "echo > /dev/tcp/${master1Ip}/22") 2>/dev/null && exit 0; sleep 5; done; exit 1`, triggers: [master1VmId], interpreter: ["/bin/bash", "-c"], }, @@ -131,7 +132,7 @@ const waitK3sMaster1Ready = new command.remote.Command( const waitMaster2Ssh = new command.local.Command( "wait-ssh-master-2", { - create: `for i in $(seq 1 60); do (timeout 5 bash -c "echo > /dev/tcp/${master2Ip}/22") 2>/dev/null && exit 0; sleep 5; done; exit 1`, + create: pulumi.interpolate`for i in $(seq 1 60); do (timeout 5 bash -c "echo > /dev/tcp/${master2Ip}/22") 2>/dev/null && exit 0; sleep 5; done; exit 1`, triggers: [master2VmId], interpreter: ["/bin/bash", "-c"], }, @@ -141,7 +142,7 @@ const waitMaster2Ssh = new command.local.Command( const waitMaster3Ssh = new command.local.Command( "wait-ssh-master-3", { - create: `for i in $(seq 1 60); do (timeout 5 bash -c "echo > /dev/tcp/${master3Ip}/22") 2>/dev/null && exit 0; sleep 5; done; exit 1`, + create: pulumi.interpolate`for i in $(seq 1 60); do (timeout 5 bash -c "echo > /dev/tcp/${master3Ip}/22") 2>/dev/null && exit 0; sleep 5; done; exit 1`, triggers: [master3VmId], interpreter: ["/bin/bash", "-c"], }, @@ -175,7 +176,7 @@ const joinMaster3 = new command.remote.Command( const waitWorker1Ssh = new command.local.Command( "wait-ssh-worker-1", { - create: `for i in $(seq 1 60); do (timeout 5 bash -c "echo > /dev/tcp/${worker1Ip}/22") 2>/dev/null && exit 0; sleep 5; done; exit 1`, + create: pulumi.interpolate`for i in $(seq 1 60); do (timeout 5 bash -c "echo > /dev/tcp/${worker1Ip}/22") 2>/dev/null && exit 0; sleep 5; done; exit 1`, triggers: [worker1VmId], interpreter: ["/bin/bash", "-c"], }, @@ -185,7 +186,7 @@ const waitWorker1Ssh = new command.local.Command( const waitWorker2Ssh = new command.local.Command( "wait-ssh-worker-2", { - create: `for i in $(seq 1 60); do (timeout 5 bash -c "echo > /dev/tcp/${worker2Ip}/22") 2>/dev/null && exit 0; sleep 5; done; exit 1`, + create: pulumi.interpolate`for i in $(seq 1 60); do (timeout 5 bash -c "echo > /dev/tcp/${worker2Ip}/22") 2>/dev/null && exit 0; sleep 5; done; exit 1`, triggers: [worker2VmId], interpreter: ["/bin/bash", "-c"], }, @@ -226,8 +227,8 @@ const getKubeconfig = new command.remote.Command( { dependsOn: [joinWorker1, joinWorker2] }, ); -export const kubeconfig = pulumi.secret( - getKubeconfig.stdout.apply((kc) => - kc.replaceAll("127.0.0.1", master1Ip).trim(), - ), -); + export const kubeconfig = pulumi.secret( + pulumi + .all([getKubeconfig.stdout, master1Ip]) + .apply(([kc, ip]) => kc.replaceAll("127.0.0.1", ip as string).trim()), + ); From 8eb59643cf7c55353c9a52e72c69a0af4c39843c Mon Sep 17 00:00:00 2001 From: kasun Date: Mon, 1 Jun 2026 03:15:15 +0200 Subject: [PATCH 4/5] format --- k8s-bootstrap/index.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/k8s-bootstrap/index.ts b/k8s-bootstrap/index.ts index 0eb11d7..d4ae119 100644 --- a/k8s-bootstrap/index.ts +++ b/k8s-bootstrap/index.ts @@ -48,7 +48,8 @@ const worker2VmId = vmIdsOutput.apply((ids) => String(ids.worker2)); // SSH connection helper function conn( - ip: pulumi.Input): command.types.input.remote.ConnectionArgs { + ip: pulumi.Input, +): command.types.input.remote.ConnectionArgs { return { host: ip, user: "ubuntu", privateKey: ciRunnerPrivateKey }; } @@ -227,8 +228,8 @@ const getKubeconfig = new command.remote.Command( { dependsOn: [joinWorker1, joinWorker2] }, ); - export const kubeconfig = pulumi.secret( - pulumi - .all([getKubeconfig.stdout, master1Ip]) - .apply(([kc, ip]) => kc.replaceAll("127.0.0.1", ip as string).trim()), - ); +export const kubeconfig = pulumi.secret( + pulumi + .all([getKubeconfig.stdout, master1Ip]) + .apply(([kc, ip]) => kc.replaceAll("127.0.0.1", ip as string).trim()), +); From d4a3c388479cb8c9e9039ed4cf63189462ed03a1 Mon Sep 17 00:00:00 2001 From: kasun Date: Mon, 1 Jun 2026 03:32:14 +0200 Subject: [PATCH 5/5] changed pulumi.dev.yaml name --- .gitea/workflows/deploy-k8s-bootstrap.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.gitea/workflows/deploy-k8s-bootstrap.yaml b/.gitea/workflows/deploy-k8s-bootstrap.yaml index eaf554d..6bf57ea 100644 --- a/.gitea/workflows/deploy-k8s-bootstrap.yaml +++ b/.gitea/workflows/deploy-k8s-bootstrap.yaml @@ -6,14 +6,14 @@ on: branches: - main paths: - - 'k8s-bootstrap/**' - - '.gitea/workflows/deploy-k8s-bootstrap.yaml' + - "k8s-bootstrap/**" + - ".gitea/workflows/deploy-k8s-bootstrap.yaml" pull_request: branches: - main paths: - - 'k8s-bootstrap/**' - - '.gitea/workflows/deploy-k8s-bootstrap.yaml' + - "k8s-bootstrap/**" + - ".gitea/workflows/deploy-k8s-bootstrap.yaml" jobs: preview: @@ -27,10 +27,10 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '24' + node-version: "24" - name: Restore Stack Config - run: echo "${{ secrets.K8S_BOOTSTRAP_DEV_YAML }}" | base64 -d > k8s-bootstrap/Pulumi.dev.yaml + run: echo "${{ secrets.K8S_BOOTSTRAP_PULUMI_DEV_YAML }}" | base64 -d > k8s-bootstrap/Pulumi.dev.yaml - name: Install Dependencies run: npm install @@ -57,10 +57,10 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: '24' + node-version: "24" - name: Restore Stack Config - run: echo "${{ secrets.K8S_BOOTSTRAP_DEV_YAML }}" | base64 -d > k8s-bootstrap/Pulumi.dev.yaml + run: echo "${{ secrets.K8S_BOOTSTRAP_PULUMI_DEV_YAML }}" | base64 -d > k8s-bootstrap/Pulumi.dev.yaml - name: Install Dependencies run: npm install