mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-01 15:58:37 +00:00
slightly clean up kubedns reactive step
This commit is contained in:
parent
914402281b
commit
df48acb41d
@ -297,21 +297,6 @@ def remove_dashboard_addons():
|
|||||||
@when_not('kube-dns.available')
|
@when_not('kube-dns.available')
|
||||||
def start_kube_dns():
|
def start_kube_dns():
|
||||||
''' State guard to starting DNS '''
|
''' State guard to starting DNS '''
|
||||||
|
|
||||||
# Interrogate the cluster to find out if we have at least one worker
|
|
||||||
# that is capable of running the workload.
|
|
||||||
|
|
||||||
cmd = ['kubectl', 'get', 'nodes']
|
|
||||||
try:
|
|
||||||
out = check_output(cmd)
|
|
||||||
if b'NAME' not in out:
|
|
||||||
hookenv.log('Unable to determine node count, waiting '
|
|
||||||
'until nodes are ready')
|
|
||||||
return
|
|
||||||
except CalledProcessError:
|
|
||||||
hookenv.log('kube-apiserver not ready, not requesting dns deployment')
|
|
||||||
return
|
|
||||||
|
|
||||||
message = 'Rendering the Kubernetes DNS files.'
|
message = 'Rendering the Kubernetes DNS files.'
|
||||||
hookenv.log(message)
|
hookenv.log(message)
|
||||||
hookenv.status_set('maintenance', message)
|
hookenv.status_set('maintenance', message)
|
||||||
@ -325,8 +310,14 @@ def start_kube_dns():
|
|||||||
'dns_domain': hookenv.config('dns_domain')
|
'dns_domain': hookenv.config('dns_domain')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
create_addon('kubedns-controller.yaml', context)
|
|
||||||
create_addon('kubedns-svc.yaml', context)
|
try:
|
||||||
|
create_addon('kubedns-controller.yaml', context)
|
||||||
|
create_addon('kubedns-svc.yaml', context)
|
||||||
|
except CalledProcessError:
|
||||||
|
hookenv.log('kubedns deploy failed, will try again soon')
|
||||||
|
return
|
||||||
|
|
||||||
set_state('kube-dns.available')
|
set_state('kube-dns.available')
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user