|
15 | 15 |
|
16 | 16 | set -euo pipefail
|
17 | 17 |
|
| 18 | +rollout_and_wait() { |
| 19 | + echo "Applying config \"$1\"" |
| 20 | + trap "echo \"Failed to apply config \\\"$1\\\"\" >&2" err |
| 21 | + |
| 22 | + APPNAME=$(kubectl apply -f $1 | grep -E "^(:?daemonset|deployment|statefulset|pod)" | awk '{printf $1}') |
| 23 | + if [[ -n $(expr "${APPNAME}" : "\(daemonset\|deployment\|statefulset\)" || true) ]]; then |
| 24 | + kubectl rollout status $APPNAME --watch --timeout=5m |
| 25 | + else |
| 26 | + kubectl wait "${APPNAME}" --for condition=ready --timeout=5m |
| 27 | + fi |
| 28 | +} |
| 29 | + |
18 | 30 | echo "begin to create deployment examples ..."
|
19 | 31 | kubectl apply -f deploy/example/storageclass-blobfuse.yaml
|
20 | 32 | kubectl apply -f deploy/example/storageclass-blob-nfs.yaml
|
21 |
| -kubectl apply -f deploy/example/deployment.yaml |
22 |
| -kubectl apply -f deploy/example/statefulset.yaml |
23 |
| -kubectl apply -f deploy/example/statefulset-nonroot.yaml |
24 |
| -kubectl apply -f deploy/example/deployment-nfs.yaml |
25 |
| -kubectl apply -f deploy/example/statefulset-nfs.yaml |
26 |
| -kubectl apply -f deploy/example/statefulset-nonroot-nfs.yaml |
27 | 33 |
|
28 |
| -echo "sleep 90s ..." |
29 |
| -sleep 90 |
| 34 | +EXAMPLES=(\ |
| 35 | + deploy/example/deployment.yaml \ |
| 36 | + deploy/example/statefulset.yaml \ |
| 37 | + deploy/example/statefulset-nonroot.yaml \ |
| 38 | + deploy/example/deployment-nfs.yaml \ |
| 39 | + deploy/example/statefulset-nfs.yaml \ |
| 40 | + deploy/example/statefulset-nonroot-nfs.yaml \ |
| 41 | +) |
30 | 42 |
|
31 |
| -kubectl get pods --field-selector status.phase=Running | grep deployment-blob |
32 |
| -kubectl get pods --field-selector status.phase=Running | grep statefulset-blob-0 |
33 |
| -kubectl get pods --field-selector status.phase=Running | grep statefulset-blob-nonroot-0 |
34 |
| -kubectl get pods --field-selector status.phase=Running | grep deployment-blob-nfs |
35 |
| -kubectl get pods --field-selector status.phase=Running | grep statefulset-blob-nfs-0 |
36 |
| -kubectl get pods --field-selector status.phase=Running | grep statefulset-blob-nonroot-nfs-0 |
| 43 | +for EXAMPLE in "${EXAMPLES[@]}"; do |
| 44 | + rollout_and_wait $EXAMPLE |
| 45 | +done |
37 | 46 |
|
38 | 47 | echo "deployment examples running completed."
|
0 commit comments