Skip to content

Commit 6b3b8ac

Browse files
Merge pull request openshift#8002 from r4f4/gcp-sa-cli-creds-fix
OCPBUGS-28590: gcp: better error msg when service accnt missing
2 parents 73b5742 + 20c0d00 commit 6b3b8ac

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

pkg/asset/machines/gcp/machines.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,12 @@ func provider(clusterID string, platform *gcp.Platform, mpool *gcp.MachinePool,
168168
return nil, err
169169
}
170170

171+
// The JSON can be `nil` if auth is provided from env
172+
// https://pkg.go.dev/golang.org/x/[email protected]/google#Credentials
173+
if len(sess.Credentials.JSON) == 0 {
174+
return nil, fmt.Errorf("could not extract service account from loaded credentials. Please specify a service account to be used for shared vpc installations in the install-config.yaml")
175+
}
176+
171177
var found bool
172178
serviceAccount := make(map[string]interface{})
173179
err = json.Unmarshal(sess.Credentials.JSON, &serviceAccount)

0 commit comments

Comments
 (0)