-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Pod Volumes Support #11409
Pod Volumes Support #11409
Conversation
03fe99e
to
47f5dd0
Compare
@mheon PTAL, not sure if I missed anything here. |
LGTM |
LGTM |
2bf1147
to
1ebe26e
Compare
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.
Instead of command line i think more apt would be to add support volumeMount
as kube spec, not sure but i think test should suffice mounting named volume
or emptydir since that is how I think pod volume should work. This should be the required use-case of shared volume between pod containers.
[Please ignore this comment if that was not intention of the issue]
apiVersion: v1
kind: Pod
metadata:
name: two-containers
spec:
volumes:
- name: shared-data
emptyDir: {}
containers:
- name: first
image: nginx
volumeMounts:
- name: shared-data
mountPath: /usr/share/nginx/html
- name: second
image: debian
volumeMounts:
- name: shared-data
mountPath: /pod-data
command: ["/bin/sh"]
args:
- "-c"
- >
while true; do
date >> /pod-data/index.html;
echo Hello from the second container >> /pod-data/index.html;
sleep 1;
done
@flouthoc this issue (I believe) is requesting a podman pod create option for volumes. The Kubernetes side of things already supports such a feature via the YAML. |
added support for the --volume flag in pods using the new infra container design. users can specify all volume options they can with regular containers resolves containers#10379 Signed-off-by: cdoern <cdoern@redhat.com>
@cdoern I tried a while ago afaik emptydir sharing between containers is not supported but i can confirm again. |
@mheon @TomSweeneyRedHat PTAL, I think I moved up the decoding to a good spot, podspec now matches container spec in terms of volume information. |
LGTM |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cdoern, rhatdan 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 |
Wait - scratch that for a moment. Are we not recording named volumes in the infra config? |
@@ -597,6 +598,11 @@ func (p *Pod) Inspect() (*define.InspectPodData, error) { | |||
infraConfig.CPUSetCPUs = p.ResourceLim().CPU.Cpus | |||
infraConfig.PidNS = p.PidMode() | |||
infraConfig.UserNS = p.UserNSMode() | |||
namedVolumes, mounts := infra.sortUserVolumes(infra.Config().Spec) |
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.
This is wrong - named volumes are a separate field in the infra container's config, they are not in the spec
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.
see comment below
Nevermind, fire drill averted. They're stored correctly but we're retrieving from for |
@mheon, want to remove the "hold" on this given the fire drill findings and the happy green test buttons? |
wait @mheon I am pretty sure
|
It adds the additional specifications that all volumes listed must be user-specified, which is probably OK. /hold cancel |
Correcte me if I am wrong, so can we use eg: - mountPath: xx
name: xx
mountPropagation: HostToContainer Tested with podman 3.3.1/4.0.0-dev(with this pr merged), after |
May not be supported, but should be easy to add. Please open a new issue. |
I was wrong, according to this func. just add a |
added support for the --volume flag in pods using the new infra container design.
users can specify all volume options they can with regular containers.
Specifying the
--volume
flag causes the infra container to be populated with the specified mounts. All containers joining the pod then have aVolumesFrom
container, causing them to inherit the mounts.resolves #10379
Signed-off-by: cdoern cdoern@redhat.com