From 129f6b87f36a1f731b8b0f134f58691470972f54 Mon Sep 17 00:00:00 2001 From: Michael Kelly Date: Thu, 13 Oct 2022 21:41:18 -0700 Subject: [PATCH] bug: Select scheduler pod based on instance name on update smart_update() currently uses the label 'app.kubernetes.io/instance: zuul' to select the scheduler pod(s) when attempting to kick a smart update in the pod, however, the pods are created with 'app.kubernetes.io/instance: my-instance-name', which will cause us to not find any scheduler pods to update. Instead, we should use the correct label expression for the query. Once smart_update() was finding the scheduler pod correctly, pod_exec() fails on an unnecessary call to load_kube_config(). Removing this enables the pod_exec() - which is only ever used by smart_update() - to succeed. Change-Id: I57e4e3dacac1df24a941dd23da6344b4243a0bed --- zuul_operator/utils.py | 2 -- zuul_operator/zuul.py | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/zuul_operator/utils.py b/zuul_operator/utils.py index ee547a5..07622ed 100644 --- a/zuul_operator/utils.py +++ b/zuul_operator/utils.py @@ -19,7 +19,6 @@ import string import kopf import yaml import jinja2 -import kubernetes from kubernetes.client import Configuration from kubernetes.client.api import core_v1_api from kubernetes.stream import stream @@ -82,7 +81,6 @@ def update_secret(api, namespace, name, string_data): def pod_exec(namespace, name, command): - kubernetes.config.load_kube_config() try: c = Configuration().get_default_copy() except AttributeError: diff --git a/zuul_operator/zuul.py b/zuul_operator/zuul.py index 1183b1e..f63b0bf 100644 --- a/zuul_operator/zuul.py +++ b/zuul_operator/zuul.py @@ -449,7 +449,7 @@ class Zuul: for obj in objects.Pod.objects(self.api).filter( namespace=self.namespace, - selector={'app.kubernetes.io/instance': 'zuul', + selector={'app.kubernetes.io/instance': self.name, 'app.kubernetes.io/component': 'zuul-scheduler', 'app.kubernetes.io/name': 'zuul'}): self.log.info("Waiting for config to update on %s",