Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
46 changes: 21 additions & 25 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ require (
github.com/openshift/client-go v0.0.0-20260108185524-48f4ccfc4e13
github.com/openshift/library-go v0.0.0-20260209094534-b6adacbfccda
github.com/pkg/errors v0.9.1
google.golang.org/api v0.179.0
golang.org/x/oauth2 v0.36.0
google.golang.org/api v0.288.0
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.35.0
k8s.io/apimachinery v0.35.0
Expand All @@ -30,12 +31,12 @@ require (
sigs.k8s.io/controller-runtime v0.23.1
)

require go.opentelemetry.io/auto/sdk v1.1.0 // indirect
require go.opentelemetry.io/auto/sdk v1.2.1 // indirect

require (
cloud.google.com/go/auth v0.4.1 // indirect
cloud.google.com/go/auth/oauth2adapt v0.2.2 // indirect
cloud.google.com/go/compute/metadata v0.6.0 // indirect
cloud.google.com/go/auth v0.20.0 // indirect
cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect
cloud.google.com/go/compute/metadata v0.9.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.10.0 // indirect
github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/azsecrets v1.3.1 // indirect
github.com/Azure/azure-sdk-for-go/sdk/security/keyvault/internal v1.1.1 // indirect
Expand Down Expand Up @@ -75,13 +76,11 @@ require (
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.5.2 // indirect
github.com/golang-jwt/jwt/v5 v5.3.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/google/gnostic-models v0.7.1 // indirect
github.com/google/go-cmp v0.7.0 // indirect
github.com/google/s2a-go v0.1.7 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
github.com/googleapis/gax-go/v2 v2.12.4 // indirect
github.com/google/s2a-go v0.1.9 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.17 // indirect
github.com/googleapis/gax-go/v2 v2.22.0 // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/jmespath/go-jmespath v0.4.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
Expand All @@ -100,24 +99,21 @@ require (
github.com/robfig/cron v1.2.0 // indirect
github.com/spf13/pflag v1.0.10 // indirect
github.com/x448/float16 v0.8.4 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.61.0 // indirect
go.opentelemetry.io/otel v1.36.0 // indirect
go.opentelemetry.io/otel/metric v1.36.0 // indirect
go.opentelemetry.io/otel/trace v1.36.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.67.0 // indirect
go.opentelemetry.io/otel v1.43.0 // indirect
go.opentelemetry.io/otel/metric v1.43.0 // indirect
go.opentelemetry.io/otel/trace v1.43.0 // indirect
go.yaml.in/yaml/v2 v2.4.3 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/crypto v0.48.0 // indirect
golang.org/x/crypto v0.53.0 // indirect
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect
golang.org/x/net v0.50.0 // indirect
golang.org/x/oauth2 v0.35.0 // indirect
golang.org/x/sys v0.41.0 // indirect
golang.org/x/term v0.40.0 // indirect
golang.org/x/text v0.34.0 // indirect
golang.org/x/time v0.14.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20250528174236-200df99c418a // indirect
google.golang.org/grpc v1.72.2 // indirect
golang.org/x/net v0.56.0 // indirect
golang.org/x/sys v0.46.0 // indirect
golang.org/x/term v0.44.0 // indirect
golang.org/x/text v0.38.0 // indirect
golang.org/x/time v0.15.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260630182238-925bb5da69e7 // indirect
google.golang.org/grpc v1.82.0 // indirect
google.golang.org/protobuf v1.36.11 // indirect
gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
Expand Down
172 changes: 58 additions & 114 deletions go.sum

Large diffs are not rendered by default.

22 changes: 21 additions & 1 deletion pkg/cloudprovider/gcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"strings"
"sync"

goauth "golang.org/x/oauth2/google"
google "google.golang.org/api/compute/v1"
"google.golang.org/api/option"
corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -52,8 +53,27 @@ func (g *GCP) initCredentials() (err error) {
return err
}

// Parse the credential type to allow restricting which credential types are
// accepted from external sources. In this case, there are no restrictions
// so we simply pass the type through.
var f struct {
Type string `json:"type"`
}
if err := json.Unmarshal(credentialsJSON, &f); err != nil {
return fmt.Errorf("error: cannot parse credentials JSON type: %w", err)
}

creds, err := goauth.CredentialsFromJSONWithType(g.ctx, credentialsJSON, goauth.CredentialsType(f.Type), google.CloudPlatformScope)
if err != nil {
return fmt.Errorf("error: cannot parse credentials JSON: %w", err)
}
ud, err := creds.GetUniverseDomain()
if err != nil {
return fmt.Errorf("error: cannot get universe domain from credentials: %w", err)
Comment thread
patrickdillon marked this conversation as resolved.
}
opts := []option.ClientOption{
option.WithCredentialsJSON(credentialsJSON),
option.WithAuthCredentialsJSON(option.CredentialsType(f.Type), credentialsJSON),
Comment thread
patrickdillon marked this conversation as resolved.
option.WithUniverseDomain(ud),
Comment thread
coderabbitai[bot] marked this conversation as resolved.
option.WithUserAgent(UserAgent),
}
if g.cfg.APIOverride != "" {
Expand Down
Loading