diff --git a/pkg/scalers/gcp_pub_sub_scaler.go b/pkg/scalers/gcp_pub_sub_scaler.go index 9896d92c675..5cf94f73398 100644 --- a/pkg/scalers/gcp_pub_sub_scaler.go +++ b/pkg/scalers/gcp_pub_sub_scaler.go @@ -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 { diff --git a/pkg/scalers/stackdriver_client.go b/pkg/scalers/stackdriver_client.go index 2ea8872f8f3..cb72037629f 100644 --- a/pkg/scalers/stackdriver_client.go +++ b/pkg/scalers/stackdriver_client.go @@ -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 @@ -57,7 +57,7 @@ func NewStackDriverClientPodIdentity(ctx context.Context) (*StackDriverClient, e } return &StackDriverClient{ metricsClient: client, - projectId: project, + projectID: project, }, nil } @@ -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: ×tamp.Timestamp{