Skip to content

Commit 9affbad

Browse files
committed
Use arch agnostic path for ContrastChainLoader
The agent-operator-images for the dotnet-core agent copies the ContrastChainLoader.so to /runtimes/linux/native based on arch at image build time
1 parent be2f34b commit 9affbad

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/Contrast.K8s.AgentOperator/Core/Reactions/Injecting/Patching/Agents/DotNetPatcher.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public IEnumerable<V1EnvVar> GenerateEnvVars(PatchingContext context)
2525
if (_injectorOptions.EnableEarlyChaining)
2626
{
2727
yield return new V1EnvVar("LD_PRELOAD",
28-
$"{context.AgentMountPath}/runtimes/linux-x64/native/ContrastChainLoader.so");
28+
$"{context.AgentMountPath}/runtimes/linux/native/ContrastChainLoader.so");
2929
}
3030
else
3131
{
@@ -63,7 +63,7 @@ public void PatchContainer(V1Container container, PatchingContext context)
6363
{
6464
container.Env.AddOrUpdate(new V1EnvVar("CONTRAST_EXISTING_LD_PRELOAD", currentLdPreloadValue));
6565
container.Env.AddOrUpdate(new V1EnvVar("LD_PRELOAD",
66-
$"{context.AgentMountPath}/runtimes/linux-x64/native/ContrastChainLoader.so:{currentLdPreloadValue}"));
66+
$"{context.AgentMountPath}/runtimes/linux/native/ContrastChainLoader.so:{currentLdPreloadValue}"));
6767
}
6868
}
6969

tests/Contrast.K8s.AgentOperator.FunctionalTests/Scenarios/Injection/Agents/DotnetChainingInjectionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public async Task When_injected_then_pod_should_have_agent_injection_chaining_en
3636
var container = result.Spec.Containers.Should().ContainSingle().Subject;
3737

3838
container.Env.Should().Contain(x => x.Name == "LD_PRELOAD")
39-
.Which.Value.Should().Be("/contrast/agent/runtimes/linux-x64/native/ContrastChainLoader.so:something");
39+
.Which.Value.Should().Be("/contrast/agent/runtimes/linux/native/ContrastChainLoader.so:something");
4040
container.Env.Should().Contain(x => x.Name == "CONTRAST_EXISTING_LD_PRELOAD")
4141
.Which.Value.Should().Be("something");
4242
}

tests/Contrast.K8s.AgentOperator.Tests/Core/Reactions/Injecting/Patching/Agents/DotNetPatcherTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public void PatchContainer_should_add_ld_preload_if_already_set()
8787
.Contain(x => x.Name == "CONTRAST_EXISTING_LD_PRELOAD" && x.Value == existingPreload);
8888
container.Env.Should().Contain(x =>
8989
x.Name == "LD_PRELOAD" && x.Value ==
90-
$"{context.AgentMountPath}/runtimes/linux-x64/native/ContrastChainLoader.so:{existingPreload}");
90+
$"{context.AgentMountPath}/runtimes/linux/native/ContrastChainLoader.so:{existingPreload}");
9191
}
9292
}
9393

0 commit comments

Comments
 (0)