Wait for a Kubernetes condition
Pause the workflow until a resource reaches a condition such as Ready or Available, and fail the step if the timeout runs out first.
Install v1.0.0
Installs the template into your Argo namespace. The URL is pinned to this version.
kubectl apply -n argo -f https://catalog.dagweave.com/api/v1/items/kubectl-wait-condition/1.0.0/template.yaml
Or with the Argo CLI:
argo template create -n argo https://catalog.dagweave.com/api/v1/items/kubectl-wait-condition/1.0.0/template.yaml
Facts
- Category
- Kubernetes
- Tags
- kubectl kubernetes
- Entrypoint
wait- Template SHA-256
d2b72f1e5051e090513aff8cba47bb69d55ca62c2f7bc91b1359cc9b203d540b- Source
- kubectl-wait-condition at catalog commit 67458f7
- API
- item document, latest template.yaml
Images and provenance
Every image is pinned by digest, so a rebuilt tag can never change what this version runs.
| Repository | Tag | Digest |
|---|---|---|
cgr.dev/chainguard/kubectl | latest-dev | sha256:98f9c337808ecf5d5e80b79af4345762a3d8c803ebf8c857d2dddabf885107ba |
Parameters
| Name | Description | Default |
|---|---|---|
resource required |
What to wait on: kind/name, or just a kind when a label selector picks the objects. Example deployment/checkout-api |
none |
condition |
What to wait for, in kubectl wait --for form. Example condition=Available |
condition=Ready |
namespace |
Namespace the resource lives in. Example default |
default |
selector |
Label selector that picks the objects when resource is only a kind. Leave blank to wait on one named object. Example app=checkout-api |
empty |
timeout |
Longest time to wait, such as 300s or 5m. | 300s |
WorkflowTemplate
apiVersion: argoproj.io/v1alpha1
kind: WorkflowTemplate
metadata:
name: kubectl-wait-condition
labels:
dagweave.io/catalog-item: kubectl-wait-condition
annotations:
dagweave.io/catalog-version: "1.0.0"
dagweave.io/catalog-category: "Kubernetes"
spec:
entrypoint: wait
templates:
- name: wait
metadata:
annotations:
dagweave.io/local-support: unsupported
dagweave.io/local-support-reason: >-
This step runs kubectl with whatever identity the pod is given. On Dagweave
Local that is the default service account of the hidden cluster's argo
namespace, which Argo's quick-start install grants create, get and patch on pods
and create and get on workflows, and nothing anywhere else. Waiting means
reading the resource, and that account cannot read anything outside pods and
workflows, so the step fails on a 403 rather than touching anything. The cluster
you meant is one this run cannot reach.
inputs:
parameters:
- name: resource
- name: namespace
default: "default"
- name: condition
default: "condition=Ready"
- name: selector
default: ""
- name: timeout
default: "300s"
retryStrategy:
limit: "2"
retryPolicy: OnError
backoff:
duration: 10s
factor: "2"
maxDuration: 2m
container:
# cgr.dev/chainguard/kubectl:latest-dev
image: cgr.dev/chainguard/kubectl@sha256:98f9c337808ecf5d5e80b79af4345762a3d8c803ebf8c857d2dddabf885107ba
command: [sh, -c]
args:
- |
set -eu
if [ -n "${SELECTOR}" ]; then
kubectl wait "${RESOURCE}" -n "${NAMESPACE}" -l "${SELECTOR}" --for="${CONDITION}" --timeout="${TIMEOUT}"
else
kubectl wait "${RESOURCE}" -n "${NAMESPACE}" --for="${CONDITION}" --timeout="${TIMEOUT}"
fi
env:
- name: RESOURCE
value: "{{inputs.parameters.resource}}"
- name: NAMESPACE
value: "{{inputs.parameters.namespace}}"
- name: CONDITION
value: "{{inputs.parameters.condition}}"
- name: SELECTOR
value: "{{inputs.parameters.selector}}"
- name: TIMEOUT
value: "{{inputs.parameters.timeout}}"
resources:
requests:
cpu: 50m
memory: 64Mi
limits:
memory: 256Mi
Version history
Read from the item's changelog. Each version has its own JSON document; the pinned catalogue vendors the manifest of the latest one, so that is the version that installs.
-
1.0.0 latest 2026-10-18
Initial release.
kubectl apply -n argo -f https://catalog.dagweave.com/api/v1/items/kubectl-wait-condition/1.0.0/template.yamlargo template create -n argo https://catalog.dagweave.com/api/v1/items/kubectl-wait-condition/1.0.0/template.yaml
Run it once
After installing, from the command line.
argo submit -n argo --from workflowtemplate/kubectl-wait-condition \
-p resource=deployment/checkout-api
Workflow that references it
A Workflow with the required parameters filled from the examples.
apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
generateName: kubectl-wait-condition-
spec:
workflowTemplateRef:
name: kubectl-wait-condition
arguments:
parameters:
- name: resource
value: "deployment/checkout-api"
As a step of a larger workflow
steps:
- - name: kubectl-wait-condition
templateRef:
name: kubectl-wait-condition
template: wait