Skip to content

Conversation

@AkihiroSuda
Copy link
Member

The current CRI implementations treat PROPAGATION_PRIVATE as "rprivate", not "private":

However, this is not always true for cri-dockerd, which treats PROPAGATION_PRIVATE as noop and lets dockerd use its default propagation mode:

dockerd's default propagation mode is "rprivate" for most cases, but dockerd changes its default propagation mode to "rslave" when the mount source contains the daemon root (/var/lib/docker):

This behavior was introduced in Docker 18.03 (moby/moby#36055).

Related:


What type of PR is this?

/kind documentation

What this PR does / why we need it:

Fix a comment line about PROPAGATION_PRIVATE because it is inaccurate.

Which issue(s) this PR fixes:

NONE

Special notes for your reviewer:

NONE

Does this PR introduce a user-facing change?

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

A manifest to verify the behavior:

---
apiVersion: v1
kind: Pod
metadata:
  name: propagation-test1
spec:
  containers:
    - name: sleep
      image: busybox
      command: ['sleep', 'infinity']
      volumeMounts:
        - mountPath: /mnt
          name: mnt
          mountPropagation: None
          # The mount propagation `None` is translated to:
          # - cri-dockerd v0.3.0, with Docker v20.10.23: rprivate
          # - containerd v1.6.15: rprivate
          # - CRI-O v1.24.1: rprivate
  volumes:
    - name: mnt
      hostPath:
        path: /mnt
---
apiVersion: v1
kind: Pod
metadata:
  name: propagation-test2
spec:
  containers:
    - name: sleep
      image: busybox
      command: ['sleep', 'infinity']
      volumeMounts:
        - mountPath: /mnt
          name: mnt
          mountPropagation: None
          # The mount propagation `None` is translated to:
          # - cri-dockerd v0.3.0, with Docker v20.10.23: rslave
          # - containerd v1.6.15: rprivate
          # - CRI-O v1.24.1: rprivate
          #
          # Docker changes the default propagation to "rslave",
          # because the mount source (`/`) contains `/var/lib/docker`.
          # - https://github.com/moby/moby/blob/v20.10.23/daemon/volumes.go#L137-L143
          # - https://github.com/moby/moby/blob/v20.10.23/daemon/volumes_linux.go#L11-L36
          #
          # This behavior was introduced in Docker 18.03: https://github.com/moby/moby/pull/36055
          #
          # containerd and CRI-O do not automatically change the propagation:
          # - https://github.com/containerd/containerd/blob/v1.6.15/pkg/cri/opts/spec_linux.go#L181
          # - https://github.com/cri-o/cri-o/blob/v1.24.1/server/container_create_linux.go#L967
  volumes:
    - name: mnt
      hostPath:
        path: /

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. kind/documentation Categorizes issue or PR as related to documentation. do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Feb 11, 2023
@k8s-ci-robot k8s-ci-robot added area/kubelet sig/node Categorizes an issue or PR as relevant to SIG Node. and removed do-not-merge/needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels Feb 11, 2023
@pacoxu
Copy link
Member

pacoxu commented Feb 13, 2023

/lgtm
/priority important-longterm
/triage accepted
/assign @mrunalp @SergeyKanzhelev

@k8s-ci-robot k8s-ci-robot added the priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. label Feb 13, 2023
@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-priority Indicates a PR lacks a `priority/foo` label and requires one. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Feb 13, 2023
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 13, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

DetailsGit tree hash: 5b8c1c8a52870e291470d37cb23b675afd59f163

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if other runtimes will have the same problem if attempt to mount their root directories or some other relevant directories that are used to run container. I wonder if this comment can be generalized once fixed for other runtimes...

@mikebrow @mrunalp

Copy link
Member Author

@AkihiroSuda AkihiroSuda Feb 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd argue that cri-dockerd's behavior is wrong and insecure (but unfixable for compatibility sake).

It should have just raised an explicit error when the requested propagation ("None" in the yaml) is not applicable, as falling back to "HostToContainer" (aka "rslave") may result in leaking unexpected data to the container, etc.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

containerd, CRI-O, etc. may print a warning when the mount source contains the CRI daemon root, but changing the propagation is insecure as explained above, and raising an error will break compatibility.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the PR to clarify the expected behavior

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Feb 14, 2023
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: appicable/applicable?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

Copy link
Member

@derekwaynecarr derekwaynecarr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please see suggestion, thanks!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the desire in the API comment change to say that its ok for cri providers to warn/error?

I would expect the CRI provider to publish its known issues separate from API definition. Can we remove the cri-dockerd notice as a result?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree the cri-dockerd issue is probably better placed in user facing .. provider specific docs...

s/An implementation/A runtime/

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed cri-dockerd notice

The current CRI implementations treat `PROPAGATION_PRIVATE` as "rprivate", not "private":
- https://github.com/containerd/containerd/blob/v1.6.16/pkg/cri/opts/spec_linux.go#L181
- https://github.com/cri-o/cri-o/blob/v1.26.1/server/container_create_linux.go#L982

However, this is not always true for cri-dockerd, which treats `PROPAGATION_PRIVATE` as
noop and lets dockerd use its default propagation mode:
- https://github.com/Mirantis/cri-dockerd/blob/v0.3.1/libdocker/helpers.go#L235-L236
  (The "private is default" comment in L236 is inaccurate)

dockerd's default propagation mode is "rprivate" for most cases, but dockerd changes
its default propagation mode to "rslave" when the mount source contains the daemon root
(`/var/lib/docker`):
- https://github.com/moby/moby/blob/v20.10.23/volume/mounts/linux_parser.go#L145
- https://github.com/moby/moby/blob/v20.10.23/daemon/volumes.go#L137-L143
- https://github.com/moby/moby/blob/v20.10.23/daemon/volumes_linux.go#L11-L36

This behavior was introduced in Docker 18.03 (moby/moby PR 36055).

Related:
- kubernetes/website PR 39385
- Mirantis/cri-dockerd PR 159

Signed-off-by: Akihiro Suda <[email protected]>
@k8s-ci-robot k8s-ci-robot removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. lgtm "Looks good to me", indicates that a PR is ready to be merged. labels Mar 22, 2023
@k8s-ci-robot k8s-ci-robot requested a review from pacoxu March 22, 2023 12:38
@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Mar 22, 2023
@AkihiroSuda AkihiroSuda requested review from derekwaynecarr and removed request for SergeyKanzhelev, bobbypage, mrunalp, odinuge and pacoxu March 30, 2023 06:00
@AkihiroSuda
Copy link
Member Author

@derekwaynecarr PTAL

Copy link
Contributor

@marquiz marquiz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 12, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

DetailsGit tree hash: e0eb4cc23988aa3a5496235fc35d05f51ea6a10e

@samuelkarp
Copy link
Member

LGTM

Copy link
Member

@mikebrow mikebrow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@pacoxu
Copy link
Member

pacoxu commented Apr 25, 2023

Ping @mrunalp @dchen1107 @derekwaynecarr

@AkihiroSuda
Copy link
Member Author

@derekwaynecarr PTAL

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: AkihiroSuda, mrunalp, pacoxu, saschagrunert, SergeyKanzhelev

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 9, 2023
@k8s-triage-robot
Copy link

The Kubernetes project has merge-blocking tests that are currently too flaky to consistently pass.

This bot retests PRs for certain kubernetes repos according to the following rules:

  • The PR does have any do-not-merge/* labels
  • The PR does not have the needs-ok-to-test label
  • The PR is mergeable (does not have a needs-rebase label)
  • The PR is approved (has cncf-cla: yes, lgtm, approved labels)
  • The PR is failing tests required for merge

You can:

/retest

1 similar comment
@k8s-triage-robot
Copy link

The Kubernetes project has merge-blocking tests that are currently too flaky to consistently pass.

This bot retests PRs for certain kubernetes repos according to the following rules:

  • The PR does have any do-not-merge/* labels
  • The PR does not have the needs-ok-to-test label
  • The PR is mergeable (does not have a needs-rebase label)
  • The PR is approved (has cncf-cla: yes, lgtm, approved labels)
  • The PR is failing tests required for merge

You can:

/retest

@k8s-ci-robot k8s-ci-robot merged commit 4c45313 into kubernetes:master May 9, 2023
@k8s-ci-robot k8s-ci-robot added this to the v1.28 milestone May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/kubelet cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/documentation Categorizes issue or PR as related to documentation. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/important-longterm Important over the long term, but may not be staffed and/or may need multiple releases to complete. release-note-none Denotes a PR that doesn't merit a release note. sig/node Categorizes an issue or PR as relevant to SIG Node. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Projects

Development

Successfully merging this pull request may close these issues.