mirror of https://github.com/k3s-io/k3s
Merge pull request #48144 from juju-solutions/bug/worker-termination
Automatic merge from submit-queue (batch tested with PRs 48399, 48450, 48144) Skip errors when unregistering juju kubernetes-workers **What this PR does / why we need it**: When removing a kubernetes node from using Juju and for some reason kubernetes master fails we should not error the node, instead we should proceed with the removal of the node and the master will recognise that node as unavailable because it will fail heartbeats. **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes https://github.com/juju-solutions/bundle-canonical-kubernetes/issues/300 **Special notes for your reviewer**: **Release note**: ``` Clean decommission of Juju kubernetes worker units ```pull/6/head
commit
40a21312d1
|
@ -160,8 +160,11 @@ def shutdown():
|
|||
- delete the current node
|
||||
- stop the worker services
|
||||
'''
|
||||
if os.path.isfile(kubeconfig_path):
|
||||
kubectl('delete', 'node', gethostname())
|
||||
try:
|
||||
if os.path.isfile(kubeconfig_path):
|
||||
kubectl('delete', 'node', gethostname())
|
||||
except CalledProcessError:
|
||||
hookenv.log('Failed to unregister node.')
|
||||
service_stop('snap.kubelet.daemon')
|
||||
service_stop('snap.kube-proxy.daemon')
|
||||
|
||||
|
|
Loading…
Reference in New Issue