Skip to content

Commit

Permalink
[chore] Use a generic access/secret key in the secret for AWS connect…
Browse files Browse the repository at this point in the history
…ions (#8312)

🔑 Use a generic access/secret key in the secret for AWS connections

Signed-off-by: Matthias Wessendorf <[email protected]>
  • Loading branch information
matzew authored Nov 7, 2024
1 parent f53d038 commit 35d8c63
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions pkg/reconciler/integrationsource/resources/containersource.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ import (
"knative.dev/pkg/kmeta"
)

const (
awsAccessKey = "aws.accessKey"
awsSecretKey = "aws.secretKey"
)

func NewContainerSource(source *v1alpha1.IntegrationSource) *sourcesv1.ContainerSource {
return &sourcesv1.ContainerSource{
ObjectMeta: metav1.ObjectMeta{
Expand Down Expand Up @@ -150,8 +155,8 @@ func makeEnv(source *v1alpha1.IntegrationSource) []corev1.EnvVar {
envVars = append(envVars, generateEnvVarsFromStruct("CAMEL_KAMELET_AWS_S3_SOURCE", *source.Spec.Aws.S3)...)
if secretName != "" {
envVars = append(envVars, []corev1.EnvVar{
makeSecretEnvVar("CAMEL_KAMELET_AWS_S3_SOURCE_ACCESSKEY", "aws.s3.accessKey", secretName),
makeSecretEnvVar("CAMEL_KAMELET_AWS_S3_SOURCE_SECRETKEY", "aws.s3.secretKey", secretName),
makeSecretEnvVar("CAMEL_KAMELET_AWS_S3_SOURCE_ACCESSKEY", awsAccessKey, secretName),
makeSecretEnvVar("CAMEL_KAMELET_AWS_S3_SOURCE_SECRETKEY", awsSecretKey, secretName),
}...)
}
return envVars
Expand All @@ -162,8 +167,8 @@ func makeEnv(source *v1alpha1.IntegrationSource) []corev1.EnvVar {
envVars = append(envVars, generateEnvVarsFromStruct("CAMEL_KAMELET_AWS_SQS_SOURCE", *source.Spec.Aws.SQS)...)
if secretName != "" {
envVars = append(envVars, []corev1.EnvVar{
makeSecretEnvVar("CAMEL_KAMELET_AWS_SQS_SOURCE_ACCESSKEY", "aws.s3.accessKey", secretName),
makeSecretEnvVar("CAMEL_KAMELET_AWS_SQS_SOURCE_SECRETKEY", "aws.s3.secretKey", secretName),
makeSecretEnvVar("CAMEL_KAMELET_AWS_SQS_SOURCE_ACCESSKEY", awsAccessKey, secretName),
makeSecretEnvVar("CAMEL_KAMELET_AWS_SQS_SOURCE_SECRETKEY", awsSecretKey, secretName),
}...)
}
return envVars
Expand All @@ -174,8 +179,8 @@ func makeEnv(source *v1alpha1.IntegrationSource) []corev1.EnvVar {
envVars = append(envVars, generateEnvVarsFromStruct("CAMEL_KAMELET_AWS_DDB_STREAMS_SOURCE", *source.Spec.Aws.DDBStreams)...)
if secretName != "" {
envVars = append(envVars, []corev1.EnvVar{
makeSecretEnvVar("CAMEL_KAMELET_AWS_DDB_STREAMS_SOURCE_ACCESSKEY", "aws.s3.accessKey", secretName),
makeSecretEnvVar("CAMEL_KAMELET_AWS_DDB_STREAMS_SOURCE_SECRETKEY", "aws.s3.secretKey", secretName),
makeSecretEnvVar("CAMEL_KAMELET_AWS_DDB_STREAMS_SOURCE_ACCESSKEY", awsAccessKey, secretName),
makeSecretEnvVar("CAMEL_KAMELET_AWS_DDB_STREAMS_SOURCE_SECRETKEY", awsSecretKey, secretName),
}...)
}
return envVars
Expand Down

0 comments on commit 35d8c63

Please sign in to comment.