mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
Merge pull request #26078 from mfojtik/fix-nil-annnotations
Automatic merge from submit-queue Fix panic when the namespace flag is not present We don't set the namespace in OpenShift, so we need to check if the namespace flag is present.
This commit is contained in:
commit
10b271c6de
@ -236,13 +236,15 @@ Find more information at https://github.com/kubernetes/kubernetes.`,
|
||||
cmds.AddCommand(NewCmdExplain(f, out))
|
||||
cmds.AddCommand(NewCmdConvert(f, out))
|
||||
|
||||
if cmds.Flag("namespace").Annotations == nil {
|
||||
cmds.Flag("namespace").Annotations = map[string][]string{}
|
||||
if cmds.Flag("namespace") != nil {
|
||||
if cmds.Flag("namespace").Annotations == nil {
|
||||
cmds.Flag("namespace").Annotations = map[string][]string{}
|
||||
}
|
||||
cmds.Flag("namespace").Annotations[cobra.BashCompCustom] = append(
|
||||
cmds.Flag("namespace").Annotations[cobra.BashCompCustom],
|
||||
"__kubectl_get_namespaces",
|
||||
)
|
||||
}
|
||||
cmds.Flag("namespace").Annotations[cobra.BashCompCustom] = append(
|
||||
cmds.Flag("namespace").Annotations[cobra.BashCompCustom],
|
||||
"__kubectl_get_namespaces",
|
||||
)
|
||||
|
||||
return cmds
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user