Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

outposts: disable deployment and secret reconciler for embedded outpost in code instead of in config #8021

Merged
merged 1 commit into from
Dec 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion authentik/outposts/api/outposts.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def validate_name(self, name: str) -> str:
"""Validate name (especially for embedded outpost)"""
if not self.instance:
return name
if self.instance.managed == MANAGED_OUTPOST:
if self.instance.managed == MANAGED_OUTPOST and name != MANAGED_OUTPOST_NAME:
raise ValidationError("Embedded outpost's name cannot be changed")
if self.instance.name == MANAGED_OUTPOST_NAME:
self.instance.managed = MANAGED_OUTPOST
Expand Down
7 changes: 0 additions & 7 deletions authentik/outposts/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ def reconcile_embedded_outpost(self):
DockerServiceConnection,
KubernetesServiceConnection,
Outpost,
OutpostConfig,
OutpostType,
)

Expand All @@ -56,10 +55,4 @@ def reconcile_embedded_outpost(self):
outpost.service_connection = KubernetesServiceConnection.objects.first()
elif DockerServiceConnection.objects.exists():
outpost.service_connection = DockerServiceConnection.objects.first()
outpost.config = OutpostConfig(
kubernetes_disabled_components=[
"deployment",
"secret",
]
)
outpost.save()
4 changes: 4 additions & 0 deletions authentik/outposts/controllers/k8s/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ def __init__(self, controller: "KubernetesController") -> None:
self.api = AppsV1Api(controller.client)
self.outpost = self.controller.outpost

@property
def noop(self) -> bool:
return self.is_embedded

@staticmethod
def reconciler_name() -> str:
return "deployment"
Expand Down
4 changes: 4 additions & 0 deletions authentik/outposts/controllers/k8s/secret.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ def __init__(self, controller: "KubernetesController") -> None:
super().__init__(controller)
self.api = CoreV1Api(controller.client)

@property
def noop(self) -> bool:
return self.is_embedded

@staticmethod
def reconciler_name() -> str:
return "secret"
Expand Down
5 changes: 4 additions & 1 deletion authentik/outposts/controllers/k8s/service_monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,10 @@

@property
def noop(self) -> bool:
return (not self._crd_exists()) or (self.is_embedded)
if not self._crd_exists():
self.logger.debug("CRD doesn't exist")
return True
return self.is_embedded

Check warning on line 83 in authentik/outposts/controllers/k8s/service_monitor.py

View check run for this annotation

Codecov / codecov/patch

authentik/outposts/controllers/k8s/service_monitor.py#L83

Added line #L83 was not covered by tests

def _crd_exists(self) -> bool:
"""Check if the Prometheus ServiceMonitor exists"""
Expand Down
Loading