You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "oscerd (via GitHub)" <gi...@apache.org> on 2023/10/04 12:18:18 UTC
[PR] Kamelet - Inject secret in Vaults - AWS Secret Manager [camel-k]
oscerd opened a new pull request, #4794:
URL: https://github.com/apache/camel-k/pull/4794
Related to #4743
**Release Note**
```release-note
This is a first attempt at implementing the requested feature in AWS Secret Manager
```
I set this as draft because I need some feedback first @squakez @gansheer
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Kamelet - Inject secret in Vaults - AWS Secret Manager [camel-k]
Posted by "oscerd (via GitHub)" <gi...@apache.org>.
oscerd commented on PR #4794:
URL: https://github.com/apache/camel-k/pull/4794#issuecomment-1748656136
The error is not related.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Kamelet - Inject secret in Vaults - AWS Secret Manager [camel-k]
Posted by "squakez (via GitHub)" <gi...@apache.org>.
squakez commented on code in PR #4794:
URL: https://github.com/apache/camel-k/pull/4794#discussion_r1345746059
##########
addons/vault/aws/aws_secrets_manager.go:
##########
@@ -46,9 +47,13 @@ type Trait struct {
traitv1.Trait `property:",squash"`
// Enables automatic configuration of the trait.
Auto *bool `property:"auto" json:"auto,omitempty"`
- // The AWS Access Key to use
+ // The AWS Access Key to use. This could be a plain text or a configmap/secret
+ // The content of the aws access key is expected to be a text containing a valid AWS access key.
+ // Syntax: [configmap|secret]:name[/key], where name represents the resource name, key optionally represents the resource key to be filtered (default key value = aws-access-key).
AccessKey string `property:"access-key" json:"accessKey,omitempty"`
- // The AWS Secret Key to use
+ // The AWS Secret Key to use. This could be a plain text or a configmap/secret
+ // // The content of the aws secret key is expected to be a text containing a valid AWS secret key.
Review Comment:
Double `//`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Kamelet - Inject secret in Vaults - AWS Secret Manager [camel-k]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #4794:
URL: https://github.com/apache/camel-k/pull/4794#issuecomment-1748212395
:camel: **Thank you for contributing!** :camel:
Unable to create **Coverage Report** :warning:.
Merge conflicts found.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Kamelet - Inject secret in Vaults - AWS Secret Manager [camel-k]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #4794:
URL: https://github.com/apache/camel-k/pull/4794#issuecomment-1748455977
:camel: **Thank you for contributing!**
Code Coverage Report :heavy_check_mark: - Coverage unchanged.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Kamelet - Inject secret in Vaults - AWS Secret Manager [camel-k]
Posted by "gansheer (via GitHub)" <gi...@apache.org>.
gansheer commented on code in PR #4794:
URL: https://github.com/apache/camel-k/pull/4794#discussion_r1345768432
##########
addons/vault/aws/aws_secrets_manager_test.go:
##########
@@ -75,6 +75,28 @@ func TestAwsSecretsManagerTraitNoDefaultCreds(t *testing.T) {
assert.Equal(t, "false", e.ApplicationProperties["camel.vault.aws.defaultCredentialsProvider"])
}
+func TestAwsSecretsManagerTraitWithSecrets(t *testing.T) {
Review Comment:
If you could add an configmap case in your test it would be nice.
##########
addons/vault/aws/aws_secrets_manager.go:
##########
@@ -106,8 +112,20 @@ func (t *awsSecretsManagerTrait) Apply(environment *trait.Environment) error {
}
if environment.IntegrationInRunningPhases() {
- environment.ApplicationProperties["camel.vault.aws.accessKey"] = t.AccessKey
- environment.ApplicationProperties["camel.vault.aws.secretKey"] = t.SecretKey
+ hits := rex.FindAllStringSubmatch(t.AccessKey, -1)
+ if len(hits) >= 1 {
+ var res, _ = v1.DecodeValueSource(t.AccessKey, "aws-access-key", "The access Key provided is not valid")
+ environment.ApplicationProperties["camel.vault.aws.accessKey"] = res.SecretKeyRef.Key
Review Comment:
The DecodeValueSource will only translate your input expression to a golang struct object. Therefore here you are passing the value of the key from the expression `[configmap|secret]:name[/key]` instead of its value.
You need to retrieve the kubernetes object to have the value with: https://github.com/apache/camel-k/blob/f1b700cba2dc88f95737b10b141a0bf2e6b95a71/pkg/util/kubernetes/client.go#L179
Also it will manage both configmap and secret because you only do not as the DecodeValueSource contains ONLY ONE of the sub-objects ref `ConfigMapKeyRef` or `SecretKeyRef`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Kamelet - Inject secret in Vaults - AWS Secret Manager [camel-k]
Posted by "gansheer (via GitHub)" <gi...@apache.org>.
gansheer commented on code in PR #4794:
URL: https://github.com/apache/camel-k/pull/4794#discussion_r1345767015
##########
addons/vault/aws/aws_secrets_manager.go:
##########
@@ -106,8 +112,20 @@ func (t *awsSecretsManagerTrait) Apply(environment *trait.Environment) error {
}
if environment.IntegrationInRunningPhases() {
- environment.ApplicationProperties["camel.vault.aws.accessKey"] = t.AccessKey
- environment.ApplicationProperties["camel.vault.aws.secretKey"] = t.SecretKey
+ hits := rex.FindAllStringSubmatch(t.AccessKey, -1)
+ if len(hits) >= 1 {
+ var res, _ = v1.DecodeValueSource(t.AccessKey, "aws-access-key", "The access Key provided is not valid")
+ environment.ApplicationProperties["camel.vault.aws.accessKey"] = res.SecretKeyRef.Key
Review Comment:
The DecodeValueSource will only translate your input expression to a golang struct object. Therefore here you are passing the value of the key from the expression `[configmap|secret]:name[/key]` instead of its value.
If what you want is the value you need to retrieve the kubernetes object to have the value with: https://github.com/apache/camel-k/blob/f1b700cba2dc88f95737b10b141a0bf2e6b95a71/pkg/util/kubernetes/client.go#L179
Also it will manage both configmap and secret because here you only manage secrets as the DecodeValueSource contains ONLY ONE of the sub-objects ref `ConfigMapKeyRef` or `SecretKeyRef`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Kamelet - Inject secret in Vaults - AWS Secret Manager [camel-k]
Posted by "oscerd (via GitHub)" <gi...@apache.org>.
oscerd commented on code in PR #4794:
URL: https://github.com/apache/camel-k/pull/4794#discussion_r1347069231
##########
addons/vault/aws/aws_secrets_manager.go:
##########
@@ -106,8 +112,20 @@ func (t *awsSecretsManagerTrait) Apply(environment *trait.Environment) error {
}
if environment.IntegrationInRunningPhases() {
- environment.ApplicationProperties["camel.vault.aws.accessKey"] = t.AccessKey
- environment.ApplicationProperties["camel.vault.aws.secretKey"] = t.SecretKey
+ hits := rex.FindAllStringSubmatch(t.AccessKey, -1)
+ if len(hits) >= 1 {
+ var res, _ = v1.DecodeValueSource(t.AccessKey, "aws-access-key", "The access Key provided is not valid")
+ environment.ApplicationProperties["camel.vault.aws.accessKey"] = res.SecretKeyRef.Key
Review Comment:
It should be done now.
##########
addons/vault/aws/aws_secrets_manager_test.go:
##########
@@ -75,6 +75,28 @@ func TestAwsSecretsManagerTraitNoDefaultCreds(t *testing.T) {
assert.Equal(t, "false", e.ApplicationProperties["camel.vault.aws.defaultCredentialsProvider"])
}
+func TestAwsSecretsManagerTraitWithSecrets(t *testing.T) {
Review Comment:
It should be done now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Kamelet - Inject secret in Vaults - AWS Secret Manager [camel-k]
Posted by "gansheer (via GitHub)" <gi...@apache.org>.
gansheer commented on PR #4794:
URL: https://github.com/apache/camel-k/pull/4794#issuecomment-1748456871
LGTM
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Kamelet - Inject secret in Vaults - AWS Secret Manager [camel-k]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #4794:
URL: https://github.com/apache/camel-k/pull/4794#issuecomment-1748483677
:camel: **Thank you for contributing!**
Code Coverage Report :heavy_check_mark: - Coverage unchanged.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Kamelet - Inject secret in Vaults - AWS Secret Manager [camel-k]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #4794:
URL: https://github.com/apache/camel-k/pull/4794#issuecomment-1748373829
:camel: **Thank you for contributing!** :camel:
Unable to create **Coverage Report** :warning:.
Merge conflicts found.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Kamelet - Inject secret in Vaults - AWS Secret Manager [camel-k]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #4794:
URL: https://github.com/apache/camel-k/pull/4794#issuecomment-1748437055
:camel: **Thank you for contributing!** :camel:
Unable to create **Coverage Report** :warning:.
Merge conflicts found.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Kamelet - Inject secret in Vaults - AWS Secret Manager [camel-k]
Posted by "oscerd (via GitHub)" <gi...@apache.org>.
oscerd merged PR #4794:
URL: https://github.com/apache/camel-k/pull/4794
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Kamelet - Inject secret in Vaults - AWS Secret Manager [camel-k]
Posted by "gansheer (via GitHub)" <gi...@apache.org>.
gansheer commented on code in PR #4794:
URL: https://github.com/apache/camel-k/pull/4794#discussion_r1345767015
##########
addons/vault/aws/aws_secrets_manager.go:
##########
@@ -106,8 +112,20 @@ func (t *awsSecretsManagerTrait) Apply(environment *trait.Environment) error {
}
if environment.IntegrationInRunningPhases() {
- environment.ApplicationProperties["camel.vault.aws.accessKey"] = t.AccessKey
- environment.ApplicationProperties["camel.vault.aws.secretKey"] = t.SecretKey
+ hits := rex.FindAllStringSubmatch(t.AccessKey, -1)
+ if len(hits) >= 1 {
+ var res, _ = v1.DecodeValueSource(t.AccessKey, "aws-access-key", "The access Key provided is not valid")
+ environment.ApplicationProperties["camel.vault.aws.accessKey"] = res.SecretKeyRef.Key
Review Comment:
The DecodeValueSource will only translate your input expression to a golang struct object. Therefore here you are passing the value of the key from the expression `[configmap|secret]:name[/key]` instead of its value.
If what you want is the value you need to retrieve the kubernetes object to have the value with: https://github.com/apache/camel-k/blob/f1b700cba2dc88f95737b10b141a0bf2e6b95a71/pkg/util/kubernetes/client.go#L179
Also it will manage both configmap and secret because you only do not as the DecodeValueSource contains ONLY ONE of the sub-objects ref `ConfigMapKeyRef` or `SecretKeyRef`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org