Search in sources :

Example 1 with V1NFSVolumeSource

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;
}
Also used : V1PersistentVolumeSpec(io.kubernetes.client.openapi.models.V1PersistentVolumeSpec) V1PersistentVolume(io.kubernetes.client.openapi.models.V1PersistentVolume) HashMap(java.util.HashMap) V1ObjectMeta(io.kubernetes.client.openapi.models.V1ObjectMeta) Quantity(io.kubernetes.client.custom.Quantity) V1NFSVolumeSource(io.kubernetes.client.openapi.models.V1NFSVolumeSource)

Aggregations

Quantity (io.kubernetes.client.custom.Quantity)1 V1NFSVolumeSource (io.kubernetes.client.openapi.models.V1NFSVolumeSource)1 V1ObjectMeta (io.kubernetes.client.openapi.models.V1ObjectMeta)1 V1PersistentVolume (io.kubernetes.client.openapi.models.V1PersistentVolume)1 V1PersistentVolumeSpec (io.kubernetes.client.openapi.models.V1PersistentVolumeSpec)1 HashMap (java.util.HashMap)1