From 09f4d812b3090afb00793fbe2c3ba6ee1502784d Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 28 Dec 2020 16:37:49 +0100 Subject: [PATCH] outposts: set field_manager --- authentik/outposts/controllers/k8s/deployment.py | 5 ++++- authentik/outposts/controllers/k8s/secret.py | 5 ++++- authentik/outposts/controllers/k8s/service.py | 5 ++++- authentik/outposts/controllers/kubernetes.py | 2 ++ authentik/providers/proxy/controllers/k8s/ingress.py | 5 ++++- 5 files changed, 18 insertions(+), 4 deletions(-) diff --git a/authentik/outposts/controllers/k8s/deployment.py b/authentik/outposts/controllers/k8s/deployment.py index 981cade84..c241e91aa 100644 --- a/authentik/outposts/controllers/k8s/deployment.py +++ b/authentik/outposts/controllers/k8s/deployment.py @@ -22,6 +22,7 @@ from authentik.outposts.controllers.k8s.base import ( KubernetesObjectReconciler, NeedsUpdate, ) +from authentik.outposts.controllers.kubernetes import FIELD_MANAGER from authentik.outposts.models import Outpost if TYPE_CHECKING: @@ -118,7 +119,9 @@ class DeploymentReconciler(KubernetesObjectReconciler[V1Deployment]): ) def create(self, reference: V1Deployment): - return self.api.create_namespaced_deployment(self.namespace, reference) + return self.api.create_namespaced_deployment( + self.namespace, reference, field_manager=FIELD_MANAGER + ) def delete(self, reference: V1Deployment): return self.api.delete_namespaced_deployment( diff --git a/authentik/outposts/controllers/k8s/secret.py b/authentik/outposts/controllers/k8s/secret.py index 1d65b4f78..e7fc2d3f8 100644 --- a/authentik/outposts/controllers/k8s/secret.py +++ b/authentik/outposts/controllers/k8s/secret.py @@ -8,6 +8,7 @@ from authentik.outposts.controllers.k8s.base import ( KubernetesObjectReconciler, NeedsUpdate, ) +from authentik.outposts.controllers.kubernetes import FIELD_MANAGER if TYPE_CHECKING: from authentik.outposts.controllers.kubernetes import KubernetesController @@ -51,7 +52,9 @@ class SecretReconciler(KubernetesObjectReconciler[V1Secret]): ) def create(self, reference: V1Secret): - return self.api.create_namespaced_secret(self.namespace, reference) + return self.api.create_namespaced_secret( + self.namespace, reference, field_manager=FIELD_MANAGER + ) def delete(self, reference: V1Secret): return self.api.delete_namespaced_secret( diff --git a/authentik/outposts/controllers/k8s/service.py b/authentik/outposts/controllers/k8s/service.py index b710832f1..3013a70cd 100644 --- a/authentik/outposts/controllers/k8s/service.py +++ b/authentik/outposts/controllers/k8s/service.py @@ -8,6 +8,7 @@ from authentik.outposts.controllers.k8s.base import ( NeedsUpdate, ) from authentik.outposts.controllers.k8s.deployment import DeploymentReconciler +from authentik.outposts.controllers.kubernetes import FIELD_MANAGER if TYPE_CHECKING: from authentik.outposts.controllers.kubernetes import KubernetesController @@ -44,7 +45,9 @@ class ServiceReconciler(KubernetesObjectReconciler[V1Service]): ) def create(self, reference: V1Service): - return self.api.create_namespaced_service(self.namespace, reference) + return self.api.create_namespaced_service( + self.namespace, reference, field_manager=FIELD_MANAGER + ) def delete(self, reference: V1Service): return self.api.delete_namespaced_service( diff --git a/authentik/outposts/controllers/kubernetes.py b/authentik/outposts/controllers/kubernetes.py index f75edf823..2daebfdc4 100644 --- a/authentik/outposts/controllers/kubernetes.py +++ b/authentik/outposts/controllers/kubernetes.py @@ -14,6 +14,8 @@ from authentik.outposts.controllers.k8s.secret import SecretReconciler from authentik.outposts.controllers.k8s.service import ServiceReconciler from authentik.outposts.models import KubernetesServiceConnection, Outpost +FIELD_MANAGER = "goauthentik.io" + class KubernetesController(BaseController): """Manage deployment of outpost in kubernetes""" diff --git a/authentik/providers/proxy/controllers/k8s/ingress.py b/authentik/providers/proxy/controllers/k8s/ingress.py index 1b02a54bc..f0f643f36 100644 --- a/authentik/providers/proxy/controllers/k8s/ingress.py +++ b/authentik/providers/proxy/controllers/k8s/ingress.py @@ -19,6 +19,7 @@ from authentik.outposts.controllers.k8s.base import ( KubernetesObjectReconciler, NeedsUpdate, ) +from authentik.outposts.controllers.kubernetes import FIELD_MANAGER from authentik.providers.proxy.models import ProxyProvider if TYPE_CHECKING: @@ -124,7 +125,9 @@ class IngressReconciler(KubernetesObjectReconciler[NetworkingV1beta1Ingress]): ) def create(self, reference: NetworkingV1beta1Ingress): - return self.api.create_namespaced_ingress(self.namespace, reference) + return self.api.create_namespaced_ingress( + self.namespace, reference, field_manager=FIELD_MANAGER + ) def delete(self, reference: NetworkingV1beta1Ingress): return self.api.delete_namespaced_ingress(