Skip to content

Commit

Permalink
💄 Do not generate SSL env vars for each struct entry, just once per c…
Browse files Browse the repository at this point in the history
…ontainersource/image

Signed-off-by: Matthias Wessendorf <[email protected]>
  • Loading branch information
matzew committed Nov 8, 2024
1 parent 35d8c63 commit ef9b855
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkg/reconciler/integrationsource/resources/containersource.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func NewContainerSource(source *v1alpha1.IntegrationSource) *sourcesv1.Container
}

func generateEnvVarsFromStruct(prefix string, s interface{}) []corev1.EnvVar {
var envVars = makeSSLEnvVar()
var envVars []corev1.EnvVar

// Use reflection to inspect the struct fields
v := reflect.ValueOf(s)
Expand Down Expand Up @@ -136,7 +136,7 @@ func generateEnvVarsFromStruct(prefix string, s interface{}) []corev1.EnvVar {

// Function to create environment variables for Timer or AWS configurations dynamically
func makeEnv(source *v1alpha1.IntegrationSource) []corev1.EnvVar {
var envVars []corev1.EnvVar
var envVars = makeSSLEnvVar()

// Timer environment variables
if source.Spec.Timer != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,6 @@ func TestGenerateEnvVarsFromStruct(t *testing.T) {

// Expected environment variables including SSL settings
want := []corev1.EnvVar{
{Name: "CAMEL_KNATIVE_CLIENT_SSL_ENABLED", Value: "true"},
{Name: "CAMEL_KNATIVE_CLIENT_SSL_CERT_PATH", Value: "/knative-custom-certs/knative-eventing-bundle.pem"},
{Name: "TEST_PREFIX_FIELD1", Value: "123"},
{Name: "TEST_PREFIX_FIELD2", Value: "true"},
{Name: "TEST_PREFIX_FIELD3", Value: "hello"},
Expand Down

0 comments on commit ef9b855

Please sign in to comment.