Skip to content

Commit

Permalink
Ensure that web and task deployments scale down for upgrades (#1522)
Browse files Browse the repository at this point in the history
  • Loading branch information
rooftopcellist authored Sep 6, 2023
1 parent 3df6133 commit 8d91a67
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions roles/installer/tasks/scale_down_deployment.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
---

- name: Check for presence of Deployment
k8s_info:
api_version: apps/v1
kind: Deployment
name: "{{ ansible_operator_meta.name }}"
namespace: "{{ ansible_operator_meta.namespace }}"
register: this_deployment
label_selectors:
- 'app.kubernetes.io/part-of={{ ansible_operator_meta.name }}'
- 'app.kubernetes.io/managed-by={{ deployment_type }}-operator'
- 'app.kubernetes.io/component={{ deployment_type }}'
register: _deployments

- name: Scale down Deployment for migration
kubernetes.core.k8s_scale:
Expand All @@ -16,8 +18,5 @@
namespace: "{{ ansible_operator_meta.namespace }}"
replicas: 0
wait: yes
wait_timeout: "{{ termination_grace_period_seconds | default(120) }}"
loop:
- "{{ ansible_operator_meta.name }}-task"
- "{{ ansible_operator_meta.name }}-web"
when: this_deployment['resources'] | length
loop: "{{ _deployments.resources | map(attribute='metadata.name') | list }}"
when: _deployments.resources | length

0 comments on commit 8d91a67

Please sign in to comment.