From 1554dc9febab4e36386b6de7680a4727e0ac1d32 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Wed, 23 Jun 2021 21:26:24 +0200 Subject: [PATCH] outposts: make outpost managed Signed-off-by: Jens Langhammer --- authentik/outposts/api/outposts.py | 1 + .../migrations/0017_outpost_managed.py | 18 ++++++++++++++ authentik/outposts/models.py | 3 ++- schema.yml | 24 +++++++++++++++++++ 4 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 authentik/outposts/migrations/0017_outpost_managed.py diff --git a/authentik/outposts/api/outposts.py b/authentik/outposts/api/outposts.py index 4cf47d907f..11a6c5fbfb 100644 --- a/authentik/outposts/api/outposts.py +++ b/authentik/outposts/api/outposts.py @@ -77,6 +77,7 @@ class OutpostSerializer(ModelSerializer): "service_connection_obj", "token_identifier", "config", + "managed", ] extra_kwargs = {"type": {"required": True}} diff --git a/authentik/outposts/migrations/0017_outpost_managed.py b/authentik/outposts/migrations/0017_outpost_managed.py new file mode 100644 index 0000000000..f5dcff1adf --- /dev/null +++ b/authentik/outposts/migrations/0017_outpost_managed.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.4 on 2021-06-23 19:25 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('authentik_outposts', '0016_alter_outpost_type'), + ] + + operations = [ + migrations.AddField( + model_name='outpost', + name='managed', + field=models.TextField(default=None, help_text='Objects which are managed by authentik. These objects are created and updated automatically. This is flag only indicates that an object can be overwritten by migrations. You can still modify the objects via the API, but expect changes to be overwritten in a later update.', null=True, unique=True, verbose_name='Managed by authentik'), + ), + ] diff --git a/authentik/outposts/models.py b/authentik/outposts/models.py index 9276becdf7..ff80960a7b 100644 --- a/authentik/outposts/models.py +++ b/authentik/outposts/models.py @@ -34,6 +34,7 @@ from authentik.lib.config import CONFIG from authentik.lib.models import InheritanceForeignKey from authentik.lib.sentry import SentryIgnoredException from authentik.lib.utils.http import USER_ATTRIBUTE_CAN_OVERRIDE_IP +from authentik.managed.models import ManagedModel from authentik.outposts.controllers.k8s.utils import get_namespace from authentik.outposts.docker_tls import DockerInlineTLS @@ -281,7 +282,7 @@ class KubernetesServiceConnection(OutpostServiceConnection): verbose_name_plural = _("Kubernetes Service-Connections") -class Outpost(models.Model): +class Outpost(ManagedModel): """Outpost instance which manages a service user and token""" uuid = models.UUIDField(default=uuid4, editable=False, primary_key=True) diff --git a/schema.yml b/schema.yml index 8e85f84f70..a0982f0186 100644 --- a/schema.yml +++ b/schema.yml @@ -21217,6 +21217,14 @@ components: config: type: object additionalProperties: {} + managed: + type: string + nullable: true + title: Managed by authentik + description: Objects which are managed by authentik. These objects are created + and updated automatically. This is flag only indicates that an object + can be overwritten by migrations. You can still modify the objects via + the API, but expect changes to be overwritten in a later update. required: - config - name @@ -21279,6 +21287,14 @@ components: config: type: object additionalProperties: {} + managed: + type: string + nullable: true + title: Managed by authentik + description: Objects which are managed by authentik. These objects are created + and updated automatically. This is flag only indicates that an object + can be overwritten by migrations. You can still modify the objects via + the API, but expect changes to be overwritten in a later update. required: - config - name @@ -24953,6 +24969,14 @@ components: config: type: object additionalProperties: {} + managed: + type: string + nullable: true + title: Managed by authentik + description: Objects which are managed by authentik. These objects are created + and updated automatically. This is flag only indicates that an object + can be overwritten by migrations. You can still modify the objects via + the API, but expect changes to be overwritten in a later update. PatchedPasswordExpiryPolicyRequest: type: object description: Password Expiry Policy Serializer