From 97bb7f7f4b1a49912652fda5d7ae52c0e7b9ccc3 Mon Sep 17 00:00:00 2001 From: Nicolas Chapurlat Date: Wed, 1 Sep 2021 17:22:41 +0200 Subject: [PATCH] TriggerAuthentication/Vault: add support for vault namespace Signed-off-by: Nicolas Chapurlat --- CHANGELOG.md | 1 + apis/keda/v1alpha1/triggerauthentication_types.go | 3 +++ pkg/scaling/resolver/hashicorpvault_handler.go | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index adda09d72bb..81734a47ba8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ - Add Bearer auth for Metrics API scaler ([#2028](https://github.com/kedacore/keda/pull/2028)) - Anonymize the host in case of HTTP failure (RabbitMQ Scaler) ([#2041](https://github.com/kedacore/keda/pull/2041)) - Escape `queueName` and `vhostName` in RabbitMQ Scaler before use them in query string (bug fix) ([#2055](https://github.com/kedacore/keda/pull/2055)) +- TriggerAuthentication/Vault: add support for Vault namespace (Vault Enterprise) ([#2085](https://github.com/kedacore/keda/pull/2085)) ### Breaking Changes diff --git a/apis/keda/v1alpha1/triggerauthentication_types.go b/apis/keda/v1alpha1/triggerauthentication_types.go index 6764313fb85..a071b9ca16c 100644 --- a/apis/keda/v1alpha1/triggerauthentication_types.go +++ b/apis/keda/v1alpha1/triggerauthentication_types.go @@ -136,6 +136,9 @@ type HashiCorpVault struct { Authentication VaultAuthentication `json:"authentication"` Secrets []VaultSecret `json:"secrets"` + // +optional + Namespace string `json:"namespace,omitempty"` + // +optional Credential *Credential `json:"credential,omitempty"` diff --git a/pkg/scaling/resolver/hashicorpvault_handler.go b/pkg/scaling/resolver/hashicorpvault_handler.go index 3d147d22829..4d10bb143c6 100644 --- a/pkg/scaling/resolver/hashicorpvault_handler.go +++ b/pkg/scaling/resolver/hashicorpvault_handler.go @@ -54,6 +54,10 @@ func (vh *HashicorpVaultHandler) Initialize(logger logr.Logger) error { return err } + if len(vh.vault.Namespace) > 0 { + client.SetNamespace(vh.vault.Namespace) + } + token, err := vh.token(client) if err != nil { return err