Add support for --container flag (#9703)
Add support for --container flag, which sets an explicit container name for exec operations. Defaults to `controller`. Signed-off-by: Jacob Henner <code@ventricle.us>
This commit is contained in:
parent
97a1a6d616
commit
ae989d7722
10 changed files with 47 additions and 31 deletions
|
|
@ -31,8 +31,8 @@ import (
|
|||
|
||||
// PodExecString takes a pod and a command, uses kubectl exec to run the command in the pod
|
||||
// and returns stdout as a string
|
||||
func PodExecString(flags *genericclioptions.ConfigFlags, pod *apiv1.Pod, args []string) (string, error) {
|
||||
args = append([]string{"exec", "-n", pod.Namespace, pod.Name}, args...)
|
||||
func PodExecString(flags *genericclioptions.ConfigFlags, pod *apiv1.Pod, container string, args []string) (string, error) {
|
||||
args = append([]string{"exec", "-n", pod.Namespace, "-c", container, pod.Name}, args...)
|
||||
return ExecToString(flags, args)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue