Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set Mount Propagation in ContainerStatus #187

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading