Check for nil config.Contexts[currentContext]
@@ -128,6 +128,7 @@ func newGenerateClusterPairCommand(cmdFactory Factory, ioStreams genericclioptio
delete(config.Contexts, context)
}
}
+ if config.Contexts[currentContext] != nil {
currentCluster := config.Contexts[currentContext].Cluster
for cluster := range config.Clusters {
if cluster != currentCluster {
@@ -205,6 +206,7 @@ func newGenerateClusterPairCommand(cmdFactory Factory, ioStreams genericclioptio
if err = printEncoded(c, clusterPair, "yaml", ioStreams.Out); err != nil {
util.CheckErr(err)
}
+ }
},
}
