mirror of https://github.com/k3s-io/k3s
Merge pull request #65487 from dshcherb/master
Automatic merge from submit-queue (batch tested with PRs 60150, 65467, 65487, 65595, 65374). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. use lowercase hostnames for node names **What this PR does / why we need it**: Uppercase hostnames used in charms result in (lowercase) node name lookup errors. This happens when /etc/hostname contains uppercase characters and gethostname or getfqdn return those characters. **Special notes for your reviewer**: Discovered in a field deployment where hostnames are all uppercase. **Release note**: ```release-note Hostnames are now converted to lowercase before being used for node lookups in the kubernetes-worker charm. ```pull/8/head
commit
4859645cea
|
@ -173,7 +173,7 @@ def shutdown():
|
|||
'''
|
||||
try:
|
||||
if os.path.isfile(kubeconfig_path):
|
||||
kubectl('delete', 'node', gethostname().lower())
|
||||
kubectl('delete', 'node', get_node_name())
|
||||
except CalledProcessError:
|
||||
hookenv.log('Failed to unregister node.')
|
||||
service_stop('snap.kubelet.daemon')
|
||||
|
@ -314,7 +314,7 @@ def send_data(tls, kube_control):
|
|||
sans = [
|
||||
hookenv.unit_public_ip(),
|
||||
ingress_ip,
|
||||
gethostname()
|
||||
get_node_name()
|
||||
]
|
||||
|
||||
# Create a path safe name by removing path characters from the unit name.
|
||||
|
@ -1058,9 +1058,9 @@ def get_node_name():
|
|||
elif is_state('endpoint.openstack.ready'):
|
||||
cloud_provider = 'openstack'
|
||||
if cloud_provider == 'aws':
|
||||
return getfqdn()
|
||||
return getfqdn().lower()
|
||||
else:
|
||||
return gethostname()
|
||||
return gethostname().lower()
|
||||
|
||||
|
||||
class ApplyNodeLabelFailed(Exception):
|
||||
|
|
Loading…
Reference in New Issue