Skip to content

Commit 8213789

Browse files
authored
Merge pull request #223 from Baune8D/fix-cred-refresh-scope
Set proper scope when refreshing pull secrets
2 parents b4655b4 + 0a6472e commit 8213789

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

server.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ import (
4343

4444
const gcpAuth = "gcp-auth"
4545

46+
const gcpAuthScope = "https://www.googleapis.com/auth/cloud-platform"
47+
4648
var (
4749
runtimeScheme = runtime.NewScheme()
4850
codecs = serializer.NewCodecFactory(runtimeScheme)
@@ -79,7 +81,7 @@ func watchNamespaces() error {
7981

8082
// grab credentials from where GCP would normally look
8183
ctx := context.Background()
82-
creds, err := google.FindDefaultCredentials(ctx, "https://www.googleapis.com/auth/cloud-platform")
84+
creds, err := google.FindDefaultCredentials(ctx, gcpAuthScope)
8385
if err != nil {
8486
return fmt.Errorf("finding default credentials: %v", err)
8587
}
@@ -170,7 +172,7 @@ func deletePullSecret(clientset *kubernetes.Clientset, ns corev1.Namespace) erro
170172

171173
// refreshAllPullSecrets deletes and recreates image registry pull secrets for all namespaces
172174
func refreshAllPullSecrets() error {
173-
creds, err := google.FindDefaultCredentials(context.Background())
175+
creds, err := google.FindDefaultCredentials(context.Background(), gcpAuthScope)
174176
if err != nil {
175177
return fmt.Errorf("finding default credentials: %v", err)
176178
}

0 commit comments

Comments
 (0)