
This adds a custom ansible-lint rule at .rules/ZuulJobsNamespaceLoopVar.py that enforces the loop var policy described at: https://zuul-ci.org/docs/zuul-jobs/policy.html#ansible-loops-in-roles It also updates existing roles to follow the policy. Change-Id: I92b2ff56a1c2702542fc07b316f1809087a4c92f
24 lines
1023 B
YAML
24 lines
1023 B
YAML
# NOTE(mnaser): When a StatefulSet is deployed, it creates the pods one
|
|
# by one, which means the `kubectl wait` can race if it
|
|
# is ran before the other pods are created. We instead
|
|
# check for all the StatefulSets here manually instead
|
|
# and then use the second check below to do a "confirmation"
|
|
- name: Wait for all StatefulSets to become ready
|
|
block:
|
|
- name: Retrieve all StatefulSets
|
|
command: kubectl get statefulset -o name
|
|
register: _statefulsets
|
|
|
|
- name: Ensure the number of ready replicas matches the replicas
|
|
shell: kubectl get {{ zj_item }} -ogo-template='{{ '{{' }}eq .status.replicas .status.readyReplicas{{ '}}' }}'
|
|
register: _is_ready
|
|
until: _is_ready.stdout == 'true'
|
|
retries: 60
|
|
delay: 5
|
|
loop: "{{ _statefulsets.stdout_lines }}"
|
|
loop_control:
|
|
loop_var: zj_item
|
|
|
|
- name: Wait for all pods to become ready
|
|
command: kubectl wait --for=condition=Ready --timeout=120s pod --all
|