Skip to content

Commit 8bdaa6b

Browse files
committed
Update kubelet restart script in Windows templates
1 parent 57ecea2 commit 8bdaa6b

14 files changed

+226
-16
lines changed

templates/cluster-template-machinepool-windows.yaml

Lines changed: 16 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

templates/cluster-template-windows-apiserver-ilb.yaml

Lines changed: 16 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

templates/cluster-template-windows.yaml

Lines changed: 16 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

templates/flavors/machinepool-windows/machine-pool-deployment-windows.yaml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ spec:
5151
preKubeadmCommands:
5252
- powershell c:/create-external-network.ps1
5353
postKubeadmCommands:
54-
- nssm set kubelet start SERVICE_AUTO_START
54+
- powershell C:/KubeletRestart_nssm_sc.ps1
5555
- powershell C:/defender-exclude-calico.ps1
5656
joinConfiguration:
5757
nodeRegistration:
@@ -67,6 +67,21 @@ spec:
6767
owner: root:root
6868
path: c:/k/azure.json
6969
permissions: "0644"
70+
- content: |
71+
# This script restarts the kubelet service.
72+
# It supports both nssm and Windows service configurations,
73+
# ensuring a smooth transition between service managers without interruption.
74+
# This script will eventually be removed once nssm is no longer used.
75+
$scriptPath = "$env:SYSTEMDRIVE/k/RestartKubelet.ps1"
76+
if (Test-Path $scriptPath) {
77+
Write-Host "Found RestartKubelet.ps1, executing..."
78+
& $scriptPath
79+
} else {
80+
Write-Host "RestartKubelet.ps1 not found. Running fallback command..."
81+
& "$env:SYSTEMDRIVE\k\nssm.exe" set kubelet start SERVICE_AUTO_START
82+
}
83+
path: C:/KubeletRestart_nssm_sc.ps1
84+
permissions: "0744"
7085
- path: C:/defender-exclude-calico.ps1
7186
permissions: "0744"
7287
content: |-

templates/flavors/windows-apiserver-ilb/machine-deployment-windows.yaml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ spec:
5959
- ${AZURE_SSH_PUBLIC_KEY:=""}
6060
preKubeadmCommands: []
6161
postKubeadmCommands:
62-
- nssm set kubelet start SERVICE_AUTO_START
62+
- powershell C:/KubeletRestart_nssm_sc.ps1
6363
- powershell C:/defender-exclude-calico.ps1
6464
joinConfiguration:
6565
nodeRegistration:
@@ -77,6 +77,21 @@ spec:
7777
owner: root:root
7878
path: c:/k/azure.json
7979
permissions: "0644"
80+
- content: |
81+
# This script restarts the kubelet service.
82+
# It supports both nssm and Windows service configurations,
83+
# ensuring a smooth transition between service managers without interruption.
84+
# This script will eventually be removed once nssm is no longer used.
85+
$scriptPath = "$env:SYSTEMDRIVE/k/RestartKubelet.ps1"
86+
if (Test-Path $scriptPath) {
87+
Write-Host "Found RestartKubelet.ps1, executing..."
88+
& $scriptPath
89+
} else {
90+
Write-Host "RestartKubelet.ps1 not found. Running fallback command..."
91+
& "$env:SYSTEMDRIVE\k\nssm.exe" set kubelet start SERVICE_AUTO_START
92+
}
93+
path: C:/KubeletRestart_nssm_sc.ps1
94+
permissions: "0744"
8095
- path: C:/defender-exclude-calico.ps1
8196
permissions: "0744"
8297
content: |-

templates/flavors/windows/machine-deployment-windows.yaml

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ spec:
5959
- ${AZURE_SSH_PUBLIC_KEY:=""}
6060
preKubeadmCommands: []
6161
postKubeadmCommands:
62-
- nssm set kubelet start SERVICE_AUTO_START
62+
- powershell C:/KubeletRestart_nssm_sc.ps1
6363
- powershell C:/defender-exclude-calico.ps1
6464
joinConfiguration:
6565
nodeRegistration:
@@ -68,7 +68,7 @@ spec:
6868
kubeletExtraArgs:
6969
cloud-provider: external
7070
v: "2"
71-
windows-priorityclass: "ABOVE_NORMAL_PRIORITY_CLASS"
71+
windows-priorityclass: ABOVE_NORMAL_PRIORITY_CLASS
7272
files:
7373
- contentFrom:
7474
secret:
@@ -77,6 +77,21 @@ spec:
7777
owner: root:root
7878
path: c:/k/azure.json
7979
permissions: "0644"
80+
- content: |
81+
# This script restarts the kubelet service.
82+
# It supports both nssm and Windows service configurations,
83+
# ensuring a smooth transition between service managers without interruption.
84+
# This script will eventually be removed once nssm is no longer used.
85+
$scriptPath = "$env:SYSTEMDRIVE/k/RestartKubelet.ps1"
86+
if (Test-Path $scriptPath) {
87+
Write-Host "Found RestartKubelet.ps1, executing..."
88+
& $scriptPath
89+
} else {
90+
Write-Host "RestartKubelet.ps1 not found. Running fallback command..."
91+
& "$env:SYSTEMDRIVE\k\nssm.exe" set kubelet start SERVICE_AUTO_START
92+
}
93+
path: C:/KubeletRestart_nssm_sc.ps1
94+
permissions: "0744"
8095
- path: C:/defender-exclude-calico.ps1
8196
permissions: "0744"
8297
content: |-

templates/test/ci/cluster-template-prow-ci-version-windows.yaml

Lines changed: 16 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

templates/test/ci/cluster-template-prow-clusterclass-ci-default.yaml

Lines changed: 16 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

templates/test/ci/cluster-template-prow-machine-pool-ci-version-windows.yaml

Lines changed: 16 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

templates/test/ci/cluster-template-prow-machine-pool-windows.yaml

Lines changed: 16 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)