Skip to content

Commit

Permalink
Address Michael's comment
Browse files Browse the repository at this point in the history
  • Loading branch information
adejanovski committed Oct 2, 2023
1 parent faa5948 commit ac9e73b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/reconciliation/construct_podtemplatespec.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion pkg/reconciliation/construct_podtemplatespec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -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) {
Expand Down

0 comments on commit ac9e73b

Please sign in to comment.