From 40c04eadafff4109f6c70f86a26fc674032cec25 Mon Sep 17 00:00:00 2001 From: Jorge Turrado Date: Sat, 30 Mar 2024 17:32:00 +0100 Subject: [PATCH] Add missing changes Signed-off-by: Jorge Turrado --- pkg/metricsservice/api/metrics.pb.go | 2 +- pkg/metricsservice/api/metrics_grpc.pb.go | 2 +- pkg/scalers/azure/azure_azidentity_chain.go | 8 ++++---- pkg/scalers/azure/azure_data_explorer.go | 2 +- pkg/scalers/azure/azure_eventhub.go | 2 +- .../azure/azure_managed_prometheus_http_round_tripper.go | 2 +- pkg/scalers/azure/azure_storage.go | 4 ++-- pkg/scalers/azure_log_analytics_scaler.go | 2 +- pkg/scalers/azure_monitor_scaler.go | 2 +- pkg/scalers/azure_pipelines_scaler.go | 2 +- pkg/scalers/azure_servicebus_scaler.go | 2 +- pkg/scalers/externalscaler/externalscaler.pb.go | 2 +- pkg/scalers/externalscaler/externalscaler_grpc.pb.go | 2 +- pkg/scalers/liiklus/LiiklusService.pb.go | 2 +- pkg/scalers/liiklus/LiiklusService_grpc.pb.go | 2 +- pkg/scaling/resolver/azure_keyvault_handler.go | 2 +- 16 files changed, 20 insertions(+), 20 deletions(-) diff --git a/pkg/metricsservice/api/metrics.pb.go b/pkg/metricsservice/api/metrics.pb.go index 54ba64df97f..9774770d7dd 100644 --- a/pkg/metricsservice/api/metrics.pb.go +++ b/pkg/metricsservice/api/metrics.pb.go @@ -16,7 +16,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.32.0 -// protoc v4.24.4 +// protoc v4.25.3 // source: metrics.proto package api diff --git a/pkg/metricsservice/api/metrics_grpc.pb.go b/pkg/metricsservice/api/metrics_grpc.pb.go index 935372927f9..79f66b556a3 100644 --- a/pkg/metricsservice/api/metrics_grpc.pb.go +++ b/pkg/metricsservice/api/metrics_grpc.pb.go @@ -16,7 +16,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.24.4 +// - protoc v4.25.3 // source: metrics.proto package api diff --git a/pkg/scalers/azure/azure_azidentity_chain.go b/pkg/scalers/azure/azure_azidentity_chain.go index 0396c235a42..e4c211f1d36 100644 --- a/pkg/scalers/azure/azure_azidentity_chain.go +++ b/pkg/scalers/azure/azure_azidentity_chain.go @@ -10,7 +10,7 @@ import ( "github.com/kedacore/keda/v2/apis/keda/v1alpha1" ) -func NewChainedCredential(logger logr.Logger, identityID, identityTenantID string, podIdentity v1alpha1.PodIdentityProvider) (*azidentity.ChainedTokenCredential, error) { +func NewChainedCredential(logger logr.Logger, podIdentity v1alpha1.AuthPodIdentity) (*azidentity.ChainedTokenCredential, error) { var creds []azcore.TokenCredential // Used for local debug based on az-cli user @@ -31,10 +31,10 @@ func NewChainedCredential(logger logr.Logger, identityID, identityTenantID strin // with 2 different permissions. They could set workload-identity with the identity A, but KEDA would use // aad-pod-identity with the identity B. If both identities are differents or have different permissions, this blocks // workload identity - switch podIdentity { + switch podIdentity.Provider { case v1alpha1.PodIdentityProviderAzure: // Used for aad-pod-identity - msiCred, err := ManagedIdentityWrapperCredential(identityID) + msiCred, err := ManagedIdentityWrapperCredential(podIdentity.GetIdentityID()) if err != nil { logger.Error(err, "error starting aad-pod-identity token provider") } else { @@ -42,7 +42,7 @@ func NewChainedCredential(logger logr.Logger, identityID, identityTenantID strin creds = append(creds, msiCred) } case v1alpha1.PodIdentityProviderAzureWorkload: - wiCred, err := NewADWorkloadIdentityCredential(identityID, identityTenantID) + wiCred, err := NewADWorkloadIdentityCredential(podIdentity.GetIdentityID(), podIdentity.GetIdentityTenantID()) if err != nil { logger.Error(err, "error starting azure workload-identity token provider") } else { diff --git a/pkg/scalers/azure/azure_data_explorer.go b/pkg/scalers/azure/azure_data_explorer.go index db5e1295213..8c9b67f4dba 100644 --- a/pkg/scalers/azure/azure_data_explorer.go +++ b/pkg/scalers/azure/azure_data_explorer.go @@ -91,7 +91,7 @@ func getDataExplorerAuthConfig(metadata *DataExplorerMetadata) (*kusto.Connectio case kedav1alpha1.PodIdentityProviderAzure, kedav1alpha1.PodIdentityProviderAzureWorkload: azureDataExplorerLogger.V(1).Info(fmt.Sprintf("Creating Azure Data Explorer Client using podIdentity %s", metadata.PodIdentity.Provider)) - creds, chainedErr := NewChainedCredential(azureDataExplorerLogger, metadata.PodIdentity.GetIdentityID(), metadata.PodIdentity.GetIdentityTenantID(), metadata.PodIdentity.Provider) + creds, chainedErr := NewChainedCredential(azureDataExplorerLogger, metadata.PodIdentity) if chainedErr != nil { return nil, chainedErr } diff --git a/pkg/scalers/azure/azure_eventhub.go b/pkg/scalers/azure/azure_eventhub.go index ec2e0d8d63f..ad3d17449cf 100644 --- a/pkg/scalers/azure/azure_eventhub.go +++ b/pkg/scalers/azure/azure_eventhub.go @@ -39,7 +39,7 @@ func GetEventHubClient(info EventHubInfo, logger logr.Logger) (*azeventhubs.Prod } return hub, nil case kedav1alpha1.PodIdentityProviderAzure, kedav1alpha1.PodIdentityProviderAzureWorkload: - creds, chainedErr := NewChainedCredential(logger, info.PodIdentity.GetIdentityID(), info.PodIdentity.Provider) + creds, chainedErr := NewChainedCredential(logger, info.PodIdentity) if chainedErr != nil { return nil, chainedErr } diff --git a/pkg/scalers/azure/azure_managed_prometheus_http_round_tripper.go b/pkg/scalers/azure/azure_managed_prometheus_http_round_tripper.go index 6eea5ebce5c..70a884605ad 100644 --- a/pkg/scalers/azure/azure_managed_prometheus_http_round_tripper.go +++ b/pkg/scalers/azure/azure_managed_prometheus_http_round_tripper.go @@ -40,7 +40,7 @@ func TryAndGetAzureManagedPrometheusHTTPRoundTripper(logger logr.Logger, podIden return nil, fmt.Errorf("trigger metadata cannot be nil") } - chainedCred, err := NewChainedCredential(logger, podIdentity.GetIdentityID(), podIdentity.GetIdentityTenantID(), podIdentity.Provider) + chainedCred, err := NewChainedCredential(logger, podIdentity) if err != nil { return nil, err } diff --git a/pkg/scalers/azure/azure_storage.go b/pkg/scalers/azure/azure_storage.go index a744a39a0e6..47f144516e6 100644 --- a/pkg/scalers/azure/azure_storage.go +++ b/pkg/scalers/azure/azure_storage.go @@ -98,7 +98,7 @@ func GetStorageBlobClient(logger logr.Logger, podIdentity kedav1alpha1.AuthPodId } return blobClient, nil case kedav1alpha1.PodIdentityProviderAzure, kedav1alpha1.PodIdentityProviderAzureWorkload: - creds, chainedErr := NewChainedCredential(logger, podIdentity.GetIdentityID(), podIdentity.Provider) + creds, chainedErr := NewChainedCredential(logger, podIdentity) if chainedErr != nil { return nil, chainedErr } @@ -125,7 +125,7 @@ func GetStorageQueueClient(logger logr.Logger, podIdentity kedav1alpha1.AuthPodI } return queueClient, nil case kedav1alpha1.PodIdentityProviderAzure, kedav1alpha1.PodIdentityProviderAzureWorkload: - creds, chainedErr := NewChainedCredential(logger, podIdentity.GetIdentityID(), podIdentity.Provider) + creds, chainedErr := NewChainedCredential(logger, podIdentity) if chainedErr != nil { return nil, chainedErr } diff --git a/pkg/scalers/azure_log_analytics_scaler.go b/pkg/scalers/azure_log_analytics_scaler.go index a354dace74a..b44cabaf430 100644 --- a/pkg/scalers/azure_log_analytics_scaler.go +++ b/pkg/scalers/azure_log_analytics_scaler.go @@ -96,7 +96,7 @@ func CreateAzureLogsClient(config *scalersconfig.ScalerConfig, meta *azureLogAna case "", kedav1alpha1.PodIdentityProviderNone: creds, err = azidentity.NewClientSecretCredential(meta.tenantID, meta.clientID, meta.clientSecret, nil) case kedav1alpha1.PodIdentityProviderAzure, kedav1alpha1.PodIdentityProviderAzureWorkload: - creds, err = azure.NewChainedCredential(logger, config.PodIdentity.GetIdentityID(), config.PodIdentity.Provider) + creds, err = azure.NewChainedCredential(logger, config.PodIdentity) default: return nil, fmt.Errorf("azure monitor does not support pod identity provider - %s", config.PodIdentity.Provider) } diff --git a/pkg/scalers/azure_monitor_scaler.go b/pkg/scalers/azure_monitor_scaler.go index c43615dc522..1baba373b6b 100644 --- a/pkg/scalers/azure_monitor_scaler.go +++ b/pkg/scalers/azure_monitor_scaler.go @@ -121,7 +121,7 @@ func CreateAzureMetricsClient(config *scalersconfig.ScalerConfig, meta *azureMon case "", kedav1alpha1.PodIdentityProviderNone: creds, err = azidentity.NewClientSecretCredential(meta.azureMonitorInfo.TenantID, meta.azureMonitorInfo.ClientID, meta.azureMonitorInfo.ClientPassword, nil) case kedav1alpha1.PodIdentityProviderAzure, kedav1alpha1.PodIdentityProviderAzureWorkload: - creds, err = azure.NewChainedCredential(logger, config.PodIdentity.GetIdentityID(), config.PodIdentity.Provider) + creds, err = azure.NewChainedCredential(logger, config.PodIdentity) default: return nil, fmt.Errorf("azure monitor does not support pod identity provider - %s", config.PodIdentity.Provider) } diff --git a/pkg/scalers/azure_pipelines_scaler.go b/pkg/scalers/azure_pipelines_scaler.go index 6bdf5c3fdec..664fc1fdeb2 100644 --- a/pkg/scalers/azure_pipelines_scaler.go +++ b/pkg/scalers/azure_pipelines_scaler.go @@ -194,7 +194,7 @@ func getAuthMethod(logger logr.Logger, config *scalersconfig.ScalerConfig) (stri case "", kedav1alpha1.PodIdentityProviderNone: return "", nil, kedav1alpha1.AuthPodIdentity{}, fmt.Errorf("no personalAccessToken given or PodIdentity provider configured") case kedav1alpha1.PodIdentityProviderAzure, kedav1alpha1.PodIdentityProviderAzureWorkload: - cred, err := azure.NewChainedCredential(logger, config.PodIdentity.GetIdentityID(), config.PodIdentity.GetIdentityTenantID(), config.PodIdentity.Provider) + cred, err := azure.NewChainedCredential(logger, config.PodIdentity) if err != nil { return "", nil, kedav1alpha1.AuthPodIdentity{}, err } diff --git a/pkg/scalers/azure_servicebus_scaler.go b/pkg/scalers/azure_servicebus_scaler.go index f0c79b8196f..6946f9cc44f 100755 --- a/pkg/scalers/azure_servicebus_scaler.go +++ b/pkg/scalers/azure_servicebus_scaler.go @@ -308,7 +308,7 @@ func (s *azureServiceBusScaler) getServiceBusAdminClient() (*admin.Client, error case "", kedav1alpha1.PodIdentityProviderNone: client, err = admin.NewClientFromConnectionString(s.metadata.connection, opts) case kedav1alpha1.PodIdentityProviderAzure, kedav1alpha1.PodIdentityProviderAzureWorkload: - creds, chainedErr := azure.NewChainedCredential(s.logger, s.podIdentity.GetIdentityID(), s.podIdentity.GetIdentityTenantID(), s.podIdentity.Provider) + creds, chainedErr := azure.NewChainedCredential(s.logger, s.podIdentity) if chainedErr != nil { return nil, chainedErr } diff --git a/pkg/scalers/externalscaler/externalscaler.pb.go b/pkg/scalers/externalscaler/externalscaler.pb.go index 53515281ab7..5d0a2d3620f 100644 --- a/pkg/scalers/externalscaler/externalscaler.pb.go +++ b/pkg/scalers/externalscaler/externalscaler.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.32.0 -// protoc v4.24.4 +// protoc v4.25.3 // source: externalscaler.proto package externalscaler diff --git a/pkg/scalers/externalscaler/externalscaler_grpc.pb.go b/pkg/scalers/externalscaler/externalscaler_grpc.pb.go index 503b5695932..d263955579a 100644 --- a/pkg/scalers/externalscaler/externalscaler_grpc.pb.go +++ b/pkg/scalers/externalscaler/externalscaler_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.24.4 +// - protoc v4.25.3 // source: externalscaler.proto package externalscaler diff --git a/pkg/scalers/liiklus/LiiklusService.pb.go b/pkg/scalers/liiklus/LiiklusService.pb.go index 71e3e8476d6..d6ea6e77a17 100644 --- a/pkg/scalers/liiklus/LiiklusService.pb.go +++ b/pkg/scalers/liiklus/LiiklusService.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.32.0 -// protoc v4.24.4 +// protoc v4.25.3 // source: LiiklusService.proto package liiklus diff --git a/pkg/scalers/liiklus/LiiklusService_grpc.pb.go b/pkg/scalers/liiklus/LiiklusService_grpc.pb.go index 1910dd6b90a..c56086c7d6d 100644 --- a/pkg/scalers/liiklus/LiiklusService_grpc.pb.go +++ b/pkg/scalers/liiklus/LiiklusService_grpc.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: // - protoc-gen-go-grpc v1.3.0 -// - protoc v4.24.4 +// - protoc v4.25.3 // source: LiiklusService.proto package liiklus diff --git a/pkg/scaling/resolver/azure_keyvault_handler.go b/pkg/scaling/resolver/azure_keyvault_handler.go index b995344c705..b1c1c7243a3 100644 --- a/pkg/scaling/resolver/azure_keyvault_handler.go +++ b/pkg/scaling/resolver/azure_keyvault_handler.go @@ -92,7 +92,7 @@ func (vh *AzureKeyVaultHandler) getCredentials(ctx context.Context, client clien return azidentity.NewClientSecretCredential(tenantID, clientID, clientSecret, nil) case kedav1alpha1.PodIdentityProviderAzure, kedav1alpha1.PodIdentityProviderAzureWorkload: - return azure.NewChainedCredential(logger, podIdentity.GetIdentityID(), podIdentity.Provider) + return azure.NewChainedCredential(logger, *podIdentity) default: return nil, fmt.Errorf("key vault does not support pod identity provider - %s", podIdentity.Provider) }