From 1c426c51361cf7a978b4de72efff76abb5af0b96 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 19 Oct 2020 16:21:39 +0200 Subject: [PATCH] outposts: trigger deployment re-create when selector changes --- passbook/outposts/controllers/k8s/deployment.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/passbook/outposts/controllers/k8s/deployment.py b/passbook/outposts/controllers/k8s/deployment.py index d1052e361..2deae1fd3 100644 --- a/passbook/outposts/controllers/k8s/deployment.py +++ b/passbook/outposts/controllers/k8s/deployment.py @@ -19,6 +19,7 @@ from kubernetes.client import ( from passbook import __version__ from passbook.outposts.controllers.k8s.base import ( KubernetesObjectReconciler, + NeedsRecreate, NeedsUpdate, ) from passbook.outposts.models import Outpost @@ -44,6 +45,8 @@ class DeploymentReconciler(KubernetesObjectReconciler[V1Deployment]): return f"passbook-outpost-{self.outpost.name}" def reconcile(self, current: V1Deployment, reference: V1Deployment): + if current.spec.selector.match_labels != reference.spec.selector.match_labels: + raise NeedsRecreate() if current.spec.replicas != reference.spec.replicas: raise NeedsUpdate() if (