Skip to content

Commit 2b472a5

Browse files
committed
Fix env ordering to allow overriding via agentconfig
1 parent 9ef0963 commit 2b472a5

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

manifests/install/testing/overlays/deployment.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ spec:
1616
value: "true"
1717
- name: "CONTRAST_LOG_LEVEL"
1818
value: "TRACE"
19+
- name: "CONTRAST_ENABLE_AGENT_STDOUT"
20+
value: "true"

src/Contrast.K8s.AgentOperator/Core/Reactions/Injecting/Patching/PodPatcher.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -298,11 +298,6 @@ private IEnumerable<V1EnvVar> GenerateEnvVars(PatchingContext context, V1Pod pod
298298
yield return new V1EnvVar("CONTRAST_MOUNT_AGENT_PATH", agentMountPath);
299299
yield return new V1EnvVar("CONTRAST_MOUNT_WRITABLE_PATH", writableMountPath);
300300

301-
if (_operatorOptions.EnableAgentStdout)
302-
{
303-
yield return new V1EnvVar("CONTRAST__AGENT__LOGGER__STDOUT", "true");
304-
}
305-
306301
if (connection.TeamServerUri != null)
307302
{
308303
yield return new V1EnvVar("CONTRAST__API__URL", connection.TeamServerUri);
@@ -387,7 +382,12 @@ private IEnumerable<V1EnvVar> GenerateEnvVars(PatchingContext context, V1Pod pod
387382
}
388383
}
389384

390-
// Order does matter here, make sure these next two are after YamlKeys.
385+
// Order does matter here, YamlKeys values take precedent.
386+
if (_operatorOptions.EnableAgentStdout)
387+
{
388+
yield return new V1EnvVar("CONTRAST__AGENT__LOGGER__STDOUT", "true");
389+
}
390+
391391
if (configuration?.SuppressDefaultServerName != true
392392
&& !string.IsNullOrWhiteSpace(workloadNamespace))
393393
{

0 commit comments

Comments
 (0)