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,6 +31,7 @@ import (
|
|||
const (
|
||||
DefaultIngressDeploymentName = "ingress-nginx-controller"
|
||||
DefaultIngressServiceName = "ingress-nginx-controller"
|
||||
DefaultIngressContainerName = "controller"
|
||||
)
|
||||
|
||||
// IssuePrefix is the github url that we can append an issue number to to link to it
|
||||
|
|
@ -127,6 +128,13 @@ func AddSelectorFlag(cmd *cobra.Command) *string {
|
|||
return &v
|
||||
}
|
||||
|
||||
// AddContainerFlag adds a --container flag to a cobra command
|
||||
func AddContainerFlag(cmd *cobra.Command) *string {
|
||||
v := ""
|
||||
cmd.Flags().StringVar(&v, "container", DefaultIngressContainerName, "The name of the ingress-nginx controller container")
|
||||
return &v
|
||||
}
|
||||
|
||||
// GetNamespace takes a set of kubectl flag values and returns the namespace we should be operating in
|
||||
func GetNamespace(flags *genericclioptions.ConfigFlags) string {
|
||||
namespace, _, err := flags.ToRawKubeConfigLoader().Namespace()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue