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 19, 2023
1 parent 52b3182 commit dafa44d
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.PropagationRPrivate:
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 dafa44d

Please sign in to comment.