From 7e210b0576d5c1bd26133ffbc8bbdd1e8d0f5a0e Mon Sep 17 00:00:00 2001 From: Alexander Dejanovski Date: Mon, 2 Oct 2023 14:11:08 +0200 Subject: [PATCH] Address Michael's comment --- config/manager/image_config.yaml | 2 +- config/manager/kustomization.yaml | 2 +- pkg/reconciliation/construct_podtemplatespec.go | 2 +- pkg/reconciliation/construct_podtemplatespec_test.go | 3 ++- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/config/manager/image_config.yaml b/config/manager/image_config.yaml index 27a78f66..115e9cd1 100644 --- a/config/manager/image_config.yaml +++ b/config/manager/image_config.yaml @@ -3,7 +3,7 @@ kind: ImageConfig metadata: name: image-config images: - system-logger: "k8ssandra/system-logger:v1.18.0-dev.30764ce-20231002" + system-logger: "k8ssandra/system-logger:latest" config-builder: "datastax/cass-config-builder:1.0-ubi7" k8ssandra-client: "k8ssandra/k8ssandra-client:v0.2.0" # cassandra: diff --git a/config/manager/kustomization.yaml b/config/manager/kustomization.yaml index 75978fd5..7621efda 100644 --- a/config/manager/kustomization.yaml +++ b/config/manager/kustomization.yaml @@ -14,4 +14,4 @@ kind: Kustomization images: - name: controller newName: k8ssandra/cass-operator - newTag: v1.18.0-dev.30764ce-20231002 + newTag: latest diff --git a/pkg/reconciliation/construct_podtemplatespec.go b/pkg/reconciliation/construct_podtemplatespec.go index bbea88a4..0ab215bc 100644 --- a/pkg/reconciliation/construct_podtemplatespec.go +++ b/pkg/reconciliation/construct_podtemplatespec.go @@ -710,7 +710,7 @@ func buildContainers(dc *api.CassandraDatacenter, baseTemplate *corev1.PodTempla {Name: "CLUSTER_NAME", Value: dc.Spec.ClusterName}, {Name: "DATACENTER_NAME", Value: dc.DatacenterName()}, {Name: "RACK_NAME", ValueFrom: selectorFromFieldPath("metadata.labels['cassandra.datastax.com/rack']")}, - {Name: "NAMESPACE", Value: dc.Namespace}, + {Name: "NAMESPACE", ValueFrom: selectorFromFieldPath("metadata.namespace")}, } loggerContainer.Env = combineEnvSlices(loggerEnvDefaults, loggerContainer.Env) diff --git a/pkg/reconciliation/construct_podtemplatespec_test.go b/pkg/reconciliation/construct_podtemplatespec_test.go index 4a9bf76a..6e923ccd 100644 --- a/pkg/reconciliation/construct_podtemplatespec_test.go +++ b/pkg/reconciliation/construct_podtemplatespec_test.go @@ -461,6 +461,7 @@ func TestLoggerContainerEnvVars(t *testing.T) { podNameEnvVar := corev1.EnvVar{Name: "POD_NAME", ValueFrom: selectorFromFieldPath("metadata.name")} nodeNameEnvVar := corev1.EnvVar{Name: "NODE_NAME", ValueFrom: selectorFromFieldPath("spec.nodeName")} rackNameEnvVar := corev1.EnvVar{Name: "RACK_NAME", ValueFrom: selectorFromFieldPath("metadata.labels['cassandra.datastax.com/rack']")} + namespaceEnvVar := corev1.EnvVar{Name: "NAMESPACE", ValueFrom: selectorFromFieldPath("metadata.namespace")} templateSpec := &corev1.PodTemplateSpec{} dc := &api.CassandraDatacenter{ @@ -487,9 +488,9 @@ func TestLoggerContainerEnvVars(t *testing.T) { assert.True(envVarsContains(loggerContainer.Env, podNameEnvVar)) assert.True(envVarsContains(loggerContainer.Env, nodeNameEnvVar)) assert.True(envVarsContains(loggerContainer.Env, rackNameEnvVar)) + assert.True(envVarsContains(loggerContainer.Env, namespaceEnvVar)) assert.True(envVarsContains(loggerContainer.Env, corev1.EnvVar{Name: "CLUSTER_NAME", Value: dc.Spec.ClusterName})) assert.True(envVarsContains(loggerContainer.Env, corev1.EnvVar{Name: "DATACENTER_NAME", Value: dc.DatacenterName()})) - assert.True(envVarsContains(loggerContainer.Env, corev1.EnvVar{Name: "NAMESPACE", Value: dc.Namespace})) } func TestCassandraDatacenter_buildContainers_override_other_containers(t *testing.T) {