You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2023/02/13 17:41:21 UTC
[camel-k] 01/04: feature(#3903): Support secret refresh through the existing addons - Azure Key Vault
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 0a9250af3cb55d399078b81051448b4ebe104838
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Mon Feb 13 18:13:04 2023 +0100
feature(#3903): Support secret refresh through the existing addons - Azure Key Vault
Signed-off-by: Andrea Cosentino <an...@gmail.com>
---
addons/vault/azure/azure_key_vault.go | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)
diff --git a/addons/vault/azure/azure_key_vault.go b/addons/vault/azure/azure_key_vault.go
index 2bec04985..429858c0b 100644
--- a/addons/vault/azure/azure_key_vault.go
+++ b/addons/vault/azure/azure_key_vault.go
@@ -23,6 +23,7 @@ import (
"github.com/apache/camel-k/pkg/trait"
"github.com/apache/camel-k/pkg/util"
"k8s.io/utils/pointer"
+ "strconv"
)
// The Azure Key Vault trait can be used to use secrets from Azure Key Vault service
@@ -48,6 +49,22 @@ type Trait struct {
ClientSecret string `property:"client-secret,omitempty"`
// The Azure Vault Name for accessing Key Vault
VaultName string `property:"vault-name,omitempty"`
+ // Define if we want to use the Camel Context Reload feature or not
+ ContextReloadEnabled *bool `property:"context-reload-enabled,omitempty"`
+ // Define if we want to use the Refresh Feature for secrets
+ RefreshEnabled *bool `property:"refresh-enabled,omitempty"`
+ // If Refresh is enabled, this defines the interval to check the refresh event
+ RefreshPeriod string `property:"refresh-period,omitempty"`
+ // If Refresh is enabled, the regular expression representing the secrets we want to track
+ Secrets string `property:"refresh-period,omitempty"`
+ // If Refresh is enabled, the connection String to point to the Eventhub service used to track updates
+ EventhubConnectionString string `property:"refresh-period,omitempty"`
+ // If Refresh is enabled, the account name for Azure Storage Blob service used to save checkpoint while consuming from Eventhub
+ BlobAccountName string `property:"refresh-period,omitempty"`
+ // If Refresh is enabled, the access key for Azure Storage Blob service used to save checkpoint while consuming from Eventhub
+ BlobAccessKey string `property:"refresh-period,omitempty"`
+ // If Refresh is enabled, the container name for Azure Storage Blob service used to save checkpoint while consuming from Eventhub
+ BlobContainerName string `property:"refresh-period,omitempty"`
}
type azureKeyVaultTrait struct {
@@ -70,6 +87,14 @@ func (t *azureKeyVaultTrait) Configure(environment *trait.Environment) (bool, er
return false, nil
}
+ if t.ContextReloadEnabled == nil {
+ t.ContextReloadEnabled = pointer.Bool(false)
+ }
+
+ if t.RefreshEnabled == nil {
+ t.RefreshEnabled = pointer.Bool(false)
+ }
+
return true, nil
}
@@ -85,6 +110,16 @@ func (t *azureKeyVaultTrait) Apply(environment *trait.Environment) error {
environment.ApplicationProperties["camel.vault.azure.clientId"] = t.ClientID
environment.ApplicationProperties["camel.vault.azure.clientSecret"] = t.ClientSecret
environment.ApplicationProperties["camel.vault.azure.vaultName"] = t.VaultName
+ environment.ApplicationProperties["camel.vault.azure.refreshEnabled"] = strconv.FormatBool(*t.RefreshEnabled)
+ environment.ApplicationProperties["camel.main.context-reload-enabled"] = strconv.FormatBool(*t.ContextReloadEnabled)
+ environment.ApplicationProperties["camel.vault.azure.refreshPeriod"] = t.RefreshPeriod
+ if t.Secrets != "" {
+ environment.ApplicationProperties["camel.vault.azure.secrets"] = t.Secrets
+ }
+ environment.ApplicationProperties["camel.vault.azure.eventhubConnectionString"] = t.EventhubConnectionString
+ environment.ApplicationProperties["camel.vault.azure.blobAccountName"] = t.BlobAccountName
+ environment.ApplicationProperties["camel.vault.azure.blobContainerName"] = t.BlobContainerName
+ environment.ApplicationProperties["camel.vault.azure.blobAccessKey"] = t.BlobAccessKey
}
return nil