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

Allocate PVC by selector #73886

Open
GeorgeLung opened this Issue Feb 10, 2019 · 5 comments

Comments

Projects
None yet
3 participants
@GeorgeLung
Copy link

GeorgeLung commented Feb 10, 2019

What would you like to be added:
The ability to provider a selector for specifying a PersistentVolumeClaim as an alternative to claimName like below:

    apiVersion: apps/v1
    kind: StatefulSet
    metadata:
      name: example-statefulset
      namespace: eap
    spec:
      replicas: 3
      template:
        metadata:
          labels:
            app: example-pod
        spec:
          containers:
          - name: example
            image: ...
            volumeMounts:
            - name: logs-dir
               mountPath: /var/log/container_logs
            volumes:
            - name: logsdir
               persistentVolumeClaim:
                selector:
                  matchLabels:
                     volume-type: logs

Why is this needed:
Example use case is mounting a local volume within multiple pods. Currently I have to create one PVC per node and reference this directly per node in each pod/template. This suggestion would enable pods/templates to be dynamically scheduled taking into account the availability of the PVCs.

@GeorgeLung

This comment has been minimized.

Copy link
Author

GeorgeLung commented Feb 10, 2019

@kubernetes/sig-storage-feature-requests

@k8s-ci-robot k8s-ci-robot added sig/storage and removed needs-sig labels Feb 10, 2019

@k8s-ci-robot

This comment has been minimized.

Copy link
Contributor

k8s-ci-robot commented Feb 10, 2019

@GeorgeLung: Reiterating the mentions to trigger a notification:
@kubernetes/sig-storage-feature-requests

In response to this:

@kubernetes/sig-storage-feature-requests

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.

@msau42

This comment has been minimized.

Copy link
Member

msau42 commented Feb 12, 2019

Hi @GeorgeLung can you explain in more detail why you need to manually create a pvc per node? A local PV already has the node affinity built-in, so the PVC created by the statefulset will only bind to PVs that are available.

Or are you trying to share the same PVC across multiple statefulsets?

@GeorgeLung

This comment has been minimized.

Copy link
Author

GeorgeLung commented Feb 12, 2019

@msau42

Or are you trying to share the same PVC across multiple statefulsets?

That's exactly it. From what I've read the PVC - PV binding is a one-to-one mapping and therefore to share a PV I have to share the PVC bound to it.

@msau42

This comment has been minimized.

Copy link
Member

msau42 commented Feb 12, 2019

Hm I think the challenge would be how to spread the pvcs so that they are not all selected. Is this something that could be handled by a webhook that can choose and then inject the PVC into the pod?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment