Commit f79998a9 authored by Michal Fojtik's avatar Michal Fojtik

Fix panic when the namespace flag is not present

parent 952e8302
...@@ -235,6 +235,7 @@ Find more information at https://github.com/kubernetes/kubernetes.`, ...@@ -235,6 +235,7 @@ 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") != nil {
if cmds.Flag("namespace").Annotations == nil { if cmds.Flag("namespace").Annotations == nil {
cmds.Flag("namespace").Annotations = map[string][]string{} cmds.Flag("namespace").Annotations = map[string][]string{}
} }
...@@ -242,6 +243,7 @@ Find more information at https://github.com/kubernetes/kubernetes.`, ...@@ -242,6 +243,7 @@ Find more information at https://github.com/kubernetes/kubernetes.`,
cmds.Flag("namespace").Annotations[cobra.BashCompCustom], cmds.Flag("namespace").Annotations[cobra.BashCompCustom],
"__kubectl_get_namespaces", "__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