outposts: trigger deployment re-create when selector changes
This commit is contained in:
@ -19,6 +19,7 @@ from kubernetes.client import (
|
|||||||
from passbook import __version__
|
from passbook import __version__
|
||||||
from passbook.outposts.controllers.k8s.base import (
|
from passbook.outposts.controllers.k8s.base import (
|
||||||
KubernetesObjectReconciler,
|
KubernetesObjectReconciler,
|
||||||
|
NeedsRecreate,
|
||||||
NeedsUpdate,
|
NeedsUpdate,
|
||||||
)
|
)
|
||||||
from passbook.outposts.models import Outpost
|
from passbook.outposts.models import Outpost
|
||||||
@ -44,6 +45,8 @@ class DeploymentReconciler(KubernetesObjectReconciler[V1Deployment]):
|
|||||||
return f"passbook-outpost-{self.outpost.name}"
|
return f"passbook-outpost-{self.outpost.name}"
|
||||||
|
|
||||||
def reconcile(self, current: V1Deployment, reference: V1Deployment):
|
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:
|
if current.spec.replicas != reference.spec.replicas:
|
||||||
raise NeedsUpdate()
|
raise NeedsUpdate()
|
||||||
if (
|
if (
|
||||||
|
|||||||
Reference in New Issue
Block a user