Skip to content

Commit

Permalink
Add an example that demonstrates waiting for a sidecar to become Ready
Browse files Browse the repository at this point in the history
This example includes a sidecar that takes some time after it starts
running to report as Ready, and a step that relies on the behavior of
the sidecar being Ready, not just started.
  • Loading branch information
imjasonh authored and tekton-robot committed Nov 26, 2019
1 parent 124f101 commit 4133559
Showing 1 changed file with 38 additions and 0 deletions.
38 changes: 38 additions & 0 deletions examples/taskruns/sidecar-ready.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
apiVersion: tekton.dev/v1alpha1
kind: TaskRun
metadata:
generateName: sidecar-ready-
spec:
taskSpec:
sidecars:
- name: slow-sidecar
image: ubuntu
command: ['sleep', 'infinity']
# The sidecar takes 5s to report as Ready, even after it starts. If the
# step runs as soon as the sidecar starts, it will fail because
# /shared/ready isn't available yet.
readinessProbe:
exec:
command:
- sh
- -c
- sleep 5 && touch /shared/ready
volumeMounts:
- name: shared
mountPath: /shared

steps:
- name: check-ready
image: ubuntu
# The step will only succeed if the sidecar has written this file, which
# it does 5s after it starts, before it reports Ready.
command: ['cat', '/shared/ready']
volumeMounts:
- name: shared
mountPath: /shared

# Sidecars don't have /workspace mounted by default, so we have to define
# our own shared volume.
volumes:
- name: shared
emptyDir: {}

0 comments on commit 4133559

Please sign in to comment.