-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Shutdown now successful if namespace does not exist
- Loading branch information
Alan Christie
committed
Dec 17, 2024
1 parent
70119c5
commit 99fd57c
Showing
2 changed files
with
69 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
--- | ||
|
||
# To 'shutdown' we remove: - | ||
# - Database | ||
# - Redis | ||
# - Stack | ||
# And then, delete... | ||
# - Database volume | ||
# - Media volume (optional) | ||
|
||
- name: Shutdown stack, database, and redis | ||
k8s: | ||
definition: "{{ lookup('template', '{{ item }}.yaml.j2') }}" | ||
state: absent | ||
wait: yes | ||
loop: | ||
- statefulset-stack | ||
- statefulset-worker | ||
- deployment-beat | ||
- statefulset-database | ||
- deployment-redis | ||
|
||
- name: Wait for database to disappear | ||
k8s_info: | ||
kind: Pod | ||
name: database-0 | ||
namespace: "{{ stack_namespace }}" | ||
register: db_result | ||
until: db_result.resources|length == 0 | ||
delay: 5 | ||
retries: "{{ (wait_timeout|int / 5)|int }}" | ||
|
||
- name: Wait for stack to disappear | ||
k8s_info: | ||
kind: Pod | ||
name: stack-0 | ||
namespace: "{{ stack_namespace }}" | ||
register: stack_result | ||
until: stack_result.resources|length == 0 | ||
delay: 5 | ||
retries: "{{ (wait_timeout|int / 5)|int }}" | ||
|
||
- name: Wait for worker to disappear | ||
k8s_info: | ||
kind: Pod | ||
name: worker-0 | ||
namespace: "{{ stack_namespace }}" | ||
register: worker_result | ||
until: worker_result.resources|length == 0 | ||
delay: 5 | ||
retries: "{{ (wait_timeout|int / 5)|int }}" | ||
|
||
- name: Remove database volume | ||
k8s: | ||
definition: "{{ lookup('template', 'pvc-database.yaml.j2') }}" | ||
state: absent | ||
wait: yes | ||
when: stack_shutdown_remove_database_volume|bool | ||
|
||
- name: Remove media volume | ||
k8s: | ||
definition: "{{ lookup('template', 'pvc-media.yaml.j2') }}" | ||
state: absent | ||
wait: yes | ||
when: stack_shutdown_remove_media_volume|bool |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters