Lowercase hostname when using it as K8s nodeName

kuryr-daemon is watching K8s API for new pods appearing on it's node. To
identify such pods nodeName property of pod is used. In
non-containerized deployments we're assuming that node's hostname is the
nodeName. Turns out that K8s is lowercasing it before making it the
nodeName.  We should do the same, otherwise kuryr-daemon will never find
it's pods.

Change-Id: I2bc6b78823e888001b93284b6efa962fad42a37b
Closes-Bug: 1806062
This commit is contained in:
Michał Dulko 2018-11-30 16:31:05 +01:00
parent 81d8d7ed59
commit 064fe747c5

View File

@ -183,7 +183,8 @@ class CNIDaemonWatcherService(cotyledon.Service):
try:
nodename = os.environ['KUBERNETES_NODE_NAME']
except KeyError:
nodename = socket.gethostname()
# NOTE(dulek): By default K8s nodeName is lowercased hostname.
nodename = socket.gethostname().lower()
return nodename
def run(self):