-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Description Based on the condition in `src/cmd/tools/wait.go`, conditionally decide betweb a jsonpath or conditon waitType. ## Related Issue Fixes #1872 <!-- or --> Relates to # ## Type of change - [ ] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [ ] Other (security config, docs update, etc) ## Checklist before merging - [x] Test, docs, adr added or updated as needed - [x] [Contributor Guide Steps](https://github.com/defenseunicorns/zarf/blob/main/CONTRIBUTING.md#developer-workflow) followed ```bash ┌─[cmwylie19@Cases-MacBook-Pro] - [~/zarf] - [2023-07-01 10:26:32] └─[0] <git:(1872 8bf6606) > kubectl create -f -<<EOF apiVersion: apps/v1 kind: StatefulSet metadata: creationTimestamp: null labels: app: test-sts name: test-sts spec: replicas: 23 selector: matchLabels: app: test-sts template: metadata: creationTimestamp: null labels: app: test-sts spec: containers: - image: nginx name: nginx resources: {} status: {} EOF ./build/zarf-mac-apple tools wait-for sts test-sts '{.status.availableReplicas}'=23 statefulset.apps/test-sts created ✔ Waiting for sts/test-sts to be {.status.availableReplicas}=23. ┌─[cmwylie19@Cases-MacBook-Pro] - [~/zarf] - [2023-07-01 10:27:11] └─[0] <git:(1872 8bf6606) > k get sts NAME READY AGE test-sts 23/23 39s ``` Opens possibility for more complex waits: ```bash # --for=jsonpath='{}'=value # Wait for the pod "busybox1" to contain the status phase to be "Running". kubectl wait --for=jsonpath=“{.status.availableReplicas}”=2 sts/test-sts kubectl wait --for=jsonpath='{.status.phase}'=Running po/busybox1 kubectl wait --for=jsonpath='{.status.containerStatuses[0].ready}'=true po/busybox1 kubectl wait --for=jsonpath='{.spec.containers[0].ports[0].containerPort}'=80 po/busybox1 kubectl wait --for=jsonpath='{.spec.nodeName}'=knode0 po/busybox1 ``` --------- Signed-off-by: Case Wylie <[email protected]>
- Loading branch information
Showing
10 changed files
with
258 additions
and
162 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.