Skip to content

Commit 9ef6222

Browse files
authored
Merge pull request #924 from Shaad7/gcloud-auth
Add gcloud auth in user kubeconfig secret
2 parents db41de4 + f541000 commit 9ef6222

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

cloud/services/container/clusters/kubeconfig.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -108,18 +108,15 @@ func (s *Service) createUserKubeconfigSecret(ctx context.Context, cluster *conta
108108
return fmt.Errorf("creating base kubeconfig: %w", err)
109109
}
110110

111-
authProviderConfig := &api.AuthProviderConfig{
112-
Name: "gcp",
113-
Config: map[string]string{
114-
"cmd-args": "config config-helper --format=json",
115-
"cmd-path": "gcloud",
116-
"expiry-key": "'{.credential.token_expiry}'",
117-
"token-key": "'{.credential.access_token}'",
118-
},
111+
execConfig := &api.ExecConfig{
112+
APIVersion: "client.authentication.k8s.io/v1beta1",
113+
Command: "gke-gcloud-auth-plugin",
114+
InstallHint: "Install gke-gcloud-auth-plugin for use with kubectl by following\n https://cloud.google.com/blog/products/containers-kubernetes/kubectl-auth-changes-in-gke",
115+
ProvideClusterInfo: true,
119116
}
120117
cfg.AuthInfos = map[string]*api.AuthInfo{
121118
contextName: {
122-
AuthProvider: authProviderConfig,
119+
Exec: execConfig,
123120
},
124121
}
125122

0 commit comments

Comments
 (0)