Skip to content

Commit

Permalink
Add missing changes
Browse files Browse the repository at this point in the history
Signed-off-by: Jorge Turrado <[email protected]>
  • Loading branch information
JorTurFer committed Mar 30, 2024
1 parent be0726e commit 40c04ea
Show file tree
Hide file tree
Showing 16 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion pkg/metricsservice/api/metrics.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/metricsservice/api/metrics_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions pkg/scalers/azure/azure_azidentity_chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -31,18 +31,18 @@ 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 {
logger.V(1).Info("aad-pod-identity token provider registered")
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 {
Expand Down
2 changes: 1 addition & 1 deletion pkg/scalers/azure/azure_data_explorer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/scalers/azure/azure_eventhub.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/scalers/azure/azure_storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/scalers/azure_log_analytics_scaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/scalers/azure_monitor_scaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/scalers/azure_pipelines_scaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/scalers/azure_servicebus_scaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/scalers/externalscaler/externalscaler.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/scalers/externalscaler/externalscaler_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/scalers/liiklus/LiiklusService.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/scalers/liiklus/LiiklusService_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/scaling/resolver/azure_keyvault_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 40c04ea

Please sign in to comment.