diff --git a/pkg/reconciler/integration/sink/resources/container_image.go b/pkg/reconciler/integration/sink/resources/container_image.go index 01cb0f224f1..3ef22ccc4e8 100644 --- a/pkg/reconciler/integration/sink/resources/container_image.go +++ b/pkg/reconciler/integration/sink/resources/container_image.go @@ -27,6 +27,12 @@ import ( "knative.dev/pkg/kmeta" ) +var sinkImageMap = map[string]string{ + "log": "gcr.io/knative-nightly/log-sink:latest", + "aws-s3": "gcr.io/knative-nightly/aws-s3-sink:latest", + "aws-sqs": "gcr.io/knative-nightly/aws-sqs-sink:latest", +} + func MakeDeploymentSpec(sink *v1alpha1.IntegrationSink) *appsv1.Deployment { deploy := &appsv1.Deployment{ @@ -148,16 +154,14 @@ func makeEnv(sink *v1alpha1.IntegrationSink) []corev1.EnvVar { } func selectImage(sink *v1alpha1.IntegrationSink) string { - if sink.Spec.Log != nil { - return "gcr.io/knative-nightly/log-sink:latest" - } - if sink.Spec.Aws != nil { - if sink.Spec.Aws.S3 != nil { - return "gcr.io/knative-nightly/aws-s3-source:latest" - } - if sink.Spec.Aws.SQS != nil { - return "gcr.io/knative-nightly/aws-sqs-source:latest" - } + switch { + case sink.Spec.Log != nil: + return sinkImageMap["log"] + case sink.Spec.Aws != nil && sink.Spec.Aws.S3 != nil: + return sinkImageMap["aws-s3"] + case sink.Spec.Aws != nil && sink.Spec.Aws.SQS != nil: + return sinkImageMap["aws-sqs"] + default: + return "" } - return "" } diff --git a/pkg/reconciler/integration/source/resources/containersource.go b/pkg/reconciler/integration/source/resources/containersource.go index a72c250f7a5..bc83ad3efb2 100644 --- a/pkg/reconciler/integration/source/resources/containersource.go +++ b/pkg/reconciler/integration/source/resources/containersource.go @@ -26,6 +26,14 @@ import ( "knative.dev/pkg/kmeta" ) +// TODO: replace with ConfigMap +var sourceImageMap = map[string]string{ + "timer": "gcr.io/knative-nightly/timer-source:latest", + "aws-s3": "gcr.io/knative-nightly/aws-s3-source:latest", + "aws-sqs": "gcr.io/knative-nightly/aws-sqs-source:latest", + "aws-ddb-streams": "gcr.io/knative-nightly/aws-ddb-streams-source:latest", +} + func NewContainerSource(source *v1alpha1.IntegrationSource) *sourcesv1.ContainerSource { return &sourcesv1.ContainerSource{ ObjectMeta: metav1.ObjectMeta{ @@ -114,19 +122,16 @@ func makeEnv(source *v1alpha1.IntegrationSource) []corev1.EnvVar { } func selectImage(source *v1alpha1.IntegrationSource) string { - if source.Spec.Timer != nil { - return "gcr.io/knative-nightly/timer-source:latest" - } - if source.Spec.Aws != nil { - if source.Spec.Aws.S3 != nil { - return "gcr.io/knative-nightly/aws-s3-source:latest" - } - if source.Spec.Aws.SQS != nil { - return "gcr.io/knative-nightly/aws-sqs-source:latest" - } - if source.Spec.Aws.DDBStreams != nil { - return "gcr.io/knative-nightly/aws-ddb-streams-source:latest" - } + switch { + case source.Spec.Timer != nil: + return sourceImageMap["timer"] + case source.Spec.Aws != nil && source.Spec.Aws.S3 != nil: + return sourceImageMap["aws-s3"] + case source.Spec.Aws != nil && source.Spec.Aws.SQS != nil: + return sourceImageMap["aws-sqs"] + case source.Spec.Aws != nil && source.Spec.Aws.DDBStreams != nil: + return sourceImageMap["aws-ddb-streams"] + default: + return "" } - return "" }