Commit 10b271c6 authored by k8s-merge-robot's avatar k8s-merge-robot

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.
parents 1e442128 f79998a9
...@@ -236,13 +236,15 @@ Find more information at https://github.com/kubernetes/kubernetes.`, ...@@ -236,13 +236,15 @@ Find more information at https://github.com/kubernetes/kubernetes.`,
cmds.AddCommand(NewCmdExplain(f, out)) cmds.AddCommand(NewCmdExplain(f, out))
cmds.AddCommand(NewCmdConvert(f, out)) cmds.AddCommand(NewCmdConvert(f, out))
if cmds.Flag("namespace").Annotations == nil { if cmds.Flag("namespace") != nil {
cmds.Flag("namespace").Annotations = map[string][]string{} 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 return cmds
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment