Fix config clusters index in CurrentContextCluster()
Config.Clusters should be indexed only by "simple" cluster names (without _ephemeral or _target postfixes). This fixes an index that indexed by the "full" cluster name defined in the kubeconfig, in some cases resulting in a nil pointer dereference. Change-Id: Ic7a4b46419354d5755ccea58ff73c5fbbc4d9658
This commit is contained in:
parent
e2297e429d
commit
d0ca82d624
@ -568,8 +568,10 @@ func (c *Config) CurrentContextCluster() (*Cluster, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
clusterName := NewClusterComplexName()
|
||||||
|
clusterName.FromName(currentContext.KubeContext().Cluster)
|
||||||
|
|
||||||
return c.Clusters[currentContext.KubeContext().Cluster].ClusterTypes[currentContext.ClusterType()], nil
|
return c.Clusters[clusterName.ClusterName()].ClusterTypes[currentContext.ClusterType()], nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Config) CurrentContextAuthInfo() (*AuthInfo, error) {
|
func (c *Config) CurrentContextAuthInfo() (*AuthInfo, error) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user