Skip to content

add current PD description as disk labels #1064

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

Closed
bogaertg opened this issue Oct 6, 2022 · 14 comments · Fixed by #1090
Closed

add current PD description as disk labels #1064

bogaertg opened this issue Oct 6, 2022 · 14 comments · Fixed by #1090

Comments

@bogaertg
Copy link

bogaertg commented Oct 6, 2022

Hi,

Currently i have persistent disk created from a persitentVolumeClaims (GKE) and i want to monitor disks performance.
I need to filter disks by (pvc name, namespace) but this informations is store in disk description and i'm not able to use this fied in Cloud monitoring 😞 .

Is it possible to add this information as disks labels in addition to description ?

Regards,
Gaetan

@mattcary
Copy link
Contributor

mattcary commented Oct 6, 2022

Thanks for the issue, this has been on our backlog and I appreciate the ping to bump up its priority.

@bogaertg
Copy link
Author

bogaertg commented Oct 7, 2022

Thank for your quick answer, can you give me a link to your card in backlog ?

@mattcary
Copy link
Contributor

(sorry for the delay, this got buried) We have an internal bug list at Google, it's not public, sorry.

@vizeit
Copy link

vizeit commented Nov 16, 2022

Can the custom labels applied to a PVC be propagated to the PD? In my use case, I am creating a PVC dynamically for a pod with a custom label for that execution. However, the custom label never gets applied to the PV or PD. The description of the PD has bunch of details including the PVC & PV name and the fix for this issue will help to have additional labels in the PD. But, it will be great to have any custom label applied to PVC be applied to the PV-PD during dynamic provisioning. Could you please review?

@mattcary
Copy link
Contributor

Propagating PVC labels is surprisingly complex, as it would cross the k8s-csi API boundary. At first glance it would require us creating a new PD specific controller to watch for PVC mutations and update PD labels. Hence I think it's infeasible unless we have a large volumes of requests for this.

@vizeit
Copy link

vizeit commented Nov 16, 2022

@mattcary thank you for your quick reply. The PD description is able to capture the PVC name, the PV name, the PVC namespace, etc. Which means, if I am not wrong, that the PD probably also has any labels from PVC at the time of creation. Wouldn’t it be possible to capture the PVC labels in the PD description with other existing details and then with this original issue fix apply it to the PD labels at the time of creation? Please let me know

@mattcary
Copy link
Contributor

See https://github.com/kubernetes-csi/external-provisioner/blob/master/pkg/controller/controller.go#L624 for details of how the create volume request is made; note this controller is not GCE PD-specific.

@vizeit
Copy link

vizeit commented Nov 16, 2022

I see that the logic at this line is probably adding the request parameters that finally go into the PD description,
https://github.com/kubernetes-csi/external-provisioner/blob/626053a0d298a5c58eb91bbe46d856fc167cb065/pkg/controller/controller.go#L718

This logic is using meta functions GetName and GetNamespace and there is GetLabels meta function that can be added to the request parameter to add labels to the PD description and eventually add to the PD labels from the description?
https://github.com/kubernetes-csi/external-provisioner/blob/626053a0d298a5c58eb91bbe46d856fc167cb065/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/meta.go#L163

Also, in my understanding, when I create PVC with labels, the labels will be part of ObjectMeta
https://github.com/kubernetes-csi/external-provisioner/blob/626053a0d298a5c58eb91bbe46d856fc167cb065/vendor/k8s.io/api/core/v1/types.go#L439

https://github.com/kubernetes-csi/external-provisioner/blob/626053a0d298a5c58eb91bbe46d856fc167cb065/vendor/k8s.io/apimachinery/pkg/apis/meta/v1/types.go#L223

Do you see it possible? Please let me know

@mattcary
Copy link
Contributor

Note all of those references are in the external-provisioner, which is a general CSI service that's not PD specific. So any changes made there would affect all CSI drivers, not just PDCSI. We'd have to make sure that any changes made sense for all drivers. It might be best to start a discussion on that external-provisioner repo; if there was a general mechanism for having annotations appear as volume parameters then PD CSI could take advantage of it.

@vizeit
Copy link

vizeit commented Nov 18, 2022

I have created an issue under the external-provisioner repo,

kubernetes-csi/external-provisioner#819

@mattcary
Copy link
Contributor

Thanks!

@mattcary
Copy link
Contributor

/reopen

(the original question of the pd description appearing as labels is still open & being worked on, sorry for the confusion).

@Sneha-at
Copy link
Contributor

Sneha-at commented Apr 5, 2023

/reopen
@bogaertg The length restriction for PVC/PV labels is 254 while that for labels is 63. This is causing some troubles while creating PVCs with long names. We can still add the namespace as a label to the disk but will not be able to add PVC and PV names. Does this satisfy your requirement? Another alternative is to drop labels for lengthy PVC/PVs (might create some confusion)

@bogaertg
Copy link
Author

Hi,

Thanks for your reply.
I like the idea of dropping labels if necessary. In understand it may create some confusion but i prefer a shorter information than no information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants