nicknezis commented on pull request #3725: URL: https://github.com/apache/incubator-heron/pull/3725#issuecomment-962214212
> The reason Spark uses the `Claim Name` of `OnDemand` might be because it generates a PVC name based on the workload's name. If we were to do the same we could potentially get away with cleaning up on demand PVCs without having to update the scheduler. We would need a naming convention: > > ```shell > [Topology Name]-ondemand-[Volume-Name] > ``` > Correct. I think having the naming convention is fair decision because it is auto generated. If the scheduler is configured to cleanup dynamic PVCs, one way we can do this is with the naming convention. > The question then becomes one of how we clean up all of the `OnDemand` claims. You could list the claims and generate a list of the ones with a prefix of `[Topology Name]-ondemand-` and axe them. We need to keep in mind that there may very well be thousands of claims and we cannot request a list by prefix from K8s. > Also we could add k8s labels to the PVCs which allows for a simple query to k8s to retrieve the list of PVCs that match the Selector that we would create. This is an [old version](https://github.com/apache/incubator-heron/blob/fd7fde0518562d60a7a85679715e2b15ee464d37/heron/schedulers/src/java/com/twitter/heron/scheduler/kubernetes/KubernetesCompat.java#L37) of the Heron k8s scheduler that used to delete Pods (before using StatefulSet). Note how we create a Selector that is used in the subsequent delete call. The Selector matched the labels which were on the PodSpec [here](https://github.com/apache/incubator-heron/blob/fd7fde0518562d60a7a85679715e2b15ee464d37/heron/schedulers/src/java/com/twitter/heron/scheduler/kubernetes/AppsV1beta1Controller.java#L286). So if we are making the PVCs, we can add a combination of labels that will be specific enough to not auto-delete other PVCs. Then use these labels to know what to delete. > We may be able to use the `fieldSelector` and `labelSelector` in [`listNamespacedPersistentVolumeClaim`](https://javadoc.io/static/io.kubernetes/client-java-api/11.0.0/io/kubernetes/client/openapi/apis/CoreV1Api.html#listNamespacedPersistentVolumeClaim-java.lang.String-java.lang.String-java.lang.Boolean-java.lang.String-java.lang.String-java.lang.String-java.lang.Integer-java.lang.String-java.lang.String-java.lang.Integer-java.lang.Boolean-) creatively to restrict returned values but we will need to add them to the PVC's on creation. Yup! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
