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 - name: keycloak-cert
mountPath: /etc/certs mountPath: /etc/certs
readOnly: true readOnly: true
env: envFrom:
- name: KC_HTTPS_CERTIFICATE_FILE - configMapRef:
value: /etc/certs/tls.crt name: keycloak-env
- name: KC_HTTPS_CERTIFICATE_KEY_FILE - secretRef:
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:
name: keycloak-secret name: keycloak-secret
key: keycloak-user
- name: KEYCLOAK_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: keycloak-secret
key: keycloak-password
ports: ports:
- name: http - name: http
containerPort: 8080 containerPort: 8080

View file

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