From f059533c1f81b95ff9f488e687f5d059abbe1ec6 Mon Sep 17 00:00:00 2001 From: Razz4780 Date: Tue, 4 Feb 2025 11:17:27 +0100 Subject: [PATCH 1/2] Settings annotations and labels on agent pods --- mirrord/kube/src/api/container/pod.rs | 44 ++++++++++++++++----------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/mirrord/kube/src/api/container/pod.rs b/mirrord/kube/src/api/container/pod.rs index c627e3022bd..e98fbb368de 100644 --- a/mirrord/kube/src/api/container/pod.rs +++ b/mirrord/kube/src/api/container/pod.rs @@ -99,25 +99,35 @@ impl ContainerVariant for PodVariant<'_> { .map(BTreeMap::from_iter) .unwrap_or_default(); + let labels = agent + .labels + .iter() + .flatten() + .map(|(k, v)| (k.clone(), v.clone())) + .chain([ + ( + "kuma.io/sidecar-injection".to_owned(), + "disabled".to_owned(), + ), + ("app".to_owned(), "mirrord".to_owned()), + ]) + .collect(); + + let annotations = agent + .annotations + .iter() + .flatten() + .map(|(k, v)| (k.clone(), v.clone())) + .chain([ + ("sidecar.istio.io/inject".to_string(), "false".to_string()), + ("linkerd.io/inject".to_string(), "disabled".to_string()), + ]) + .collect(); + Pod { metadata: ObjectMeta { - annotations: Some( - [ - ("sidecar.istio.io/inject".to_string(), "false".to_string()), - ("linkerd.io/inject".to_string(), "disabled".to_string()), - ] - .into(), - ), - labels: Some( - [ - ( - "kuma.io/sidecar-injection".to_string(), - "disabled".to_string(), - ), - ("app".to_string(), "mirrord".to_string()), - ] - .into(), - ), + annotations: Some(annotations), + labels: Some(labels), ..Default::default() }, spec: Some(PodSpec { From b634f6d85e98565d39be6d2c8ae421cbcbbf250b Mon Sep 17 00:00:00 2001 From: Razz4780 Date: Tue, 4 Feb 2025 11:18:53 +0100 Subject: [PATCH 2/2] Changelog --- changelog.d/3057.fixed.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/3057.fixed.md diff --git a/changelog.d/3057.fixed.md b/changelog.d/3057.fixed.md new file mode 100644 index 00000000000..6df74d08b73 --- /dev/null +++ b/changelog.d/3057.fixed.md @@ -0,0 +1 @@ +Fixed `agent.annotations` and `agent.labels` configuration options to affect agent pods, not only jobs.