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

add support for subpath in play kube for named volumes #16803

Merged
merged 1 commit into from
Dec 12, 2022

Conversation

cdoern
Copy link
Contributor

@cdoern cdoern commented Dec 9, 2022

subpath allows for only a subdirecty of a volumes data to be mounted in the container add support for the named volume type sub path with others to follow.

resolves #12929

Signed-off-by: Charlie Doern [email protected]

Does this PR introduce a user-facing change?

add the ability to specify a volume subpath when using named volumes in podman play kube

@cdoern cdoern force-pushed the subpath branch 2 times, most recently from 2b098ca to eade91e Compare December 9, 2022 22:24
@rhatdan
Copy link
Member

rhatdan commented Dec 10, 2022

@vrothberg @umohnani8 @mheon PTAL

Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

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

LGTM
@umohnani8 @ygalblum PTAL

libpod/container_internal.go Outdated Show resolved Hide resolved
pkg/domain/infra/abi/play.go Outdated Show resolved Hide resolved
@@ -254,6 +254,8 @@ type ContainerNamedVolume struct {
// IsAnonymous sets the named volume as anonymous even if it has a name
// This is used for emptyDir volumes from a kube yaml
IsAnonymous bool `json:"setAnonymous,omitempty"`
// SubPath determines which part of the Source will be mounted in the container
SubPath string
Copy link
Member

Choose a reason for hiding this comment

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

Does this need to be stored? Or is this only in effect for the length of the kube play? Not sure this needs to be plumbed this deeply?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it does since in generateSpec (which play kube eventually calls) we use ContainerNamedVolume to generate the mountpoint and we need to subpath to get the source properly.

Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we just put the full path (path + subpath) into the named volume as Path?

Copy link
Member

Choose a reason for hiding this comment

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

Oh, wait, I see the problem there, different containers will want to index into the volume at different places.

subpath allows for only a subdirecty of a volumes data to be mounted in the container
add support for the named volume type sub path with others to follow.

resolves containers#12929

Signed-off-by: Charlie Doern <[email protected]>
- sleep
- inf
volumeMounts:
- mountPath: /var
Copy link
Member

Choose a reason for hiding this comment

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

Does this work with other types of volume mount? HostPath for example?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not in this PR, probably won't be too hard though. I think I just need to edit all of the appropriate specgen structs.

@mheon
Copy link
Member

mheon commented Dec 12, 2022

Should we expose Subpath via -v? Doesn't seem like a bad change.

@cdoern
Copy link
Contributor Author

cdoern commented Dec 12, 2022

Should we expose Subpath via -v? Doesn't seem like a bad change.

I agree, but should it be a separate PR?

@mheon
Copy link
Member

mheon commented Dec 12, 2022

OK, separate PR is fine. Maybe make a GH issue so we don't forget about it?

Code LGTM

@mheon
Copy link
Member

mheon commented Dec 12, 2022

/hold
/lgtm
/approve

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 12, 2022
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Dec 12, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Dec 12, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cdoern, mheon

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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Dec 12, 2022
@umohnani8
Copy link
Member

LGTM
/hold cancel

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 12, 2022
@openshift-merge-robot openshift-merge-robot merged commit 0037bff into containers:main Dec 12, 2022
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 18, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. release-note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support volumeMounts.subPath in podman kube play
6 participants