You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@heron.apache.org by sa...@apache.org on 2022/05/02 19:40:22 UTC
[incubator-heron] branch saadurrahman/3821-Remove-Deprecated-Volumes-K8s-dev updated: [K8s] using Volume Factory to generate PVC.
This is an automated email from the ASF dual-hosted git repository.
saadurrahman pushed a commit to branch saadurrahman/3821-Remove-Deprecated-Volumes-K8s-dev
in repository https://gitbox.apache.org/repos/asf/incubator-heron.git
The following commit(s) were added to refs/heads/saadurrahman/3821-Remove-Deprecated-Volumes-K8s-dev by this push:
new 3875c319dec [K8s] using Volume Factory to generate PVC.
3875c319dec is described below
commit 3875c319decd4c44894dfdce3e8fca6c812bd14e
Author: Saad Ur Rahman <sa...@apache.org>
AuthorDate: Mon May 2 15:40:14 2022 -0400
[K8s] using Volume Factory to generate PVC.
---
.../heron/scheduler/kubernetes/V1Controller.java | 38 ++--------------------
1 file changed, 3 insertions(+), 35 deletions(-)
diff --git a/heron/schedulers/src/java/org/apache/heron/scheduler/kubernetes/V1Controller.java b/heron/schedulers/src/java/org/apache/heron/scheduler/kubernetes/V1Controller.java
index 7812ed6aae9..36ba343ac87 100644
--- a/heron/schedulers/src/java/org/apache/heron/scheduler/kubernetes/V1Controller.java
+++ b/heron/schedulers/src/java/org/apache/heron/scheduler/kubernetes/V1Controller.java
@@ -1120,41 +1120,9 @@ public class V1Controller extends KubernetesController {
continue;
}
- V1PersistentVolumeClaim claim = new V1PersistentVolumeClaimBuilder()
- .withNewMetadata()
- .withName(pvc.getKey())
- .withLabels(getPersistentVolumeClaimLabels(getTopologyName()))
- .endMetadata()
- .withNewSpec()
- .withStorageClassName("")
- .endSpec()
- .build();
-
- // Populate PVC options.
- for (Map.Entry<KubernetesConstants.VolumeConfigKeys, String> option
- : pvc.getValue().entrySet()) {
- String optionValue = option.getValue();
- switch(option.getKey()) {
- case storageClassName:
- claim.getSpec().setStorageClassName(optionValue);
- break;
- case sizeLimit:
- claim.getSpec().setResources(
- new V1ResourceRequirements()
- .putRequestsItem("storage", new Quantity(optionValue)));
- break;
- case accessModes:
- claim.getSpec().setAccessModes(Arrays.asList(optionValue.split(",")));
- break;
- case volumeMode:
- claim.getSpec().setVolumeMode(optionValue);
- break;
- // Valid ignored options not used in a PVC.
- default:
- break;
- }
- }
- listOfPVCs.add(claim);
+ listOfPVCs.add(Volumes.get()
+ .createPersistentVolumeClaim(pvc.getKey(),
+ getPersistentVolumeClaimLabels(getTopologyName()), pvc.getValue()));
}
return listOfPVCs;
}