outposts: add service connection to outpost API
Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
parent
de11181890
commit
2addf71f37
|
@ -28,12 +28,12 @@ from authentik.flows.api.bindings import FlowStageBindingViewSet
|
||||||
from authentik.flows.api.flows import FlowViewSet
|
from authentik.flows.api.flows import FlowViewSet
|
||||||
from authentik.flows.api.stages import StageViewSet
|
from authentik.flows.api.stages import StageViewSet
|
||||||
from authentik.flows.views import FlowExecutorView
|
from authentik.flows.views import FlowExecutorView
|
||||||
from authentik.outposts.api.outpost_service_connections import (
|
from authentik.outposts.api.outposts import OutpostViewSet
|
||||||
|
from authentik.outposts.api.service_connections import (
|
||||||
DockerServiceConnectionViewSet,
|
DockerServiceConnectionViewSet,
|
||||||
KubernetesServiceConnectionViewSet,
|
KubernetesServiceConnectionViewSet,
|
||||||
ServiceConnectionViewSet,
|
ServiceConnectionViewSet,
|
||||||
)
|
)
|
||||||
from authentik.outposts.api.outposts import OutpostViewSet
|
|
||||||
from authentik.policies.api.bindings import PolicyBindingViewSet
|
from authentik.policies.api.bindings import PolicyBindingViewSet
|
||||||
from authentik.policies.api.policies import PolicyViewSet
|
from authentik.policies.api.policies import PolicyViewSet
|
||||||
from authentik.policies.dummy.api import DummyPolicyViewSet
|
from authentik.policies.dummy.api import DummyPolicyViewSet
|
||||||
|
|
|
@ -13,6 +13,7 @@ from rest_framework.viewsets import ModelViewSet
|
||||||
from authentik.core.api.providers import ProviderSerializer
|
from authentik.core.api.providers import ProviderSerializer
|
||||||
from authentik.core.api.utils import PassiveSerializer, is_dict
|
from authentik.core.api.utils import PassiveSerializer, is_dict
|
||||||
from authentik.core.models import Provider
|
from authentik.core.models import Provider
|
||||||
|
from authentik.outposts.api.service_connections import ServiceConnectionSerializer
|
||||||
from authentik.outposts.models import (
|
from authentik.outposts.models import (
|
||||||
Outpost,
|
Outpost,
|
||||||
OutpostConfig,
|
OutpostConfig,
|
||||||
|
@ -33,6 +34,9 @@ class OutpostSerializer(ModelSerializer):
|
||||||
queryset=Provider.objects.select_subclasses().all(),
|
queryset=Provider.objects.select_subclasses().all(),
|
||||||
)
|
)
|
||||||
providers_obj = ProviderSerializer(source="providers", many=True, read_only=True)
|
providers_obj = ProviderSerializer(source="providers", many=True, read_only=True)
|
||||||
|
service_connection_obj = ServiceConnectionSerializer(
|
||||||
|
source="service_connection", read_only=True
|
||||||
|
)
|
||||||
|
|
||||||
def validate_providers(self, providers: list[Provider]) -> list[Provider]:
|
def validate_providers(self, providers: list[Provider]) -> list[Provider]:
|
||||||
"""Check that all providers match the type of the outpost"""
|
"""Check that all providers match the type of the outpost"""
|
||||||
|
@ -69,6 +73,7 @@ class OutpostSerializer(ModelSerializer):
|
||||||
"providers",
|
"providers",
|
||||||
"providers_obj",
|
"providers_obj",
|
||||||
"service_connection",
|
"service_connection",
|
||||||
|
"service_connection_obj",
|
||||||
"token_identifier",
|
"token_identifier",
|
||||||
"config",
|
"config",
|
||||||
]
|
]
|
||||||
|
@ -102,7 +107,7 @@ class OutpostViewSet(ModelViewSet):
|
||||||
"name",
|
"name",
|
||||||
"providers__name",
|
"providers__name",
|
||||||
]
|
]
|
||||||
ordering = ["name"]
|
ordering = ["name", "service_connection__name"]
|
||||||
|
|
||||||
@extend_schema(responses={200: OutpostHealthSerializer(many=True)})
|
@extend_schema(responses={200: OutpostHealthSerializer(many=True)})
|
||||||
@action(methods=["GET"], detail=True, pagination_class=None)
|
@action(methods=["GET"], detail=True, pagination_class=None)
|
||||||
|
|
17
schema.yml
17
schema.yml
|
@ -18976,6 +18976,10 @@ components:
|
||||||
nullable: true
|
nullable: true
|
||||||
description: Select Service-Connection authentik should use to manage this
|
description: Select Service-Connection authentik should use to manage this
|
||||||
outpost. Leave empty if authentik should not handle the deployment.
|
outpost. Leave empty if authentik should not handle the deployment.
|
||||||
|
service_connection_obj:
|
||||||
|
allOf:
|
||||||
|
- $ref: '#/components/schemas/ServiceConnection'
|
||||||
|
readOnly: true
|
||||||
token_identifier:
|
token_identifier:
|
||||||
type: string
|
type: string
|
||||||
readOnly: true
|
readOnly: true
|
||||||
|
@ -18988,6 +18992,7 @@ components:
|
||||||
- pk
|
- pk
|
||||||
- providers
|
- providers
|
||||||
- providers_obj
|
- providers_obj
|
||||||
|
- service_connection_obj
|
||||||
- token_identifier
|
- token_identifier
|
||||||
- type
|
- type
|
||||||
OutpostDefaultConfig:
|
OutpostDefaultConfig:
|
||||||
|
@ -24865,6 +24870,18 @@ components:
|
||||||
- pk
|
- pk
|
||||||
- verbose_name
|
- verbose_name
|
||||||
- verbose_name_plural
|
- verbose_name_plural
|
||||||
|
ServiceConnectionRequest:
|
||||||
|
type: object
|
||||||
|
description: ServiceConnection Serializer
|
||||||
|
properties:
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
local:
|
||||||
|
type: boolean
|
||||||
|
description: If enabled, use the local connection. Required Docker socket/Kubernetes
|
||||||
|
Integration
|
||||||
|
required:
|
||||||
|
- name
|
||||||
ServiceConnectionState:
|
ServiceConnectionState:
|
||||||
type: object
|
type: object
|
||||||
description: Serializer for Service connection state
|
description: Serializer for Service connection state
|
||||||
|
|
|
@ -209,8 +209,8 @@ msgid "Application Icon"
|
||||||
msgstr "Application Icon"
|
msgstr "Application Icon"
|
||||||
|
|
||||||
#: src/flows/stages/consent/ConsentStage.ts
|
#: src/flows/stages/consent/ConsentStage.ts
|
||||||
msgid "Application requires following permissions"
|
msgid "Application requires following permissions:"
|
||||||
msgstr "Application requires following permissions"
|
msgstr "Application requires following permissions:"
|
||||||
|
|
||||||
#: src/pages/applications/ApplicationForm.ts
|
#: src/pages/applications/ApplicationForm.ts
|
||||||
msgid "Application's display Name."
|
msgid "Application's display Name."
|
||||||
|
@ -3167,6 +3167,7 @@ msgid "Service Provider Binding"
|
||||||
msgstr "Service Provider Binding"
|
msgstr "Service Provider Binding"
|
||||||
|
|
||||||
#: src/pages/outposts/OutpostForm.ts
|
#: src/pages/outposts/OutpostForm.ts
|
||||||
|
#: src/pages/outposts/OutpostListPage.ts
|
||||||
msgid "Service connection"
|
msgid "Service connection"
|
||||||
msgstr "Service connection"
|
msgstr "Service connection"
|
||||||
|
|
||||||
|
@ -3997,6 +3998,10 @@ msgstr "Unhealthy outposts"
|
||||||
msgid "Unknown"
|
msgid "Unknown"
|
||||||
msgstr "Unknown"
|
msgstr "Unknown"
|
||||||
|
|
||||||
|
#: src/pages/outposts/OutpostListPage.ts
|
||||||
|
msgid "Unmanaged"
|
||||||
|
msgstr "Unmanaged"
|
||||||
|
|
||||||
#: src/pages/admin-overview/charts/LDAPSyncStatusChart.ts
|
#: src/pages/admin-overview/charts/LDAPSyncStatusChart.ts
|
||||||
msgid "Unsynced sources"
|
msgid "Unsynced sources"
|
||||||
msgstr "Unsynced sources"
|
msgstr "Unsynced sources"
|
||||||
|
|
|
@ -209,7 +209,7 @@ msgid "Application Icon"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#:
|
#:
|
||||||
msgid "Application requires following permissions"
|
msgid "Application requires following permissions:"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#:
|
#:
|
||||||
|
@ -3158,6 +3158,7 @@ msgstr ""
|
||||||
msgid "Service Provider Binding"
|
msgid "Service Provider Binding"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#:
|
||||||
#:
|
#:
|
||||||
msgid "Service connection"
|
msgid "Service connection"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -3985,6 +3986,10 @@ msgstr ""
|
||||||
msgid "Unknown"
|
msgid "Unknown"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#:
|
||||||
|
msgid "Unmanaged"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#:
|
#:
|
||||||
msgid "Unsynced sources"
|
msgid "Unsynced sources"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
|
@ -43,6 +43,7 @@ export class OutpostListPage extends TablePage<Outpost> {
|
||||||
return [
|
return [
|
||||||
new TableColumn(t`Name`, "name"),
|
new TableColumn(t`Name`, "name"),
|
||||||
new TableColumn(t`Providers`),
|
new TableColumn(t`Providers`),
|
||||||
|
new TableColumn(t`Service connection`, "service_connection__name"),
|
||||||
new TableColumn(t`Health and Version`),
|
new TableColumn(t`Health and Version`),
|
||||||
new TableColumn(""),
|
new TableColumn(""),
|
||||||
];
|
];
|
||||||
|
@ -57,6 +58,7 @@ export class OutpostListPage extends TablePage<Outpost> {
|
||||||
html`<ul>${item.providersObj?.map((p) => {
|
html`<ul>${item.providersObj?.map((p) => {
|
||||||
return html`<li><a href="#/core/providers/${p.pk}">${p.name}</a></li>`;
|
return html`<li><a href="#/core/providers/${p.pk}">${p.name}</a></li>`;
|
||||||
})}</ul>`,
|
})}</ul>`,
|
||||||
|
html`${item.serviceConnectionObj?.name || t`Unmanaged`}`,
|
||||||
html`<ak-outpost-health outpostId=${ifDefined(item.pk)}></ak-outpost-health>`,
|
html`<ak-outpost-health outpostId=${ifDefined(item.pk)}></ak-outpost-health>`,
|
||||||
html`
|
html`
|
||||||
<ak-forms-modal>
|
<ak-forms-modal>
|
||||||
|
|
Reference in New Issue