Fix keycloak connection to db

This commit is contained in:
artem.drozdov 2024-10-07 13:48:43 +03:00
parent a9b549ab60
commit 40beb5664a
3 changed files with 51 additions and 35 deletions

View File

@ -29,7 +29,7 @@ yonoteDatabase:
password: "wsGZ6kXhr5" password: "wsGZ6kXhr5"
postgresPassword: "QQYw4UjOU" postgresPassword: "QQYw4UjOU"
# yonote-redis: # Если используете пароль для redis # yonote-redis: # Если используете auth для redis
# auth: # auth:
# password: "12345678" # password: "12345678"
@ -40,7 +40,4 @@ minio:
keycloak: keycloak:
auth: auth:
adminPassword: "root" adminPassword: "root"
postgresql:
auth:
password: "tT9BqYdNyd"

View File

@ -0,0 +1,7 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: postgres-init-scripts
data:
init.sql: |
CREATE DATABASE "{{ .Values.keycloak.externalDatabase.database }}";

View File

@ -510,11 +510,23 @@ yonoteDatabase:
cpu: 500m cpu: 500m
memory: 512Mi memory: 512Mi
extraVolumes:
- name: init-scripts
configMap:
name: postgres-init-scripts
extraVolumeMounts:
- name: init-scripts
mountPath: /docker-entrypoint-initdb.d
readOnly: true
yonote-redis: yonote-redis:
enabled: true enabled: true
fullnameOverride: yonote-redis fullnameOverride: yonote-redis
nameOverride: redis nameOverride: redis
architecture: standalone architecture: standalone
image:
tag: 7.2.0-debian-11-r0
auth: auth:
enabled: false enabled: false
@ -587,28 +599,26 @@ mcJob:
enabled: true enabled: true
keycloak: keycloak:
fullnameOverride: yonote-keycloak
nameOverride: yonote-keycloak
auth: auth:
adminUser: root adminUser: root
fullnameOverride: yonote-keycloak proxy: "edge"
nameOverride: yonote-keycloak
command: command:
- /bin/bash - /bin/bash
- -c - -c
- | - |
/opt/bitnami/keycloak/bin/kc.sh import --file=/opt/bitnami/keycloak/data/import/realm-export.json && \ /opt/bitnami/keycloak/bin/kc.sh start --import-realm --hostname={{ .Values.ingress.hostname }} --hostname-strict=true --hostname-strict-backchannel=true --https-protocols=TLSv1.2 --proxy=edge --db postgres --db-url-host yonote-database --db-username postgres --db-password="$(DB_PASSWORD)"
/opt/bitnami/keycloak/bin/kc.sh start-dev
extraEnvVars: extraEnvVars:
- name: KC_DB_PASSWORD - name: DB_PASSWORD
value: "{{ .Values.keycloak.postgresql.auth.password }}" valueFrom:
- name: KEYCLOAK_PRODUCTION secretKeyRef:
value: "true" name: yonote-database
- name: KC_HOSTNAME_URL key: postgres-password
value: "https://auth.example.com"
- name: KC_HOSTNAME_ADMIN_URL
value: "https://auth.example.com"
extraVolumes: extraVolumes:
- name: realm-export - name: realm-export
@ -624,14 +634,13 @@ keycloak:
enabled: true enabled: true
hostname: auth.example.com hostname: auth.example.com
ingressClassName: traefik ingressClassName: traefik
tls: true tls:
annotations:
kubernetes.io/ingress.class: traefik
# cert-manager.io/cluster-issuer: letsencrypt.example.com # Если используете
extraTls:
- hosts: - hosts:
- "auth.example.com" - "auth.example.com"
secretName: "you_tls_secret" secretName: "auth.example.com-tls"
annotations:
kubernetes.io/ingress.class: traefik
# cert-manager.io/cluster-issuer: letsencrypt.example.com #Если используете
rules: rules:
- host: "auth.example.com" - host: "auth.example.com"
paths: paths:
@ -646,8 +655,6 @@ keycloak:
name: yonote-keycloak name: yonote-keycloak
port: http port: http
proxy: "edge"
resources: resources:
limits: limits:
cpu: 1 cpu: 1
@ -657,13 +664,18 @@ keycloak:
memory: 256Mi memory: 256Mi
postgresql: postgresql:
enabled: true enabled: false
auth:
database: keycloak externalDatabase:
username: keycloak host: jdbc:postgresql://yonote-database
name: keycloak-database port: 5432
fullnameOverride: keycloak-database user: postgres
nameOverride: keycloak-database database: keycloak
primary:
persistence: livenessProbe:
size: 5Gi initialDelaySeconds: 240
timeoutSeconds: 5
readinessProbe:
initialDelaySeconds: 120
timeoutSeconds: 5