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

authentik Kubernetes Operator #5675

Open
BeryJu opened this issue May 18, 2023 · 4 comments
Open

authentik Kubernetes Operator #5675

BeryJu opened this issue May 18, 2023 · 4 comments
Labels
enhancement/confirmed Enhancements that will be implemented in the future enhancement New feature or request

Comments

@BeryJu
Copy link
Member

BeryJu commented May 18, 2023

Implement a kubernetes "operator" in the authentik worker

  • Create a CRD for blueprints
  • Leader election in the worker container(s)
  • Leader worker will watch for API changes on blueprint objects
  • Blueprint contents will be saved in blueprint instance objects with internal storage
  • Kubernetes managed blueprins should show up as such in the webui
  • Invalid blueprints' status will be written to the blueprint CRD
    • Maybe have a validation webhook?
    • We don't want to have the entire blueprint schema in the CRD, as that schema changes almost every authentik version and would be painful to upgrade

related to goauthentik/helm#127
related to goauthentik/helm#146
related to #4558
related to #4119

@BeryJu BeryJu added enhancement New feature or request enhancement/confirmed Enhancements that will be implemented in the future labels May 18, 2023
@genofire
Copy link

related #5300 (declarative blueprints)

@DreamingRaven
Copy link

I hope you don't mind me putting in my two cents:

We don't want to have the entire blueprint schema in the CRD, as that schema changes almost every authentik version and would be painful to upgrade

https://gitlab.com/GeorgeRaven/authentik-manager/-/blob/master/operator/api/v1alpha1/akblueprint_types.go#L34 I agree I use json.RawSchema for highly varying fields but I try to keep at-least the structure of a blueprint concrete.

It would be fantastic to have a webhook to validate CRDs against the current api of authentik that would make things a lot easier in particular for a CRD that may not have the validation for every specific field! This would also be super helpful just in general when writing blueprints someone could feasibly spin up an instance and validate as they go.

I am not certain how this will translate to python however, possibly marshmallow for handling a complex CRD schema? (not sure what you use internally to validate blueprints)

@danielloader
Copy link

danielloader commented Feb 1, 2024

On the note of an operator, some sort of capacity to define a client either providing the secret externally or exporting the secret back out to a kubernetes secret option by nameRef would be extremely handy for automating deployment of clients and the applications that use them.

Alternatively a crossplane provider similar to https://github.com/crossplane-contrib/provider-keycloak

@MacroPower
Copy link

@danielloader I made a Crossplane provider for Authentik using upjet (code generated from the Terraform provider) and have been using it for a few months:
https://github.com/MacroPower/provider-authentik

Example provider config:
https://github.com/MacroPower/homelab/blob/main/applications/base/crossplane-packages/authentik.yaml

I'm still learning about Compositions and am working on making some examples here:
https://github.com/MacroPower/homelab/tree/main/applications/base/authentik/config

It's pretty nice because you can create a Composition that has just a couple of inputs and use it to create an Application and all its dependencies, plus you can reference anything in the Composition environment.

Main issue I've been dealing with is the unpredictable naming that Authentik uses, e.g. GUIDs for some things, integer primary keys for some things, slugs for others. Makes it difficult to reference things like the embedded outpost. I'm sure there is a way to do it but I'm still somewhat new to Compositions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement/confirmed Enhancements that will be implemented in the future enhancement New feature or request
Projects
Status: No status
Development

No branches or pull requests

5 participants