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

feat: adds authentik to the cluster #1264

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
34 changes: 34 additions & 0 deletions kubernetes/apps/security/authentik/app/externalsecret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
# yaml-language-server: $schema=https://raw.githubusercontent.com/axeII/crds/main/externalsecret_v1beta1.json
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: authentik
spec:
secretStoreRef:
kind: ClusterSecretStore
name: onepassword-connect
refreshInterval: 15m
target:
name: authentik-secret
creationPolicy: Owner
template:
engineVersion: v2
data:
# Authentik
AUTHENTIK_BOOTSTRAP_EMAIL: '{{ .AUTHENTIK_EMAIL }}'
AUTHENTIK_BOOTSTRAP_PASSWORD: '{{ .AUTHENTIK_PASSWORD }}'
AUTHENTIK_BOOTSTRAP_TOKEN: '{{ .AUTHENTIK_TOKEN }}'
AUTHENTIK_SECRET_KEY: '{{ .AUTHENTIK_SECRET_KEY }}'
AUTHENTIK_REDIS__DB: "1"
AUTHENTIK_POSTGRESQL__NAME: '{{ .dbname }}'
AUTHENTIK_POSTGRESQL__HOST: '{{ .host }}' #pgBouncer is set to session for Grafana, and Authentik requires transaction
AUTHENTIK_POSTGRESQL__USER: '{{ .user }}'
AUTHENTIK_POSTGRESQL__PASSWORD: '{{ .password }}'
AUTHENTIK_POSTGRESQL__USE_PGBOUNCER: 'false'
AUTHENTIK_POSTGRESQL__SSLMODE: 'require'
dataFrom:
- extract:
key: postgres-pguser-authentik
- extract:
key: authentik
54 changes: 54 additions & 0 deletions kubernetes/apps/security/authentik/app/helmrelease.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
apiVersion: helm.toolkit.fluxcd.io/v2beta2
kind: HelmRelease
metadata:
name: authentik
spec:
interval: 30m
chart:
spec:
chart: authentik
version: 2024.6.0
sourceRef:
kind: HelmRepository
name: authentik-charts
namespace: flux-system
install:
remediation:
retries: 3
upgrade:
cleanupOnFail: true
remediation:
strategy: rollback
retries: 3
values:
global:
podAnnotations:
secret.reloader.stakater.com/reload: authentik-secret
deploymentStrategy:
type: RollingUpdate
envFrom:
- secretRef:
name: authentik-secret
authentik:
redis:
host: redis.database.svc.cluster.local
server:
autoscaling:
enabled: true
minReplicas: 1
metrics:
prometheus:
serviceMonitor:
enabled: true
ingress:
enabled: true
ingressClassName: external
# annotations:
hosts:
- sso.${SECRET_DOMAIN}
https: false
worker:
autoscaling:
enabled: true
minReplicas: 1
7 changes: 7 additions & 0 deletions kubernetes/apps/security/authentik/app/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
# yaml-language-server: $schema=https://json.schemastore.org/kustomization
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- ./externalsecret.yaml
- ./helmrelease.yaml
24 changes: 24 additions & 0 deletions kubernetes/apps/security/authentik/ks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
# yaml-language-server: $schema=https://lds-schemas.pages.dev/kustomize.toolkit.fluxcd.io/kustomization_v1.json
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: &app authentik
namespace: flux-system
spec:
targetNamespace: security
commonMetadata:
labels:
app.kubernetes.io/name: *app
dependsOn:
- name: cluster-apps-external-database
- name: external-secrets-stores
path: ./kubernetes/apps/security/authentik/app
prune: true
sourceRef:
kind: GitRepository
name: home-kubernetes
wait: false # no flux ks dependents
interval: 30m
retryInterval: 1m
timeout: 5m
1 change: 1 addition & 0 deletions kubernetes/apps/security/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ kind: Kustomization
resources:
- ./namespace.yaml
- ./pastebin/ks.yaml
- ./authentik/ks.yaml
4 changes: 2 additions & 2 deletions kubernetes/flux/repositories/helm/authentik.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
apiVersion: source.toolkit.fluxcd.io/v1
kind: HelmRepository
metadata:
name: authentik
name: authentik-charts
namespace: flux-system
spec:
interval: 1h
url: https://charts.goauthentik.io/
url: https://charts.goauthentik.io
timeout: 3m
Loading