Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add termination hook to the startup script - GCE Windows #104317

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions cluster/gce/windows/configure.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -205,5 +205,8 @@ catch {
Write-Host 'Exception caught in script:'
Write-Host $_.InvocationInfo.PositionMessage
Write-Host "Kubernetes Windows node setup failed: $($_.Exception.Message)"
# Make sure kubelet won't remain running in case any failure happened during the startup.
Write-Host "Cleaning up, Unregistering WorkerServices..."
Unregister-WorkerServices
exit 1
}
6 changes: 6 additions & 0 deletions cluster/gce/windows/k8s-node-setup.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -1286,6 +1286,12 @@ function Start-WorkerServices {
Log-Output "Kubernetes components started successfully"
}

# Stop and unregister both kubelet & kube-proxy services.
function Unregister-WorkerServices {
& sc.exe delete kube-proxy
ibabou marked this conversation as resolved.
Show resolved Hide resolved
& sc.exe delete kubelet
}

# Wait for kubelet and kube-proxy to be ready within 10s.
function WaitFor_KubeletAndKubeProxyReady {
$waited = 0
Expand Down