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 6ccbeaf8641324000ab55bbff374f315a7f13bbe Author: Pasquale Congiusti <[email protected]> AuthorDate: Fri Oct 25 07:42:28 2024 +0200 feat(trait): deprecate aws secrets manager --- addons/vault/aws/aws_secrets_manager.go | 15 ++++++++++++++- addons/vault/aws/aws_secrets_manager_test.go | 8 ++++---- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/addons/vault/aws/aws_secrets_manager.go b/addons/vault/aws/aws_secrets_manager.go index af7a1709a..913316c03 100644 --- a/addons/vault/aws/aws_secrets_manager.go +++ b/addons/vault/aws/aws_secrets_manager.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 aws-secrets-manager.enabled=true -t aws-secrets-manager.access-key="aws-access-key" -t aws-secrets-manager.secret-key="aws-secret-key" -t aws-secrets-manager.region="aws-region" -t aws-secrets-manager.context-reload-enabled="true" -t aws-secrets-manager.refresh-enabled="true" -t aws-secrets-manager.refresh-period="30000" -t aws-secrets-manager.secrets="test*" // +// 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=aws-secrets-manager. +// +camel-k:deprecated=2.5.0. type Trait struct { traitv1.Trait `property:",squash"` // Enables automatic configuration of the trait. @@ -100,7 +104,16 @@ func (t *awsSecretsManagerTrait) Configure(environment *trait.Environment) (bool t.RefreshEnabled = ptr.To(false) } - return true, nil, nil + condition := trait.NewIntegrationCondition( + "AWSSecretManager", + v1.IntegrationConditionTraitInfo, + corev1.ConditionTrue, + trait.TraitConfigurationReason, + "AWSSecretManager 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 *awsSecretsManagerTrait) Apply(environment *trait.Environment) error { diff --git a/addons/vault/aws/aws_secrets_manager_test.go b/addons/vault/aws/aws_secrets_manager_test.go index 8c9ab48ba..aecfd8358 100644 --- a/addons/vault/aws/aws_secrets_manager_test.go +++ b/addons/vault/aws/aws_secrets_manager_test.go @@ -49,7 +49,7 @@ func TestAwsSecretsManagerTraitApply(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) @@ -72,7 +72,7 @@ func TestAwsSecretsManagerTraitNoDefaultCreds(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) @@ -112,7 +112,7 @@ func TestAwsSecretsManagerTraitWithSecrets(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) @@ -152,7 +152,7 @@ func TestAwsSecretsManagerTraitWithConfigMap(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)
