Skip to content

Commit

Permalink
sTry to correct go-critics
Browse files Browse the repository at this point in the history
  • Loading branch information
Jose Maria Alvarez committed Oct 29, 2021
1 parent ada208c commit f0f9fb3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
9 changes: 5 additions & 4 deletions pkg/scalers/gcp_pub_sub_scaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,13 @@ func getGcpAuthorization(config *ScalerConfig, resolvedEnv map[string]string) (*
meta.podIdentityOwner = false
} else if metadata["identityOwner"] == "" || metadata["identityOwner"] == "pod" {
meta.podIdentityOwner = true
if config.PodIdentity == kedav1alpha1.PodIdentityProviderGCP {
//do nothing, rely on underneath metadata google
switch {
case config.PodIdentity == kedav1alpha1.PodIdentityProviderGCP:
// do nothing, rely on underneath metadata google
meta.podIdentityProviderEnabled = true
} else if authParams["GoogleApplicationCredentials"] != "" {
case authParams["GoogleApplicationCredentials"] != "":
meta.GoogleApplicationCredentials = authParams["GoogleApplicationCredentials"]
} else {
default:
if metadata["credentialsFromEnv"] != "" {
meta.GoogleApplicationCredentials = resolvedEnv[metadata["credentialsFromEnv"]]
} else {
Expand Down
8 changes: 4 additions & 4 deletions pkg/scalers/stackdriver_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
type StackDriverClient struct {
metricsClient *monitoring.MetricClient
credentials GoogleApplicationCredentials
projectId string
projectID string
}

// NewStackDriverClient creates a new stackdriver client with the credentials that are passed
Expand Down Expand Up @@ -57,7 +57,7 @@ func NewStackDriverClientPodIdentity(ctx context.Context) (*StackDriverClient, e
}
return &StackDriverClient{
metricsClient: client,
projectId: project,
projectID: project,
}, nil
}

Expand All @@ -71,9 +71,9 @@ func (s StackDriverClient) GetMetrics(ctx context.Context, filter string) (int64

// Create a request with the filter and the GCP project ID
var req *monitoringpb.ListTimeSeriesRequest
if len(s.projectId) > 0 {
if len(s.projectID) > 0 {
req = &monitoringpb.ListTimeSeriesRequest{
Name: "projects/" + s.projectId,
Name: "projects/" + s.projectID,
Filter: filter,
Interval: &monitoringpb.TimeInterval{
StartTime: &timestamp.Timestamp{
Expand Down

0 comments on commit f0f9fb3

Please sign in to comment.