Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change: Support Keycloak migrations via the API init-container #641

Merged
merged 6 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions charts/lagoon-core/ci/linter-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ keycloakAdminEmail: [email protected]
api:
replicaCount: 1
image:
repository: uselagoon/api
# TODO - update repo/tag before v2.18 release
repository: testlagoon/api
tag: main
resources:
requests:
cpu: "10m"
Expand All @@ -47,7 +49,6 @@ apiRedis:
requests:
cpu: "10m"

# TODO - update repo/tag before v2.11 release
actionsHandler:
replicaCount: 1
image:
Expand All @@ -71,7 +72,9 @@ keycloak:
replyTo: [email protected]
envelopeFrom: [email protected]
image:
repository: uselagoon/keycloak
# TODO - update repo/tag before v2.18 release
repository: testlagoon/keycloak
tag: main
resources:
requests:
cpu: "10m"
Expand Down
41 changes: 41 additions & 0 deletions charts/lagoon-core/templates/api.deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,47 @@ spec:
{{- end }}
securityContext:
{{- toYaml (coalesce .Values.api.podSecurityContext .Values.podSecurityContext) | nindent 8 }}
initContainers:
- command:
- "sh"
- "-c"
- "node -r dotenv-extended/config dist/migrations/lagoon/migration.js"
image: "{{ .Values.api.image.repository }}:{{ coalesce .Values.api.image.tag .Values.imageTag .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.api.image.pullPolicy }}
name: migrations
env:
- name: API_DB_HOST
value: {{ include "lagoon-core.apiDB.fullname" . }}
- name: API_DB_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "lagoon-core.apiDB.fullname" . }}
key: API_DB_PASSWORD
- name: KEYCLOAK_ADMIN_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "lagoon-core.keycloak.fullname" . }}
key: KEYCLOAK_ADMIN_PASSWORD
- name: KEYCLOAK_ADMIN_USER
value: {{ .Values.keycloakAdminUser | quote }}
- name: KEYCLOAK_API_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: {{ include "lagoon-core.keycloak.fullname" . }}
key: KEYCLOAK_API_CLIENT_SECRET
- name: KEYCLOAK_URL
{{- if .Values.keycloakFrontEndURL }}
value: {{ .Values.keycloakFrontEndURL }}
{{- else if .Values.keycloak.ingress.enabled }}
value: https://{{ index .Values.keycloak.ingress.hosts 0 "host" }}
{{- else }}
value: http://{{ include "lagoon-core.keycloak.fullname" . }}:{{ .Values.keycloak.service.port }}
{{- end }}
- name: REDIS_HOST
value: {{ include "lagoon-core.apiRedis.fullname" . }}
envFrom:
- secretRef:
name: {{ include "lagoon-core.api.fullname" . }}
containers:
- name: api
securityContext:
Expand Down
13 changes: 13 additions & 0 deletions charts/lagoon-core/templates/keycloak.deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,19 @@ spec:
- name: KEYCLOAK_ADMIN_EMAIL
value: {{ . | quote }}
{{- end }}
- name: LAGOON_DB_HOST
value: {{ include "lagoon-core.apiDB.fullname" . }}
- name: LAGOON_DB_VENDOR
value: mariadb
- name: LAGOON_DB_USER
value: api
- name: LAGOON_DB_DATABASE
value: infrastructure
- name: LAGOON_DB_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "lagoon-core.apiDB.fullname" . }}
key: API_DB_PASSWORD
{{- range $key, $val := .Values.keycloak.additionalEnvs }}
- name: {{ $key }}
value: {{ $val | quote }}
Expand Down
2 changes: 2 additions & 0 deletions charts/lagoon-remote/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,5 @@ annotations:
description: removed dioscuri subchart, activestandby is handled via a Lagoon task directly now
- kind: changed
description: updated insights-remote version to v0.0.9
- kind: changed
description: added initcontainer to api to handle keycloak migrations
Loading