From 064fe747c5a546aae6327c498ec90c09c79bad38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Dulko?= Date: Fri, 30 Nov 2018 16:31:05 +0100 Subject: [PATCH] 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 --- kuryr_kubernetes/cni/daemon/service.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kuryr_kubernetes/cni/daemon/service.py b/kuryr_kubernetes/cni/daemon/service.py index b81076575..bb09f6e3f 100644 --- a/kuryr_kubernetes/cni/daemon/service.py +++ b/kuryr_kubernetes/cni/daemon/service.py @@ -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):