use of io.kubernetes.client.openapi.models.V1NFSVolumeSource in project twister2 by DSC-SPIDAL.
the class RequestObjectBuilder method createPersistentVolumeObject.
/**
* we initially used this method to create PersistentVolumes
* we no longer use this method
* it is just here in case we may need it for some reason at one point
*/
public static V1PersistentVolume createPersistentVolumeObject(String pvName) {
V1PersistentVolume pv = new V1PersistentVolume();
pv.setApiVersion("v1");
// set pv name
V1ObjectMeta meta = new V1ObjectMeta();
meta.setName(pvName);
pv.setMetadata(meta);
// double volumeSize = SchedulerContext.persistentVolumeTotal(config);
V1PersistentVolumeSpec pvSpec = new V1PersistentVolumeSpec();
HashMap<String, Quantity> capacity = new HashMap<>();
// capacity.put("storage", new Quantity(volumeSize + "Gi"));
pvSpec.setCapacity(capacity);
String storageClass = KubernetesContext.persistentStorageClass(config);
String accessMode = KubernetesContext.storageAccessMode(config);
// String reclaimPolicy = KubernetesContext.storageReclaimPolicy(config);
pvSpec.setStorageClassName(storageClass);
pvSpec.setAccessModes(Arrays.asList(accessMode));
// pvSpec.setPersistentVolumeReclaimPolicy(reclaimPolicy);
// pvSpec.setMountOptions(Arrays.asList("hard", "nfsvers=4.1"));
V1NFSVolumeSource nfsVolumeSource = new V1NFSVolumeSource();
nfsVolumeSource.setServer(SchedulerContext.nfsServerAddress(config));
nfsVolumeSource.setPath(SchedulerContext.nfsServerPath(config));
pvSpec.setNfs(nfsVolumeSource);
pv.setSpec(pvSpec);
return pv;
}
Aggregations