Skip to content

Commit

Permalink
feat: add keycloak
Browse files Browse the repository at this point in the history
  • Loading branch information
reinthal committed Nov 29, 2024
1 parent 685e6e0 commit b29b882
Show file tree
Hide file tree
Showing 4 changed files with 139 additions and 2 deletions.
21 changes: 21 additions & 0 deletions infrastructure/supporting-infra/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# how to create keycloak-secret-sealed.yaml

```bash
echo "Input Keycloak Postgres Password:"
read PGPASSWORD
echo "Input Keycloak Admin Password:"
read ADMINPASSWORD
kubectl -n dagster create secret generic keycloak-secret -n keycloak \
--from-literal=keycloak-postgres-password="${PGPASSWORD}" \
--from-literal=keycloak-postgres-host='postgres.reinthal.me' \
--from-literal=keycloak-postgres-username='keycloak' \
--from-literal=keycloak-postgres-database='keycloak' \
--from-literal=keycloak-admin-password="${ADMINPASSWORD}" \
--dry-run=client \
-o yaml \
| tee keycloak-secret.yaml \
| kubeseal --format=yaml --cert=../../keys/pub-sealed-secrets.pem \
| tee keycloak-secret-sealed.yaml
unset PGPASSWORD
unset ADMINPASSWORD
```
19 changes: 19 additions & 0 deletions infrastructure/supporting-infra/keycloak-secret-sealed.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
apiVersion: bitnami.com/v1alpha1
kind: SealedSecret
metadata:
creationTimestamp: null
name: keycloak-secret
namespace: keycloak
spec:
encryptedData:
keycloak-admin-password: AgB4mSQ2Mn9kkDPso+kIluekLAwbKgcqTtH3uVzRF8X4ufSBN+lTDIxA2OgUhz42NsePCXV62MbY5AG0FDolmdkKmS240q+ys5a4TksRWcybqIQdPAcHmBLpTlP1aFqwGhobSEQc+5O577zsuib2Dv8zwIHznrXKvvDmwPbjxVoMsMi7V/8HchCtk/DxScadKT3x1AqMzmApU0jfxd9++iHnTDX/UHvAfCl8p6LL80d9xJ2z6M41Cu7SFcTVk3MDugShta50RUqr83hbcINDsn9ph+zaD8ajnCq3FVmiBCP85NLxml5L7RWJNQFWjbmdmyhqNN01s9YfJXP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I2jGzKd6ModpqsR9lBgrkKm7sG/ZbVK1lz7byhGh4fMMUWezPrWI1A9zBmDYbXOvdRY5/gSxpinPX44a+GLBe0V2gtv1HPkg==
template:
metadata:
creationTimestamp: null
name: keycloak-secret
namespace: keycloak
93 changes: 93 additions & 0 deletions infrastructure/supporting-infra/keycloak.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
apiVersion: v1
kind: Namespace
metadata:
name: keycloak
labels:
toolkit.fluxcd.io/tenant: datadrivet-team
---
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: HelmRepository
metadata:
name: keycloak
namespace: flux-system
spec:
type: "oci"
interval: 5m0s
url: oci://registry-1.docker.io/bitnamicharts
---
apiVersion: helm.toolkit.fluxcd.io/v2beta2
kind: HelmRelease
metadata:
name: keycloak
namespace: flux-system
spec:
chart:
spec:
chart: keycloak
reconcileStrategy: ChartVersion
sourceRef:
kind: HelmRepository
name: keycloak
namespace: flux-system
version: 18.7.1
install:
createNamespace: true
interval: 1m0s
releaseName: keycloak
targetNamespace: keycloak
values:
auth:
existingSecret: keycloak-secret
passwordSecretKey: keycloak-admin-password
adminUser: keycloak
postgresql:
enabled: false
externalDatabase:
database: keycloak
host: postgres.reinthal.me
port: 5432
user: keycloak
existingSecret: keycloak-secret
existingSecretPasswordKey: keycloak-postgres-password
extraEnvVars: []
extraStartupArgs: --features=preview --log-level=org.keycloak.events:debug
extraVolumeMounts: |
- name: extensions
mountPath: /opt/bitnami/keycloak/providers
extraVolumes: |
- name: extensions
emptyDir: {}
httpRelativePath: /auth/
ingress:
enabled: true
tls: true
hostname: auth.local.reinthal.cc
annotations:
cert-manager.io/cluster-issuer: letsencrypt

adminIngress:
enabled: true
tls: true
hostname: keycloak.local.reinthal.cc
annotations:
cert-manager.io/cluster-issuer: letsencrypt

initContainers: |
- name: realm-ext-provider
image: curlimages/curl
imagePullPolicy: IfNotPresent
command:
- sh
args:
- -c
- |
curl -L -f -S -o /extensions/onyxia-web.jar https://github.com/InseeFrLab/onyxia/releases/download/v8.4.5/keycloak-theme.jar
volumeMounts:
- name: extensions
mountPath: /extensions
production: true
proxy: edge
replicaCount: 2
tls:
autoGenerated: false
enabled: false
8 changes: 6 additions & 2 deletions infrastructure/supporting-infra/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- nfs.yaml

# keycloak
- keycloak.yaml
- keycloak-secret-sealed.yaml

# minio
#- minio.yaml
#- minio-tenant-config-secret-sealed.yaml
- minio.yaml
- minio-tenant-config-secret-sealed.yaml

0 comments on commit b29b882

Please sign in to comment.