use of io.kubernetes.client.models.V1EmptyDirVolumeSource in project twister2 by DSC-SPIDAL.
the class KubernetesUtils method constructPodTemplate.
public static V1PodTemplateSpec constructPodTemplate(ResourceContainer reqContainer, String serviceLabel, long jobFileSize, Config config) {
V1PodTemplateSpec template = new V1PodTemplateSpec();
V1ObjectMeta templateMetaData = new V1ObjectMeta();
HashMap<String, String> labels = new HashMap<String, String>();
labels.put("app", serviceLabel);
templateMetaData.setLabels(labels);
template.setMetadata(templateMetaData);
V1PodSpec podSpec = new V1PodSpec();
podSpec.setTerminationGracePeriodSeconds(0L);
V1Volume volume = new V1Volume();
volume.setName(POD_SHARED_VOLUME_NAME);
V1EmptyDirVolumeSource volumeSource = new V1EmptyDirVolumeSource();
volumeSource.setMedium("Memory");
volume.setEmptyDir(volumeSource);
podSpec.setVolumes(Arrays.asList(volume));
int containersPerPod = KubernetesContext.containersPerPod(config);
int basePort = KubernetesContext.workerBasePort(config);
ArrayList<V1Container> containers = new ArrayList<V1Container>();
for (int i = 0; i < containersPerPod; i++) {
containers.add(constructContainer(i, reqContainer, jobFileSize, basePort + 1, config));
}
podSpec.setContainers(containers);
template.setSpec(podSpec);
return template;
}
Aggregations