kube: record infra user namespace

if there is an annotation that specifies the user namespace for the
infra container, then make sure it is used for the entire pod.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
This commit is contained in:
Giuseppe Scrivano
2024-07-11 10:54:27 +02:00
parent bf8c3065f2
commit 61f0230c31

View File

@ -513,6 +513,10 @@ func (p *Pod) podWithContainers(ctx context.Context, containers []*Container, po
for _, ctr := range containers {
if ctr.IsInfra() {
// If there is an user namespace for the infra container, then register it for the entire pod.
if v, found := ctr.config.Spec.Annotations[define.UserNsAnnotation]; found {
podAnnotations[define.UserNsAnnotation] = v
}
_, _, infraDNS, _, err := containerToV1Container(ctx, ctr, getService)
if err != nil {
return nil, err