Skip to content

Commit 047548d

Browse files
committed
Added operator version attribute to pods.
1 parent 05982e7 commit 047548d

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

src/Contrast.K8s.AgentOperator/Core/Reactions/Injecting/InjectionConstants.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ public static class InjectionConstants
1010
// Pod annotations via the mutation webhook.
1111
public const string IsInjectedAttributeName = "agents.contrastsecurity.com/is-injected";
1212
public const string InjectedOnAttributeName = "agents.contrastsecurity.com/injected-on";
13+
public const string InjectedByAttributeName = "agents.contrastsecurity.com/injected-by";
1314
public const string InjectorTypeAttributeName = "agents.contrastsecurity.com/injector-type";
1415

1516
// Pod annotations via the workload (our direct patching).

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ private void ApplyPatches(PatchingContext context, V1Pod pod, IAgentPatcher? age
5757
{
5858
pod.SetAnnotation(InjectionConstants.IsInjectedAttributeName, true.ToString());
5959
pod.SetAnnotation(InjectionConstants.InjectedOnAttributeName, DateTimeOffset.UtcNow.ToString("O"));
60+
pod.SetAnnotation(InjectionConstants.InjectedByAttributeName, $"Contrast.K8s.AgentOperator/{OperatorVersion.Version}");
6061
pod.SetAnnotation(InjectionConstants.InjectorTypeAttributeName, context.Injector.Type.ToString());
6162

6263
pod.Spec.Volumes ??= new List<V1Volume>();

0 commit comments

Comments
 (0)