Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create GCP auth pull secret even if creds JSON is nil #12461

Merged
merged 1 commit into from
Sep 14, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion pkg/addons/addons_gcpauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func enableAddonGCPAuth(cfg *config.ClusterConfig) error {
// Grab credentials from where GCP would normally look
ctx := context.Background()
creds, err := google.FindDefaultCredentials(ctx)
if err != nil || creds.JSON == nil {
if err != nil {
if detect.IsCloudShell() {
if c := os.Getenv("CLOUDSDK_CONFIG"); c != "" {
f, err := ioutil.ReadFile(path.Join(c, "application_default_credentials.json"))
Expand All @@ -98,6 +98,11 @@ func enableAddonGCPAuth(cfg *config.ClusterConfig) error {
return nil
}

if creds.JSON == nil {
out.WarningT("You have authenicated with a service account that does not have an associated JSON. The GCP Auth requires credentials with a JSON file to in order to continue. The image pull secret has been imported.")
return nil
}

// Actually copy the creds over
f := assets.NewMemoryAssetTarget(creds.JSON, credentialsPath, "0444")

Expand Down