From eb5f4b2385e7a53ba4cbed01b837170788756fa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20F=20Bj=C3=B6rklund?= Date: Fri, 5 May 2023 12:55:47 +0200 Subject: [PATCH] Set Mount Propagation in ContainerStatus --- core/container_status.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/core/container_status.go b/core/container_status.go index 98a4c4222..3c6cbbe1a 100644 --- a/core/container_status.go +++ b/core/container_status.go @@ -19,6 +19,9 @@ package core import ( "context" "fmt" + + dockermounttypes "github.com/docker/docker/api/types/mount" + "github.com/Mirantis/cri-dockerd/libdocker" "github.com/sirupsen/logrus" v1 "k8s.io/cri-api/pkg/apis/runtime/v1" @@ -61,11 +64,21 @@ func (ds *dockerService) ContainerStatus( for i := range r.Mounts { m := r.Mounts[i] readonly := !m.RW + var propagation v1.MountPropagation + switch m.Propagation { + case dockermounttypes.PropagationPrivate: + propagation = v1.MountPropagation_PROPAGATION_PRIVATE + case dockermounttypes.PropagationRShared: + propagation = v1.MountPropagation_PROPAGATION_BIDIRECTIONAL + case dockermounttypes.PropagationRSlave: + propagation = v1.MountPropagation_PROPAGATION_HOST_TO_CONTAINER + } mounts = append(mounts, &v1.Mount{ HostPath: m.Source, ContainerPath: m.Destination, Readonly: readonly, // Note: Can't set SeLinuxRelabel + Propagation: propagation, }) } // Interpret container states.