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

Fix scopes that were not being passed on to the Google provider #79

Merged
merged 2 commits into from
Nov 17, 2020
Merged
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/drone-autoscaler/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ func setupProvider(c config.Config) (autoscaler.Provider, error) {
google.WithServiceAccountEmail(c.Google.ServiceAccountEmail),
google.WithProject(c.Google.Project),
google.WithTags(c.Google.Tags...),
google.WithScopes(c.Google.Scopes...),
google.WithUserData(c.Google.UserData),
google.WithUserDataFile(c.Google.UserDataFile),
google.WithZone(c.Google.Zone),
Expand Down
1 change: 1 addition & 0 deletions drivers/google/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ func (p *provider) Create(ctx context.Context, opts autoscaler.InstanceCreateOpt
Size: p.size,
Address: address,
ServiceAccountEmail: p.serviceAccountEmail,
Scopes: p.scopes,
}

logger.
Expand Down
3 changes: 2 additions & 1 deletion provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,15 @@ type Provider interface {
// An Instance represents a server instance
// (e.g Digital Ocean Droplet).
type Instance struct {
Provider ProviderType
Provider ProviderType
ID string
Name string
Address string
Region string
Image string
Size string
ServiceAccountEmail string
Scopes []string
}

// InstanceCreateOpts define soptional instructions for
Expand Down
2 changes: 1 addition & 1 deletion server/writer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ func TestWriteJSON(t *testing.T) {
if got, want := w.Body.String(), "{\"hello\":\"world\"}\n"; got != want {
t.Errorf("Want JSON body %q, got %q", want, got)
}
if got, want := w.HeaderMap.Get("Content-Type"), "application/json"; got != want {
if got, want := w.HeaderMap.Get("Content-Type"), "application/json; charset=utf-8"; got != want {
t.Errorf("Want Content-Type %q, got %q", want, got)
}
if got, want := w.Code, http.StatusTeapot; got != want {
Expand Down