Skip to content

Commit

Permalink
deprecate code
Browse files Browse the repository at this point in the history
Signed-off-by: Jorge Turrado <jorge_turrado@hotmail.es>
  • Loading branch information
JorTurFer committed May 2, 2023
1 parent 940cc54 commit 565d2a5
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 11 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@ To learn more about active deprecations, we recommend checking [GitHub Discussio

### Deprecations

- TODO ([#XXX](https://github.com/kedacore/keda/issue/XXX))
You can find all deprecations in [this overview](https://github.com/kedacore/keda/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc+label%3Abreaking-change) and [join the discussion here](https://github.com/kedacore/keda/discussions/categories/deprecations).

New deprecation(s):

- **Azure Data Explorer**: Deprecate `metadata.clientSecret` ([#4514](https://github.com/kedacore/keda/issues/4514))


### Breaking Changes

Expand Down
21 changes: 11 additions & 10 deletions pkg/scalers/azure/azure_data_explorer.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ func getDataExplorerAuthConfig(metadata *DataExplorerMetadata) (*kusto.Connectio
return nil, fmt.Errorf("missing credentials. please ensure that TenantID is provided")
}
kcsb.WithAadAppKey(metadata.ClientID, metadata.ClientSecret, metadata.TenantID)
// This should be here because internaly the SDK resets the configuration
// after calling `WithAadAppKey`
clientOptions := &policy.ClientOptions{
Cloud: cloud.Configuration{
ActiveDirectoryAuthorityHost: metadata.ActiveDirectoryEndpoint,
Services: map[cloud.ServiceName]cloud.ServiceConfiguration{},
},
}
kcsb.AttachPolicyClientOptions(clientOptions)

case kedav1alpha1.PodIdentityProviderAzure, kedav1alpha1.PodIdentityProviderAzureWorkload:
azureDataExplorerLogger.V(1).Info(fmt.Sprintf("Creating Azure Data Explorer Client using podIdentity %s", metadata.PodIdentity.Provider))
Expand All @@ -87,21 +96,13 @@ func getDataExplorerAuthConfig(metadata *DataExplorerMetadata) (*kusto.Connectio
return nil, chainedErr
}
kcsb.WithTokenCredential(creds)
// We don't need to call to kcsb.AttachPolicyClientOptions because WI/AAD-Pod-Identity manages
// it based on their own configurations

default:
return nil, fmt.Errorf("missing credentials. please reconfigure your scaled object metadata")
}

// This should be here because internaly the SDK resets the configuration
// after calling `WithTokenCredential` and `WithAadAppKey`
clientOptions := &policy.ClientOptions{
Cloud: cloud.Configuration{
ActiveDirectoryAuthorityHost: metadata.ActiveDirectoryEndpoint,
Services: map[cloud.ServiceName]cloud.ServiceConfiguration{},
},
}
kcsb.AttachPolicyClientOptions(clientOptions)

return kcsb, nil
}

Expand Down
7 changes: 7 additions & 0 deletions pkg/scalers/azure_data_explorer_scaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,17 @@ func parseAzureDataExplorerAuthParams(config *ScalerConfig, logger logr.Logger)
}
metadata.ClientID = clientID

// FIXME: DEPRECATED to be removed in v2.13
// We should get the secret only from AuthConfig or env
clientSecret, err := getParameterFromConfig(config, "clientSecret", true)
if err != nil {
return nil, err
}
if val, ok := config.TriggerMetadata["clientSecret"]; ok && val != "" {
logger.Info("getting 'clientSecret' from metadata is deprecated, use 'clientSecretFromEnv' or TriggerAuthentication instead")
}
// FIXME: DEPRECATED to be removed in v2.13

metadata.ClientSecret = clientSecret
default:
return nil, fmt.Errorf("error parsing auth params")
Expand Down

0 comments on commit 565d2a5

Please # to comment.