-
Notifications
You must be signed in to change notification settings - Fork 39.6k
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
proposals: Add Volume Hostpath "type" proposal #34058
proposals: Add Volume Hostpath "type" proposal #34058
Conversation
| `exists` | If nothing exists at the given path, the pod will fail to run and provide an informative error message | | ||
| `file` | If a file does not exist at the given path, the pod will fail to run and provide an informative error message | | ||
| `device` | If a block or character device does not exist at the given path, the pod will fail to run and provide an informative error message | | ||
| `socket` | If a socket does not exist at the given path, the pod will fail to run and provide an informative error message | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I want to share a socket between two containers in the same pod, would I want the same support here for that? Or are we saying emptyDir and intra-pod are less challenged than pod to host?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Within a pod, it's the responsibility of those two processes to synchronize on the socket themselves.
The root problem, of some random directory being created if the socket doesn't exist, doesn't happen in that instance because the containers presumably don't implement docker's logic of "exists || mkdir", and it's well understood that the emptyDir exists as a directory with nothing in it.
intrapod is also less challenging because it isn't implicitly relying on some external state/process existing.
While I propose exposing the same set of possible values for consistency, in reality a `SubPath` is useful primarily under a network mount. Because of this, the `device` and `socket` values would likely not be useful. | ||
|
||
I do not have any examples of concrete examples from the Kubernetes project for this, in part because there are very few examples of `SubPath` to begin with. | ||
However, each of the use-cases described for Host Volumes also could conceivably occur as subdirectories of a network mount using this feature, and thus still offer insight into why it would be of value. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm aware of folks using it to share host NFS mounts in predictable ways across a cluster (I think)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will double check.
|
||
### Containerized Kubelet | ||
|
||
A containerized kubelet would have difficulty creating directories. The implementation will likely respect the `containerized` flag, or similar, allowing it to either break out or be "/rootfs/" aware and thus operate as desired. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Containerized kubelets effectively are required to have access to host rootfs in practice (that's the only variant we support in production at Red Hat), so seems ok.
I added an alternative possible API that reduces it to adding a single @jonboulle, @pmorie, @thockin if any of you have a strong opinion on the above or cycles to review, it would be appreciated! |
Overall, this LGTM! |
@jonboulle I'll edit it in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM overall
conceivably occur as subdirectories of a network mount using this feature, and | ||
thus still offer insight into why it would be of value. | ||
|
||
<!-- uncomment if this comes up :) An argument against providing this feature for SubPaths is that it might not increase correctness as much; while adding such qualifications to Host volumes allows a pod to express a dependency that the node may not meet, adding it to subPath allows the pod to express an assumption about a given filesystem it's mounting. This assumption is not node specific and, when it fails, likely means the given volume was not pre-populated/provisioned appropriately. It's arguable whether this sort of failure is as likely or as important to handle well. --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm inclined to agree - when in doubt, leave it out,
|
||
| Value | Behavior | | ||
|:------|:---------| | ||
| `auto ` | If nothing exists at the given path, an empty directory will be created there. Otherwise, behaves like `exists` | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to handle existing objects which will spontaneously grow this field, with a default value of "". Perhaps "" is how you spell "anything".
Given that, the field might be better named as "require" something, where "" naturally means "nothing" or "no requirements"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I understand. Regarding handling existing objects, above I wrote "If not set, defaults to auto
" which was meant to cover that. auto
is the existing behaviour, so it's backwards compatible for existing objects.
Is having nil == "" == "auto"
a no-no for k8s api?
require
seems clever for the one case of default, but I think I like type
more overall. (hostPath.type = file
vs hostPath.require = file
seems more natural as type
).
Mind clarifying what you meant?
What I meant: "If not set, defaults to auto" means that any object that I still think it might be cleaner to have "" be the default value, rather On Thu, Oct 13, 2016 at 10:37 AM, Euan Kemp notifications@github.com
|
724e9c6
to
7b82846
Compare
This generally LGTM, but I do have one concern that we need to check -- what the SELinux context of artifacts on the host's FS is when containerized Kubelet creates them. |
7b82846
to
75e4be5
Compare
Just squashed, no actual changes.. |
Jenkins verification failed for commit 75e4be59d7cc14b16ebc859c57f6b9ab918686fa. Full PR test history. The magic incantation to run this job again is |
75e4be5
to
a0739bf
Compare
sigh missed a munger lint, no actual changes. |
Automatic merge from submit-queue |
Automatic merge from submit-queue proposals: Add Volume Hostpath "type" proposal This is a continuation of kubernetes#31384. It's related to kubernetes#26816 as well. The discussion in kubernetes#31384 is worth reading and this proposal largely derives from my comments there. cc @thockin @pmorie @saad-ali @kubernetes/sig-storage cc @yujuhong since it talks briefly about kubelet doing more cc @calebamiles I think we might need a "Feature" for this since it's an api change, though a minor one?
Could you please inform if the hostPath type attribute has been added to kubernetes? If so, in which version? |
@prabhakar-pal it has not been implemented yet. |
Damn, I assumed that since we merged this, we must have gotten around to implementing, but I guess not. This would be a GREAT contribution. |
|
||
|Value | Behavior | Reason for exclusion | | ||
|:-----|:---------|:---------------------| | ||
| `new-directory` | Like `auto`, but the given path must be a directory if it exists | `auto` mostly fills this use-case | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auto
is not defined in this document
Automatic merge from submit-queue (batch tested with PRs 51113, 46597, 50397, 51052, 51166) implement proposal 34058: hostPath volume type **What this PR does / why we need it**: implement proposal #34058 **Which issue this PR fixes** : fixes #46549 **Special notes for your reviewer**: cc @thockin @luxas @euank PTAL
This is a continuation of #31384. It's related to #26816 as well.
The discussion in #31384 is worth reading and this proposal largely derives from my comments there.
cc @thockin @pmorie @saad-ali @kubernetes/sig-storage
cc @yujuhong since it talks briefly about kubelet doing more
cc @calebamiles I think we might need a "Feature" for this since it's an api change, though a minor one?
This change is