Skip to content

Commit

Permalink
Set Mount Propagation in ContainerStatus
Browse files Browse the repository at this point in the history
  • Loading branch information
afbjorklund committed Dec 22, 2023
1 parent c50b98d commit 3c5e5c5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions core/container_status.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 3c5e5c5

Please sign in to comment.