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 2463b2ffa8d7376c59436d6a593cdb0f6b2435db Author: Pasquale Congiusti <[email protected]> AuthorDate: Fri Oct 25 07:43:16 2024 +0200 feat(trait): deprecate hashicorp vault --- addons/vault/hashicorp/hashicorp_vault.go | 15 ++++++++++++++- addons/vault/hashicorp/hashicorp_vault_test.go | 6 +++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/addons/vault/hashicorp/hashicorp_vault.go b/addons/vault/hashicorp/hashicorp_vault.go index 399d912f0..05a3b9437 100644 --- a/addons/vault/hashicorp/hashicorp_vault.go +++ b/addons/vault/hashicorp/hashicorp_vault.go @@ -23,6 +23,7 @@ import ( "github.com/apache/camel-k/v2/pkg/trait" "github.com/apache/camel-k/v2/pkg/util" "github.com/apache/camel-k/v2/pkg/util/kubernetes" + corev1 "k8s.io/api/core/v1" "k8s.io/utils/ptr" ) @@ -36,7 +37,10 @@ import ( // the following trait options: // -t hashicorp-vault.enabled=true -t hashicorp-vault.token="token" -t hashicorp-vault.port="port" -t hashicorp-vault.engine="engine" -t hashicorp-vault.port="port" -t hashicorp-vault.scheme="scheme" // +// 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=hashicorp-vault. +// +camel-k:deprecated=2.5.0. type Trait struct { traitv1.Trait `property:",squash"` // Enables automatic configuration of the trait. @@ -75,7 +79,16 @@ func (t *hashicorpVaultTrait) Configure(environment *trait.Environment) (bool, * return false, nil, nil } - return true, nil, nil + condition := trait.NewIntegrationCondition( + "HashicorpVault", + v1.IntegrationConditionTraitInfo, + corev1.ConditionTrue, + trait.TraitConfigurationReason, + "HashicorpVault 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 *hashicorpVaultTrait) Apply(environment *trait.Environment) error { diff --git a/addons/vault/hashicorp/hashicorp_vault_test.go b/addons/vault/hashicorp/hashicorp_vault_test.go index 3e0c101cf..a5d74d91f 100644 --- a/addons/vault/hashicorp/hashicorp_vault_test.go +++ b/addons/vault/hashicorp/hashicorp_vault_test.go @@ -48,7 +48,7 @@ func TestHashicorpVaultTraitApply(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) @@ -82,7 +82,7 @@ func TestHashicorpVaultTraitWithSecretApply(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) @@ -116,7 +116,7 @@ func TestHashicorpVaultTraitWithConfigMapApply(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)
