# Keycloak dedicado do tenant demo (IdP do silo) — modo dev, persistindo no Postgres apiVersion: apps/v1 kind: Deployment metadata: name: keycloak namespace: escolinha-prod spec: replicas: 0 selector: matchLabels: app: keycloak template: metadata: labels: app: keycloak spec: containers: - name: keycloak image: docker.io/library/keycloak-athleticmap:26.0-4 imagePullPolicy: Never args: ["start-dev", "--import-realm"] env: - name: KC_DB value: postgres - name: KC_DB_URL value: "jdbc:postgresql://postgres:5432/keycloak" - name: KC_DB_USERNAME value: atm - name: KC_DB_PASSWORD valueFrom: secretKeyRef: name: db-credentials key: password - name: KC_BOOTSTRAP_ADMIN_USERNAME value: admin - name: KC_BOOTSTRAP_ADMIN_PASSWORD valueFrom: secretKeyRef: name: keycloak-admin key: password # A senha do SMTP para o IMPORT do realm (`${SMTP_SENHA}` no # 35-realm-import-cm.yaml). Opcional: sem o Secret, o Keycloak sobe. - name: SMTP_SENHA valueFrom: secretKeyRef: name: smtp-credentials key: senha optional: true - name: KC_HEALTH_ENABLED value: "true" - name: KC_HTTP_ENABLED value: "true" - name: KC_PROXY_HEADERS value: xforwarded - name: KC_HOSTNAME value: "auth-escolinha.athleticmap.com" - name: KC_HOSTNAME_STRICT value: "true" ports: - containerPort: 8080 - containerPort: 9000 resources: requests: cpu: 150m memory: 512Mi limits: cpu: "1" memory: 1Gi readinessProbe: httpGet: path: /health/ready port: 9000 initialDelaySeconds: 30 periodSeconds: 10 failureThreshold: 40 volumeMounts: - name: realm-import mountPath: /opt/keycloak/data/import readOnly: true - name: theme-athleticmapv2 mountPath: /opt/keycloak/themes/athleticmap-v2/login readOnly: true # O tema de E-MAIL, no mesmo `athleticmap-v2`. Ate 2026-09-25 o # cliente deste tenant recebia o e-mail de fabrica do Keycloak, em # ingles, enquanto os tenants novos ja recebiam o da marca. # # Quatro arquivos em tres diretorios, e ConfigMap nao tem diretorio: # as chaves sao achatadas e o `items[].path` remonta a hierarquia. - name: email-athleticmapv2 mountPath: /opt/keycloak/themes/athleticmap-v2/email readOnly: true volumes: - name: realm-import configMap: name: kc-realm-import - name: theme-athleticmapv2 configMap: name: kc-theme-athleticmapv2 - name: email-athleticmapv2 configMap: name: kc-email-athleticmapv2 # Os caminhos TEM de bater com o mapa ARQUIVOS do gerador. items: - { key: theme.properties, path: theme.properties } - { key: template.ftl, path: html/template.ftl } - { key: executeActions.ftl, path: html/executeActions.ftl } - { key: messages_pt_BR.properties, path: messages/messages_pt_BR.properties } - { key: messages_en.properties, path: messages/messages_en.properties } --- apiVersion: v1 kind: Service metadata: name: keycloak namespace: escolinha-prod spec: selector: app: keycloak ports: - port: 8080 targetPort: 8080