mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-10 04:27:54 +00:00
Lowercase hostnames when used as node names in k8s
This commit is contained in:
parent
afb26b9323
commit
99a25fed19
@ -157,7 +157,7 @@ def shutdown():
|
||||
'''
|
||||
try:
|
||||
if os.path.isfile(kubeconfig_path):
|
||||
kubectl('delete', 'node', gethostname())
|
||||
kubectl('delete', 'node', gethostname().lower())
|
||||
except CalledProcessError:
|
||||
hookenv.log('Failed to unregister node.')
|
||||
service_stop('snap.kubelet.daemon')
|
||||
@ -906,7 +906,8 @@ class ApplyNodeLabelFailed(Exception):
|
||||
def _apply_node_label(label, delete=False, overwrite=False):
|
||||
''' Invoke kubectl to apply node label changes '''
|
||||
|
||||
hostname = gethostname()
|
||||
# k8s lowercases hostnames and uses them as node names
|
||||
hostname = gethostname().lower()
|
||||
# TODO: Make this part of the kubectl calls instead of a special string
|
||||
cmd_base = 'kubectl --kubeconfig={0} label node {1} {2}'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user