-
Notifications
You must be signed in to change notification settings - Fork 459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
crictl exec: allow running single command in multiple containers #1603
Conversation
This patch adds the following filter flags to `crictl exec`: ``` --image value Exec command for all containers matching this container image filter --label value [ --label value ] Exec command for all containers matching this key=value label filter --last value, -n value Exec command for all last n containers, set to 0 for unlimited (default: 0) --latest, -l Exec command for the most recently created container (default: false) --name value Exec command for all containers matching this name filter regular expression pattern --pod value, -p value Exec command for all containers matching this pod ID filter --state value Exec command for all containers matching this container state filter ``` If none of the above filters are set, then crictl will assume that the first provided argument is the container ID. If one of them is set, then crictl will filter and execute for all containers: ``` > sudo ./build/bin/linux/amd64/crictl exec --name pod ps aux 8f92b841d898828833d7dc55245e5df91c517cb0fce8a61f5def7cb9e432530c: USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.0 2472 1344 ? Ss 07:09 0:00 /bin/sleep 6000 6000 root 67 0.0 0.0 5536 2700 ? Rs 07:38 0:00 ps aux 39f78a7b1835b8363a519424031ddbb370b743afad46cc401eeb73717c84e57d: USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.0 2472 1500 ? Ss 07:08 0:00 /bin/sleep 6000 6000 root 122 0.0 0.0 5536 2732 ? Rs 07:38 0:00 ps aux ``` The container ID is printed when a filter command has been used to ensure existing backwards compatibility. Signed-off-by: Sascha Grunert <[email protected]>
@kubernetes-sigs/cri-tools-maintainers PTAL |
What use case does this solve? |
Having a set of containers where the same command should be executed in, mostly for debugging and testing purposes. |
An idea: Can we add an option, a command-line switch perhaps, to run whatever command has been given in parallel. This would take care of the use case, replacing the need to have either the An ability to retry and ignore errors would also be nice. |
Sounds like great ideas! Would that work as follow-up on that PR? |
Yeah, sure. |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: kwilczynski, saschagrunert The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
…lags The flags can be used to further manipulate on the exec behavior. Follow-up on: kubernetes-sigs#1603 (comment) Signed-off-by: Sascha Grunert <[email protected]>
…lags The flags can be used to further manipulate on the exec behavior. Follow-up on: kubernetes-sigs#1603 (comment) Signed-off-by: Sascha Grunert <[email protected]>
…lags The flags can be used to further manipulate on the exec behavior. Follow-up on: kubernetes-sigs#1603 (comment) Signed-off-by: Sascha Grunert <[email protected]>
…lags The flags can be used to further manipulate on the exec behavior. Follow-up on: kubernetes-sigs#1603 (comment) Signed-off-by: Sascha Grunert <[email protected]>
…lags The flags can be used to further manipulate on the exec behavior. Follow-up on: kubernetes-sigs#1603 (comment) Signed-off-by: Sascha Grunert <[email protected]>
…lags The flags can be used to further manipulate on the exec behavior. Follow-up on: kubernetes-sigs#1603 (comment) Signed-off-by: Sascha Grunert <[email protected]>
…lags The flags can be used to further manipulate on the exec behavior. Follow-up on: kubernetes-sigs#1603 (comment) Signed-off-by: Sascha Grunert <[email protected]>
What type of PR is this?
/kind feature
What this PR does / why we need it:
This patch adds the following filter flags to
crictl exec
:If none of the above filters are set, then crictl will assume that the first provided argument is the container ID. If one of them is set, then crictl will filter and execute for all containers:
The container ID is printed when a filter command has been used to ensure existing backwards compatibility.
Which issue(s) this PR fixes:
None
Special notes for your reviewer:
None
Does this PR introduce a user-facing change?