Add the namespace in wait-for-pods role
Specify the namespace for waiting, so no need to change the context Change-Id: I4b961bdc8c740e20d6b72200f0161d2f5c5c2c19
This commit is contained in:
parent
7a5c335cc6
commit
4b390f2d40
@ -1,4 +1,9 @@
|
||||
Wait for all pods to become Ready
|
||||
|
||||
This role scans the current namespace for all pods and ensures that all of
|
||||
them are in a Ready state.
|
||||
them are in a Ready state.
|
||||
|
||||
.. zuul:rolevar:: wait_for_pods_namespace
|
||||
|
||||
Name of the specified namespace. If not specified explicitly,
|
||||
then use the namespace in the current context.
|
@ -6,11 +6,11 @@
|
||||
- name: Wait for all StatefulSets to become ready
|
||||
block:
|
||||
- name: Retrieve all StatefulSets
|
||||
command: kubectl get statefulset -o name
|
||||
command: kubectl get statefulset {% if wait_for_pods_namespace is defined %}-n {{ wait_for_pods_namespace }}{% endif %} -o name
|
||||
register: _statefulsets
|
||||
|
||||
- name: Ensure the number of ready replicas matches the replicas
|
||||
shell: kubectl get {{ zj_sts_item }} -ogo-template='{{ '{{' }}eq .status.replicas .status.readyReplicas{{ '}}' }}'
|
||||
shell: kubectl get {{ zj_sts_item }} {% if wait_for_pods_namespace is defined %}-n {{ wait_for_pods_namespace }}{% endif %} -ogo-template='{{ '{{' }}eq .status.replicas .status.readyReplicas{{ '}}' }}'
|
||||
register: _is_ready
|
||||
until: _is_ready.stdout == 'true'
|
||||
retries: 60
|
||||
@ -23,11 +23,11 @@
|
||||
- name: Wait for all DaemonSets to become ready
|
||||
block:
|
||||
- name: Retrieve all DaemonSets
|
||||
command: kubectl get daemonset -o name
|
||||
command: kubectl get daemonset {% if wait_for_pods_namespace is defined %}-n {{ wait_for_pods_namespace }}{% endif %} -o name
|
||||
register: _daemonsets
|
||||
|
||||
- name: Ensure the ready number matches the scheduled number
|
||||
shell: kubectl get {{ zj_ds_item }} -ogo-template='{{ '{{' }}eq .status.currentNumberScheduled .status.numberReady{{ '}}' }}'
|
||||
shell: kubectl get {{ zj_ds_item }} {% if wait_for_pods_namespace is defined %}-n {{ wait_for_pods_namespace }}{% endif %} -ogo-template='{{ '{{' }}eq .status.currentNumberScheduled .status.numberReady{{ '}}' }}'
|
||||
register: _is_ready
|
||||
until: _is_ready.stdout == 'true'
|
||||
retries: 60
|
||||
@ -37,4 +37,4 @@
|
||||
loop_var: zj_ds_item
|
||||
|
||||
- name: Wait for all pods to become ready
|
||||
command: kubectl wait --for=condition=Ready --timeout=120s pod --all
|
||||
command: kubectl wait {% if wait_for_pods_namespace is defined %}-n {{ wait_for_pods_namespace }}{% endif %} --for=condition=Ready --timeout=120s pod --all
|
||||
|
Loading…
x
Reference in New Issue
Block a user