This is an automated email from the ASF dual-hosted git repository.

pcongiusti pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git

commit 0b991fc72b344dd055eede59215cd08cde4c6ef6
Author: Pasquale Congiusti <[email protected]>
AuthorDate: Fri Oct 25 07:42:45 2024 +0200

    feat(trait): deprecate azure key vault
---
 addons/vault/azure/azure_key_vault.go      | 15 ++++++++++++++-
 addons/vault/azure/azure_key_vault_test.go |  8 ++++----
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/addons/vault/azure/azure_key_vault.go 
b/addons/vault/azure/azure_key_vault.go
index 44b283f78..638b8a738 100644
--- a/addons/vault/azure/azure_key_vault.go
+++ b/addons/vault/azure/azure_key_vault.go
@@ -26,6 +26,7 @@ import (
        traitv1 "github.com/apache/camel-k/v2/pkg/apis/camel/v1/trait"
        "github.com/apache/camel-k/v2/pkg/trait"
        "github.com/apache/camel-k/v2/pkg/util"
+       corev1 "k8s.io/api/core/v1"
        "k8s.io/utils/ptr"
 )
 
@@ -43,7 +44,10 @@ import (
 // the following trait options:
 // -t azure-key-vault.enabled=true -t azure-key-vault.tenant-id="tenant-id" -t 
azure-key-vault.client-id="client-id" -t 
azure-key-vault.client-secret="client-secret" -t 
azure-key-vault.vault-name="vault-name" -t 
azure-key-vault.context-reload-enabled="true" -t 
azure-key-vault.refresh-enabled="true" -t 
azure-key-vault.refresh-period="30000" -t azure-key-vault.secrets="test*" -t 
azure-key-vault.eventhub-connection-string="connection-string" -t 
azure-key-vault.blob-account-name="account-nam [...]
 //
+// WARNING: The trait is **deprecated** and will removed in future release 
versions: configure directly the Camel properties as required by the component 
instead.
+//
 // +camel-k:trait=azure-key-vault.
+// +camel-k:deprecated=2.5.0.
 type Trait struct {
        traitv1.Trait `property:",squash"`
        // Enables automatic configuration of the trait.
@@ -112,7 +116,16 @@ func (t *azureKeyVaultTrait) Configure(environment 
*trait.Environment) (bool, *t
                t.AzureIdentityEnabled = ptr.To(false)
        }
 
-       return true, nil, nil
+       condition := trait.NewIntegrationCondition(
+               "AzureKeyVault",
+               v1.IntegrationConditionTraitInfo,
+               corev1.ConditionTrue,
+               trait.TraitConfigurationReason,
+               "AzureKeyVault trait is deprecated and may be removed in future 
version: "+
+                       "configure directly the Camel properties as required by 
the component instead",
+       )
+
+       return true, condition, nil
 }
 
 func (t *azureKeyVaultTrait) Apply(environment *trait.Environment) error {
diff --git a/addons/vault/azure/azure_key_vault_test.go 
b/addons/vault/azure/azure_key_vault_test.go
index e829ff0a9..4c3252ed2 100644
--- a/addons/vault/azure/azure_key_vault_test.go
+++ b/addons/vault/azure/azure_key_vault_test.go
@@ -47,7 +47,7 @@ func TestAzureKeyVaultTraitApply(t *testing.T) {
        ok, condition, err := secrets.Configure(e)
        require.NoError(t, err)
        assert.True(t, ok)
-       assert.Nil(t, condition)
+       assert.NotNil(t, condition)
 
        err = secrets.Apply(e)
        require.NoError(t, err)
@@ -90,7 +90,7 @@ func TestAzureKeyVaultTraitApplyWithConfigmapAndRefresh(t 
*testing.T) {
        ok, condition, err := secrets.Configure(e)
        require.NoError(t, err)
        assert.True(t, ok)
-       assert.Nil(t, condition)
+       assert.NotNil(t, condition)
 
        err = secrets.Apply(e)
        require.NoError(t, err)
@@ -137,7 +137,7 @@ func TestAzureKeyVaultTraitApplyWithSecretAndRefresh(t 
*testing.T) {
        ok, condition, err := secrets.Configure(e)
        require.NoError(t, err)
        assert.True(t, ok)
-       assert.Nil(t, condition)
+       assert.NotNil(t, condition)
 
        err = secrets.Apply(e)
        require.NoError(t, err)
@@ -185,7 +185,7 @@ func 
TestAzureKeyVaultTraitAzureIdentityEnabledApplyWithSecretAndRefresh(t *test
        ok, condition, err := secrets.Configure(e)
        require.NoError(t, err)
        assert.True(t, ok)
-       assert.Nil(t, condition)
+       assert.NotNil(t, condition)
 
        err = secrets.Apply(e)
        require.NoError(t, err)

Reply via email to