mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-21 01:50:55 +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:
@@ -236,6 +236,7 @@ Find more information at https://github.com/kubernetes/kubernetes.`,
|
||||
cmds.AddCommand(NewCmdExplain(f, out))
|
||||
cmds.AddCommand(NewCmdConvert(f, out))
|
||||
|
||||
if cmds.Flag("namespace") != nil {
|
||||
if cmds.Flag("namespace").Annotations == nil {
|
||||
cmds.Flag("namespace").Annotations = map[string][]string{}
|
||||
}
|
||||
@@ -243,6 +244,7 @@ Find more information at https://github.com/kubernetes/kubernetes.`,
|
||||
cmds.Flag("namespace").Annotations[cobra.BashCompCustom],
|
||||
"__kubectl_get_namespaces",
|
||||
)
|
||||
}
|
||||
|
||||
return cmds
|
||||
}
|
||||
|
Reference in New Issue
Block a user