Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@haircommander
Copy link
Member

@haircommander haircommander commented May 4, 2021

What type of PR is this?

/kind feature

What this PR does / why we need it:

To match docker behavior, a directory is created when the src of a mount does not exist.

This causes issues when the src should not be a directory (/etc/hostname is a prime example).

Instead of relying on correct user behavior, we should urge them to do the right thing by erroring in this case (if a configured mount source is added but does not exist)

Which issue(s) this PR fixes:

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Add support for `absent_mount_sources_to_reject`, which allows admins to configure paths that, when mounted into a container despite not existing on the host, causes a container creation request to fail. This is useful for paths like `/etc/hostname`, which causes trouble as a directory, but possibly shouldn't be created as a file either (in the case of a dynamic hostname).

@openshift-ci-robot openshift-ci-robot added dco-signoff: yes Indicates the PR's author has DCO signed all their commits. kind/bug Categorizes issue or PR as related to a bug. release-note Denotes a PR that will be considered when it comes time to generate release notes. labels May 4, 2021
@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 4, 2021
@codecov
Copy link

codecov bot commented May 4, 2021

Codecov Report

Merging #4844 (61960b7) into master (1f2639c) will decrease coverage by 0.00%.
The diff coverage is 36.84%.

❗ Current head 61960b7 differs from pull request most recent head 8703525. Consider uploading reports for the commit 8703525 to get more accurate results

@@            Coverage Diff             @@
##           master    #4844      +/-   ##
==========================================
- Coverage   42.98%   42.98%   -0.01%     
==========================================
  Files         107      107              
  Lines        9792     9809      +17     
==========================================
+ Hits         4209     4216       +7     
- Misses       5132     5142      +10     
  Partials      451      451              

@haircommander
Copy link
Member Author

/retest

Copy link
Member

@saschagrunert saschagrunert left a comment

Choose a reason for hiding this comment

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

LGTM

} else if filepath.Clean(src) == "/etc/hostname" {
// special-case /etc/hostname, as we don't want it to be created as a directory
// This can cause issues with node reboot.
return nil, nil, errors.New("Cannot mount /etc/hostname: path does not exist and will cause issues as a directory. Consider mounting /proc/sys/kernel/hostname, or creating a static /etc/hostname")
Copy link
Member

Choose a reason for hiding this comment

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

nit:

Suggested change
return nil, nil, errors.New("Cannot mount /etc/hostname: path does not exist and will cause issues as a directory. Consider mounting /proc/sys/kernel/hostname, or creating a static /etc/hostname")
return nil, nil, errors.New("cannot mount /etc/hostname: path does not exist and will cause issues as a directory. Consider mounting /proc/sys/kernel/hostname, or creating a static /etc/hostname")

@TomSweeneyRedHat
Copy link
Contributor

LGTM

@haircommander haircommander changed the title server: fail if user attempts to mount /etc/hostname, but it does not… add absent_mount_sources_to_reject option May 5, 2021
Copy link
Member

@mrunalp mrunalp left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label May 5, 2021
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: haircommander, mrunalp, saschagrunert

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:
  • OWNERS [haircommander,mrunalp,saschagrunert]

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

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

To match docker behavior, a directory is created when the src of a mount does not exist.

This causes issues when the src should not be a directory (/etc/hostname is a prime example).

Instead of relying on correct user behavior, we should urge them to do the right thing by erroring in this case (if a configured mount source is added but does not exist)

Signed-off-by: Peter Hunt <[email protected]>
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label May 5, 2021
@haircommander
Copy link
Member Author

/retest

@mrunalp
Copy link
Member

mrunalp commented May 5, 2021

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label May 5, 2021
@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

1 similar comment
@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

11 similar comments
@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented May 6, 2021

@haircommander: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/openshift-jenkins/e2e_crun_cgroupv2 8703525 link /test e2e_cgroupv2

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

3 similar comments
@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit 4d40e65 into cri-o:master May 6, 2021
@haircommander
Copy link
Member Author

/cherry-pick release-1.21

@openshift-cherrypick-robot

@haircommander: new pull request created: #4857

Details

In response to this:

/cherry-pick release-1.21

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

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. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants