Skip to content

Commit 40cc893

Browse files
Merge pull request #163 from mathewpeterson/patch-1
fix: Removes GKE CA Data when using DNS Endpoint
2 parents f67fe41 + bdd6809 commit 40cc893

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

pkg/store/kubeconfig_store_gke.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,12 +306,18 @@ func (s *GKEStore) GetKubeconfigForPath(path string, _ map[string]string) ([]byt
306306
}
307307

308308
var endpoint string
309+
var certificate string
310+
311+
certificate = cluster.MasterAuth.ClusterCaCertificate
312+
309313
if s.Config.PreferredEndpoint == nil {
310314
endpoint = cluster.Endpoint
311315
} else {
312316
switch *s.Config.PreferredEndpoint {
313317
case types.GkeDnsEndpoint:
314318
endpoint = cluster.ControlPlaneEndpointsConfig.DnsEndpointConfig.Endpoint
319+
// DNS Endpoint certificate is not signed this Certificate Authority
320+
certificate = ""
315321
case types.GkePrivateEndpoint:
316322
endpoint = cluster.ControlPlaneEndpointsConfig.IpEndpointsConfig.PrivateEndpoint
317323
case types.GkePublicEndpoint:
@@ -329,7 +335,7 @@ func (s *GKEStore) GetKubeconfigForPath(path string, _ map[string]string) ([]byt
329335
Clusters: []types.KubeCluster{{
330336
Name: contextName,
331337
Cluster: types.Cluster{
332-
CertificateAuthorityData: cluster.MasterAuth.ClusterCaCertificate,
338+
CertificateAuthorityData: certificate,
333339
Server: fmt.Sprintf("https://%s", endpoint),
334340
},
335341
}},

0 commit comments

Comments
 (0)