Get env from configmap and secret

This commit is contained in:
patdyn 2024-08-27 15:40:16 +02:00
parent 59208e8829
commit f98d4ab9b5
3 changed files with 24 additions and 41 deletions

View file

@ -0,0 +1,15 @@
# TODO: Make generate-configmap function
apiVersion: v1
kind: ConfigMap
metadata:
name: keycloak-env
namespace: NAMESPACE
data:
KC_HTTPS_CERTIFICATE_FILE: /etc/certs/tls.crt
KC_HTTPS_CERTIFICATE_KEY_FILE: /etc/certs/tls.key
KC_HOSTNAME: FQDN
KC_PROXY: edge
DB_VENDOR: POSTGRES
DB_ADDR: postgresql-service
DB_SCHEMA: public
DB_DATABASE: postgres

View file

@ -25,46 +25,11 @@ spec:
- name: keycloak-cert
mountPath: /etc/certs
readOnly: true
env:
- name: KC_HTTPS_CERTIFICATE_FILE
value: /etc/certs/tls.crt
- name: KC_HTTPS_CERTIFICATE_KEY_FILE
value: /etc/certs/tls.key
- name: KC_HOSTNAME
value: FQDN
- name: KC_PROXY
value: edge
- name: DB_VENDOR
value: POSTGRES
- name: DB_ADDR
value: postgresql-service
- name: DB_SCHEMA
value: public
- name: DB_DATABASE
valueFrom:
configMapKeyRef:
name: postgres-config
key: postgres-db
- name: DB_USER
valueFrom:
secretKeyRef:
name: postgres-secret
key: postgres-user
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: postgres-secret
key: postgres-password
- name: KEYCLOAK_ADMIN
valueFrom:
secretKeyRef:
envFrom:
- configMapRef:
name: keycloak-env
- secretRef:
name: keycloak-secret
key: keycloak-user
- name: KEYCLOAK_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: keycloak-secret
key: keycloak-password
ports:
- name: http
containerPort: 8080

View file

@ -1,3 +1,4 @@
# TODO: Update generate-secret function
apiVersion: v1
kind: Secret
metadata:
@ -5,5 +6,7 @@ metadata:
namespace: NAMESPACE
type: Opaque
data:
keycloak-user: admin
keycloak-password: admin
DB_USER: DBUSER
DB_PASSWORD: DBPW
KEYCLOAK_ADMIN: ADMIN_USER
KEYCLOAK_ADMIN_PASSWORD: ADMIN_PASS