Skip to content

Commit

Permalink
install authelia
Browse files Browse the repository at this point in the history
  • Loading branch information
cyclingwithelephants committed Nov 23, 2023
1 parent a565c6b commit 551559a
Show file tree
Hide file tree
Showing 11 changed files with 141 additions and 32 deletions.
1 change: 1 addition & 0 deletions manifests/prod/addons/argo-cd/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ resources:
patches:
- path: patches/argocd-cm.yaml
- path: patches/argocd-cmd-params-cm.yaml
- path: patches/argocd-rbac-cm.yaml
29 changes: 15 additions & 14 deletions manifests/prod/addons/argo-cd/patches/argocd-cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: argocd-cm
# namespace: argocd
data:
# this allows us to use helmCharts in kustomization.yaml files
# it's a convenient way to reference remote helm charts
Expand All @@ -16,17 +15,19 @@ data:
timeout.reconciliation: 3m0s
timeout.hard.reconciliation: 5m0s

# once I've handled SSO, disable the admin user
# admin.enabled: false
url: https://argocd.prod.adamland.xyz

# Looks like you realistically need a github org to use SSO this way
# https://dexidp.io/docs/connectors/github/
# dex.config: |
# connectors:
# # GitHub example
# - type: github
# id: github
# name: GitHub
# config:
# clientID: 2c4e746b39d42c6d2889
# clientSecret: $dex.github.clientSecret # Alternatively $<some_K8S_secret>:dex.github.clientSecret
dex.config: |
connectors:
- config:
issuer: http://authentik.prod.adamland.xyz/application/o/argocd/
clientID: VhCSqSGS9uTPxmTRDJymKwpl1TpQi6NYEPAebG2w
clientSecret: $dex.authentik.clientSecret
insecureEnableGroups: true
scopes:
- openid
- profile
- email
name: authentik
type: oidc
id: authentik
7 changes: 7 additions & 0 deletions manifests/prod/addons/argo-cd/patches/argocd-rbac-cm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: argocd-rbac-cm
data:
policy.csv: |
g, admins, role:admin
15 changes: 15 additions & 0 deletions manifests/prod/addons/authentik/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
namespace: authentik

resources:
- resources/postgres.yaml
- resources/configmap.yaml

helmCharts:
- name: authentik
includeCRDs: true
valuesFile: values.yaml
releaseName: authentik
version: 2023.10.4
repo: https://charts.goauthentik.io/
11 changes: 11 additions & 0 deletions manifests/prod/addons/authentik/resources/configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: authentik-config
data:
# https://goauthentik.io/docs/installation/configuration
AUTHENTIK_LOG_LEVEL: 'info'
AUTHENTIK_POSTGRESQL__USE_PGBOUNCER: 'false'
AUTHENTIK_POSTGRESQL__USE_PGPOOL: 'false'
AUTHENTIK_POSTGRESQL__SSLMODE: 'verify-ca'
AUTHENTIK_DISABLE_UPDATE_CHECK: 'true'
13 changes: 13 additions & 0 deletions manifests/prod/addons/authentik/resources/postgres.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: postgresql.cnpg.io/v1
kind: Cluster
metadata:
name: pg
spec:
instances: 3
primaryUpdateStrategy: unsupervised # automated update of the primary once all replicas have been upgraded
bootstrap:
initdb:
database: authentik
owner: authentik
storage:
size: 5Gi
74 changes: 74 additions & 0 deletions manifests/prod/addons/authentik/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
authentik:
secret_key: "" # we grab this from the environment
error_reporting:
enabled: false

ingress:
enabled: true
ingressClassName: nginx
hosts:
- host: &domain authentik.prod.adamland.xyz
paths:
- path: "/"
pathType: Prefix
tls:
- secretName: authentik-ui-tls
hosts: [*domain]

annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
nginx.ingress.kubernetes.io/backend-protocol: HTTP
nginx.ingress.kubernetes.io/force-ssl-redirect: "true"

postgresql:
enabled: false
redis:
enabled: true

envFrom:
- configMapRef:
name: authentik-config
- secretRef:
name: authentik-secret-key
envValueFrom:
AUTHENTIK_POSTGRESQL__HOST:
secretKeyRef:
name: pg-app # generated by cnpg's postgres cluster custom resource
key: host
AUTHENTIK_POSTGRESQL__PORT:
secretKeyRef:
name: pg-app # generated by cnpg's postgres cluster custom resource
key: port
AUTHENTIK_POSTGRESQL__NAME:
secretKeyRef:
name: pg-app # generated by cnpg's postgres cluster custom resource
key: dbname
AUTHENTIK_POSTGRESQL__USER:
secretKeyRef:
name: pg-app # generated by cnpg's postgres cluster custom resource
key: username
AUTHENTIK_POSTGRES__PASSWORD:
secretKeyRef:
name: pg-app # generated by cnpg's postgres cluster custom resource
key: password
POSTGRES_PASSWORD:
secretKeyRef:
name: pg-app # generated by cnpg's postgres cluster custom resource
key: password

# Path to x509 client certificate to authenticate to server
#AUTHENTIK_POSTGRESQL__SSLCERT:
#AUTHENTIK_POSTGRESQL__SSLKEY:

volumes:
- name: root-cert
secret:
secretName: pg-ca
items:
- key: ca.crt
path: root.crt

volumeMounts:
- name: root-cert
mountPath: /authentik/.postgresql/
readOnly: true
2 changes: 1 addition & 1 deletion manifests/prod/addons/namespaces/argocd.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: argocd
name: authentik
4 changes: 4 additions & 0 deletions manifests/prod/addons/namespaces/authentik.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: argocd
6 changes: 0 additions & 6 deletions manifests/prod/apps/postgres/kustomization.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions manifests/prod/apps/postgres/resources/authelia.yaml

This file was deleted.

0 comments on commit 551559a

Please sign in to comment.