Skip to content

Commit

Permalink
Add check if Job already exists (can't be patched)
Browse files Browse the repository at this point in the history
  • Loading branch information
YannickEvers committed Apr 5, 2024
1 parent 17afe22 commit ceb096b
Showing 1 changed file with 11 additions and 1 deletion.
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 exits
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

- name: Calendar db init job
kubernetes.core.k8s:
Expand Down

0 comments on commit ceb096b

Please sign in to comment.