From 80d139e1bbd0097f7637a44736c3b1988a142dce Mon Sep 17 00:00:00 2001 From: Nicolas Chapurlat Date: Fri, 10 Sep 2021 09:38:39 +0200 Subject: [PATCH] TriggerAuthentication/Vault: add support for vault namespace (#2085) Signed-off-by: Nicolas Chapurlat Co-authored-by: Zbynek Roubalik <726523+zroubalik@users.noreply.github.com> Signed-off-by: nilayasiktoprak --- 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 fa3c630e091..1382de3d7b3 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 HashiCorp Vault namespace (Vault Enterprise) ([#2085](https://github.com/kedacore/keda/pull/2085)) - Add custom http timeout in RabbitMQ Scaler ([#2086](https://github.com/kedacore/keda/pull/2086)) ### 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