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
This commit is contained in:
Michael Kelly 2022-10-13 21:41:18 -07:00
parent cb9a0e8027
commit 129f6b87f3
No known key found for this signature in database
GPG Key ID: 77F7FE93040ECF3E
2 changed files with 1 additions and 3 deletions

View File

@ -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:

View File

@ -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",