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. 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 {