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

Enable Mount Propagation as a Optional Feature #15758

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

elijah-rou
Copy link

Proposal: Feature-Gated Mount Propagation

At my org we use the JuiceFS filesystem internally, accessed through PVCs. In order to recover the mount point in case of a network drop, it is required that the pod set mountPropagation to HostToContainer or Bidirectional for the volumeMount to facilitate this functionality. Currently, Knative does not allow mountPropagation to be used. Since it's a feature that should have care when using, this proposal is to to add the ability to use Mount Propagation gated under an optional feature the user will have to enable explicitly. I have implemented this internally already, but think this could be useful to the broader community.

Add the ability to use mountPropagation for volumeMounts, gated under kubernetes.podspec-mount-propagation

Copy link

linux-foundation-easycla bot commented Feb 7, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

  • ✅ login: elijah-rou / name: Elijah Roussos (100ade5)

@knative-prow knative-prow bot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Feb 7, 2025
Copy link

knative-prow bot commented Feb 7, 2025

Welcome @elijah-rou! It looks like this is your first PR to knative/serving 🎉

Copy link

knative-prow bot commented Feb 7, 2025

Hi @elijah-rou. Thanks for your PR.

I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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-sigs/prow repository.

@knative-prow knative-prow bot requested review from dprotaso and skonto February 7, 2025 19:46
@dprotaso
Copy link
Member

dprotaso commented Feb 9, 2025

/ok-to-test

@knative-prow knative-prow bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 9, 2025
@dprotaso
Copy link
Member

dprotaso commented Feb 9, 2025

/lgtm
/approve

thanks for the change!

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Feb 9, 2025
Copy link

knative-prow bot commented Feb 9, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dprotaso, elijah-rou

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

The pull request process is described here

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

@knative-prow knative-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 9, 2025
@dprotaso
Copy link
Member

dprotaso commented Feb 9, 2025

please take a look at the unit test failure

@skonto
Copy link
Contributor

skonto commented Feb 10, 2025

In pkg/reconciler/route/resources/service_test.go pls add the corresponding flag.

@skonto
Copy link
Contributor

skonto commented Feb 10, 2025

As in #15669 pls add the right validation for this new flag. Also pls you will need to create some docs in knative/docs repo.

@skonto
Copy link
Contributor

skonto commented Feb 10, 2025

/hold

@knative-prow knative-prow bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 10, 2025
@elijah-rou
Copy link
Author

Will fix everything today :) docs PR will probably only come tomorrow

@elijah-rou
Copy link
Author

As in #15669 pls add the right validation for this new flag. Also pls you will need to create some docs in knative/docs repo.

Mostly done. Just one comment with this. What validation needs to be done? I don't believe there are specific restrictions using mountPropagation beyond specifying an appropriate mode (None, HostToContainer, Bidirectional), validation which should be taken care of by K8s

@elijah-rou elijah-rou force-pushed the feat/enable-mount-propagation branch from 0e846e1 to e943d8a Compare February 12, 2025 02:18
@knative-prow knative-prow bot removed the lgtm Indicates that a PR is ready to be merged. label Feb 12, 2025
Copy link

knative-prow bot commented Feb 12, 2025

New changes are detected. LGTM label has been removed.

@knative-prow knative-prow bot removed the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Feb 12, 2025
@knative-prow knative-prow bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Feb 12, 2025
run update schema

add units

remove useless val tests
@elijah-rou elijah-rou force-pushed the feat/enable-mount-propagation branch from e943d8a to 100ade5 Compare February 12, 2025 02:22
Copy link

knative-prow bot commented Feb 12, 2025

@elijah-rou: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
unit-tests_serving_main 100ade5 link true /test unit-tests
upgrade-tests_serving_main 100ade5 link true /test upgrade-tests
istio-latest-no-mesh_serving_main 100ade5 link true /test istio-latest-no-mesh

Your PR dashboard.

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-sigs/prow repository. I understand the commands that are listed here.

@skonto
Copy link
Contributor

skonto commented Feb 12, 2025

What validation needs to be done?

Fail when user uses the feature but the flag is disabled, for example for the hostPath we have:

	if volume.HostPath != nil && features.PodSpecVolumesHostPath != config.Enabled {
		errs = errs.Also(&apis.FieldError{Message: fmt.Sprintf("HostPath volume support is disabled, "+
			"but found HostPath volume %s", volume.Name)})
	}

There is more to it in the link.

@skonto
Copy link
Contributor

skonto commented Feb 12, 2025

I don't believe there are specific restrictions using mountPropagation beyond specifying an appropriate mode (None, HostToContainer, Bidirectional), validation which should be taken care of by K8s

There are actually see here, especially if we want to fail fast:


	if *mountPropagation == core.MountPropagationBidirectional && !privileged {
		allErrs = append(allErrs, field.Forbidden(fldPath, "Bidirectional mount propagation is available only to privileged containers"))
	}

...

if we add support for some other  flags there are more restrictions:

	case core.RecursiveReadOnlyEnabled, core.RecursiveReadOnlyIfPossible:
....
		if mount.MountPropagation != nil && *mount.MountPropagation != core.MountPropagationNone {
			allErrs = append(allErrs, field.Forbidden(fldPath, "may only be specified when mountPropagation is None or not specified"))
		}

@elijah-rou
Copy link
Author

I don't believe there are specific restrictions using mountPropagation beyond specifying an appropriate mode (None, HostToContainer, Bidirectional), validation which should be taken care of by K8s

There are actually see here, especially if we want to fail fast:


	if *mountPropagation == core.MountPropagationBidirectional && !privileged {
		allErrs = append(allErrs, field.Forbidden(fldPath, "Bidirectional mount propagation is available only to privileged containers"))
	}

...

if we add support for some other  flags there are more restrictions:

	case core.RecursiveReadOnlyEnabled, core.RecursiveReadOnlyIfPossible:
....
		if mount.MountPropagation != nil && *mount.MountPropagation != core.MountPropagationNone {
			allErrs = append(allErrs, field.Forbidden(fldPath, "may only be specified when mountPropagation is None or not specified"))
		}

Sorry, didn't realise about the privileged field. Will do it.

What validation needs to be done?

Fail when user uses the feature but the flag is disabled, for example for the hostPath we have:

	if volume.HostPath != nil && features.PodSpecVolumesHostPath != config.Enabled {
		errs = errs.Also(&apis.FieldError{Message: fmt.Sprintf("HostPath volume support is disabled, "+
			"but found HostPath volume %s", volume.Name)})
	}

There is more to it in the link.

Sure I'll get this done as well.

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. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants