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

Arize dev/workload identity fix #7

Merged
merged 6 commits into from
Apr 25, 2024
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
11 changes: 6 additions & 5 deletions broker/fragment/store_gcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ func (s *gcsBackend) Provider() string {
}

func (s *gcsBackend) SignGet(ep *url.URL, fragment pb.Fragment, d time.Duration) (string, error) {
cfg, _, opts, err := s.gcsClient(ep)
cfg, client, opts, err := s.gcsClient(ep)
if err != nil {
return "", err
}
opts.Method = "GET"
opts.Expires = time.Now().Add(d)

return storage.SignedURL(cfg.bucket, cfg.rewritePath(cfg.prefix, fragment.ContentPath()), &opts)
return client.Bucket(cfg.bucket).SignedURL(cfg.rewritePath(cfg.prefix, fragment.ContentPath()), &opts)
}

func (s *gcsBackend) Exists(ctx context.Context, ep *url.URL, fragment pb.Fragment) (exists bool, err error) {
Expand Down Expand Up @@ -184,9 +184,10 @@ func (s *gcsBackend) gcsClient(ep *url.URL) (cfg GSStoreConfig, client *storage.
return
}

s.client = client

// Note: SignGet() also works with empty signedURLOptions.
// workload identity approach which SignGet() method accepts if you have
// "iam.serviceAccounts.signBlob" permissions against your service account.
opts = storage.SignedURLOptions{}
s.client, s.signedURLOptions = client, opts

log.WithFields(log.Fields{
"ProjectID": creds.ProjectID,
Expand Down
Loading