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

BC-7024-migration-to-ionos-postgres-dev #160

Merged
merged 9 commits into from
Apr 25, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ data:
{% if CAL_IS_MIGRATION is defined %}
IS_MIGRATION: "{{ CAL_IS_MIGRATION }}"
{% endif %}
{% if WITH_BRANCH_POSTGRES_DB_MANAGEMENT is defined and WITH_BRANCH_POSTGRES_DB_MANAGEMENT|bool %}
DB_HOST: "{{ POSTGRES_HOST }}"
DB_SSL: "true"
{% endif %}
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,21 @@ spec:
ports:
- containerPort: 3000
envFrom:
- secretRef:
name: calendar-secret
- configMapRef:
name: calendar-configmap
{% if WITH_BRANCH_POSTGRES_DB_MANAGEMENT is defined and WITH_BRANCH_POSTGRES_DB_MANAGEMENT|bool %}
- secretRef:
name: calendar-secret
name: pg-calendar-secret
YannickEvers marked this conversation as resolved.
Show resolved Hide resolved
env:
- name: DB_PASSWORD
value: "$(DB_USER_PASSWORD)"
- name: DB_USERNAME
value: "$(DB_USER)"
- name: DB_DATABASE
value: "$(DB_NAME)"
{% endif %}
livenessProbe:
failureThreshold: 3
httpGet:
Expand Down
12 changes: 11 additions & 1 deletion ansible/roles/schulcloud-calendar-init/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,22 @@
name: calendar-db-init-file
when: not WITH_CALENDAR_INIT

- name: Test if init job exists
kubernetes.core.k8s_info:
kubeconfig: ~/.kube/config
namespace: "{{ NAMESPACE }}"
api_version: batch/v1
kind: Job
name: calendar-db-init-job
register: calendar_init_job_present
when: WITH_CALENDAR_INIT

- name: Calendar db init job
kubernetes.core.k8s:
kubeconfig: ~/.kube/config
namespace: "{{ NAMESPACE }}"
template: job_init_db.yml.j2
when: WITH_CALENDAR_INIT
when: WITH_CALENDAR_INIT and calendar_init_job_present.resources|length == 0
simoncolincap marked this conversation as resolved.
Show resolved Hide resolved

- name: Calendar db init job
kubernetes.core.k8s:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,21 @@ spec:
- name: calendar-db-init
image: schulcloud/infra-tools:latest
envFrom:
- secretRef:
name: calendar-secret
- configMapRef:
name: calendar-configmap
{% if WITH_BRANCH_POSTGRES_DB_MANAGEMENT is defined and WITH_BRANCH_POSTGRES_DB_MANAGEMENT|bool %}
- secretRef:
name: calendar-secret
name: pg-calendar-secret
env:
- name: DB_PASSWORD
value: "$(DB_USER_PASSWORD)"
- name: DB_USERNAME
value: "$(DB_USER)"
- name: DB_DATABASE
value: "$(DB_NAME)"
{% endif %}
volumeMounts:
- name: script
mountPath: /update.sh
Expand Down