diff --git a/pkg/apis/common/integration/v1alpha1/aws.go b/pkg/apis/common/integration/v1alpha1/aws.go index 056ef5b4ea3..1fd7ff988f4 100644 --- a/pkg/apis/common/integration/v1alpha1/aws.go +++ b/pkg/apis/common/integration/v1alpha1/aws.go @@ -16,6 +16,14 @@ limitations under the License. package v1alpha1 +const ( + + // AwsAccessKey is the name of the expected key on the secret for accessing the actual AWS access key value. + AwsAccessKey = "aws.accessKey" + // AwsSecretKey is the name of the expected key on the secret for accessing the actual AWS secret key value. + AwsSecretKey = "aws.secretKey" +) + type AWSCommon struct { // Auth is the S3 authentication (accessKey/secretKey) configuration. Region string `json:"region,omitempty"` // AWS region diff --git a/pkg/reconciler/integration/sink/resources/container_image.go b/pkg/reconciler/integration/sink/resources/container_image.go index 1d6928429b8..114a7238874 100644 --- a/pkg/reconciler/integration/sink/resources/container_image.go +++ b/pkg/reconciler/integration/sink/resources/container_image.go @@ -21,6 +21,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" + commonv1a1 "knative.dev/eventing/pkg/apis/common/integration/v1alpha1" "knative.dev/eventing/pkg/apis/sinks/v1alpha1" "knative.dev/eventing/pkg/reconciler/integration" "knative.dev/pkg/kmeta" @@ -123,8 +124,8 @@ func makeEnv(sink *v1alpha1.IntegrationSink) []corev1.EnvVar { envVars = append(envVars, integration.GenerateEnvVarsFromStruct("CAMEL_KAMELET_AWS_S3_SINK", *sink.Spec.Aws.S3)...) if secretName != "" { envVars = append(envVars, []corev1.EnvVar{ - integration.MakeSecretEnvVar("CAMEL_KAMELET_AWS_S3_SINK_ACCESSKEY", "aws.accessKey", secretName), - integration.MakeSecretEnvVar("CAMEL_KAMELET_AWS_S3_SINK_SECRETKEY", "aws.secretKey", secretName), + integration.MakeSecretEnvVar("CAMEL_KAMELET_AWS_S3_SINK_ACCESSKEY", commonv1a1.AwsAccessKey, secretName), + integration.MakeSecretEnvVar("CAMEL_KAMELET_AWS_S3_SINK_SECRETKEY", commonv1a1.AwsSecretKey, secretName), }...) } return envVars @@ -135,8 +136,8 @@ func makeEnv(sink *v1alpha1.IntegrationSink) []corev1.EnvVar { envVars = append(envVars, integration.GenerateEnvVarsFromStruct("CAMEL_KAMELET_AWS_SQS_SINK", *sink.Spec.Aws.SQS)...) if secretName != "" { envVars = append(envVars, []corev1.EnvVar{ - integration.MakeSecretEnvVar("CAMEL_KAMELET_AWS_SQS_SINK_ACCESSKEY", "aws.accessKey", secretName), - integration.MakeSecretEnvVar("CAMEL_KAMELET_AWS_SQS_SINK_SECRETKEY", "aws.secretKey", secretName), + integration.MakeSecretEnvVar("CAMEL_KAMELET_AWS_SQS_SINK_ACCESSKEY", commonv1a1.AwsAccessKey, secretName), + integration.MakeSecretEnvVar("CAMEL_KAMELET_AWS_SQS_SINK_SECRETKEY", commonv1a1.AwsSecretKey, secretName), }...) } return envVars diff --git a/pkg/reconciler/integration/source/resources/containersource.go b/pkg/reconciler/integration/source/resources/containersource.go index bdf9c510f25..569defcd45b 100644 --- a/pkg/reconciler/integration/source/resources/containersource.go +++ b/pkg/reconciler/integration/source/resources/containersource.go @@ -19,17 +19,13 @@ package resources import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + commonv1a1 "knative.dev/eventing/pkg/apis/common/integration/v1alpha1" sourcesv1 "knative.dev/eventing/pkg/apis/sources/v1" "knative.dev/eventing/pkg/apis/sources/v1alpha1" "knative.dev/eventing/pkg/reconciler/integration" "knative.dev/pkg/kmeta" ) -const ( - awsAccessKey = "aws.accessKey" - awsSecretKey = "aws.secretKey" -) - func NewContainerSource(source *v1alpha1.IntegrationSource) *sourcesv1.ContainerSource { return &sourcesv1.ContainerSource{ ObjectMeta: metav1.ObjectMeta{ @@ -79,8 +75,8 @@ func makeEnv(source *v1alpha1.IntegrationSource) []corev1.EnvVar { envVars = append(envVars, integration.GenerateEnvVarsFromStruct("CAMEL_KAMELET_AWS_S3_SOURCE", *source.Spec.Aws.S3)...) if secretName != "" { envVars = append(envVars, []corev1.EnvVar{ - integration.MakeSecretEnvVar("CAMEL_KAMELET_AWS_S3_SOURCE_ACCESSKEY", awsAccessKey, secretName), - integration.MakeSecretEnvVar("CAMEL_KAMELET_AWS_S3_SOURCE_SECRETKEY", awsSecretKey, secretName), + integration.MakeSecretEnvVar("CAMEL_KAMELET_AWS_S3_SOURCE_ACCESSKEY", commonv1a1.AwsAccessKey, secretName), + integration.MakeSecretEnvVar("CAMEL_KAMELET_AWS_S3_SOURCE_SECRETKEY", commonv1a1.AwsSecretKey, secretName), }...) } return envVars @@ -91,8 +87,8 @@ func makeEnv(source *v1alpha1.IntegrationSource) []corev1.EnvVar { envVars = append(envVars, integration.GenerateEnvVarsFromStruct("CAMEL_KAMELET_AWS_SQS_SOURCE", *source.Spec.Aws.SQS)...) if secretName != "" { envVars = append(envVars, []corev1.EnvVar{ - integration.MakeSecretEnvVar("CAMEL_KAMELET_AWS_SQS_SOURCE_ACCESSKEY", awsAccessKey, secretName), - integration.MakeSecretEnvVar("CAMEL_KAMELET_AWS_SQS_SOURCE_SECRETKEY", awsSecretKey, secretName), + integration.MakeSecretEnvVar("CAMEL_KAMELET_AWS_SQS_SOURCE_ACCESSKEY", commonv1a1.AwsAccessKey, secretName), + integration.MakeSecretEnvVar("CAMEL_KAMELET_AWS_SQS_SOURCE_SECRETKEY", commonv1a1.AwsSecretKey, secretName), }...) } return envVars @@ -103,8 +99,8 @@ func makeEnv(source *v1alpha1.IntegrationSource) []corev1.EnvVar { envVars = append(envVars, integration.GenerateEnvVarsFromStruct("CAMEL_KAMELET_AWS_DDB_STREAMS_SOURCE", *source.Spec.Aws.DDBStreams)...) if secretName != "" { envVars = append(envVars, []corev1.EnvVar{ - integration.MakeSecretEnvVar("CAMEL_KAMELET_AWS_DDB_STREAMS_SOURCE_ACCESSKEY", awsAccessKey, secretName), - integration.MakeSecretEnvVar("CAMEL_KAMELET_AWS_DDB_STREAMS_SOURCE_SECRETKEY", awsSecretKey, secretName), + integration.MakeSecretEnvVar("CAMEL_KAMELET_AWS_DDB_STREAMS_SOURCE_ACCESSKEY", commonv1a1.AwsAccessKey, secretName), + integration.MakeSecretEnvVar("CAMEL_KAMELET_AWS_DDB_STREAMS_SOURCE_SECRETKEY", commonv1a1.AwsSecretKey, secretName), }...) } return envVars