io.kubernetes.client.openapi.models.V1VolumeMount Java Examples

The following examples show how to use io.kubernetes.client.openapi.models.V1VolumeMount. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: V1alpha1PodPresetSpec.java    From java with Apache License 2.0 5 votes vote down vote up
public V1alpha1PodPresetSpec addVolumeMountsItem(V1VolumeMount volumeMountsItem) {
  if (this.volumeMounts == null) {
    this.volumeMounts = new ArrayList<V1VolumeMount>();
  }
  this.volumeMounts.add(volumeMountsItem);
  return this;
}
 
Example #2
Source File: V1alpha1PodPresetSpec.java    From java with Apache License 2.0 5 votes vote down vote up
/**
 * VolumeMounts defines the collection of VolumeMount to inject into containers.
 * @return volumeMounts
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "VolumeMounts defines the collection of VolumeMount to inject into containers.")

public List<V1VolumeMount> getVolumeMounts() {
  return volumeMounts;
}
 
Example #3
Source File: V1EphemeralContainer.java    From java with Apache License 2.0 5 votes vote down vote up
public V1EphemeralContainer addVolumeMountsItem(V1VolumeMount volumeMountsItem) {
  if (this.volumeMounts == null) {
    this.volumeMounts = new ArrayList<V1VolumeMount>();
  }
  this.volumeMounts.add(volumeMountsItem);
  return this;
}
 
Example #4
Source File: V1EphemeralContainer.java    From java with Apache License 2.0 5 votes vote down vote up
/**
 * Pod volumes to mount into the container&#39;s filesystem. Cannot be updated.
 * @return volumeMounts
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "Pod volumes to mount into the container's filesystem. Cannot be updated.")

public List<V1VolumeMount> getVolumeMounts() {
  return volumeMounts;
}
 
Example #5
Source File: V1Container.java    From java with Apache License 2.0 5 votes vote down vote up
public V1Container addVolumeMountsItem(V1VolumeMount volumeMountsItem) {
  if (this.volumeMounts == null) {
    this.volumeMounts = new ArrayList<V1VolumeMount>();
  }
  this.volumeMounts.add(volumeMountsItem);
  return this;
}
 
Example #6
Source File: V1Container.java    From java with Apache License 2.0 5 votes vote down vote up
/**
 * Pod volumes to mount into the container&#39;s filesystem. Cannot be updated.
 * @return volumeMounts
**/
@javax.annotation.Nullable
@ApiModelProperty(value = "Pod volumes to mount into the container's filesystem. Cannot be updated.")

public List<V1VolumeMount> getVolumeMounts() {
  return volumeMounts;
}
 
Example #7
Source File: AppsV1Controller.java    From incubator-heron with Apache License 2.0 5 votes vote down vote up
private void mountVolumeIfPresent(V1Container container) {
  final Config config = getConfiguration();
  if (KubernetesContext.hasContainerVolume(config)) {
    final V1VolumeMount mount =
        new V1VolumeMount()
            .name(KubernetesContext.getContainerVolumeName(config))
            .mountPath(KubernetesContext.getContainerVolumeMountPath(config));
    container.volumeMounts(Collections.singletonList(mount));
  }
}
 
Example #8
Source File: V1alpha1PodPresetSpec.java    From java with Apache License 2.0 4 votes vote down vote up
public void setVolumeMounts(List<V1VolumeMount> volumeMounts) {
  this.volumeMounts = volumeMounts;
}
 
Example #9
Source File: V1EphemeralContainer.java    From java with Apache License 2.0 4 votes vote down vote up
public void setVolumeMounts(List<V1VolumeMount> volumeMounts) {
  this.volumeMounts = volumeMounts;
}
 
Example #10
Source File: V1Container.java    From java with Apache License 2.0 4 votes vote down vote up
public void setVolumeMounts(List<V1VolumeMount> volumeMounts) {
  this.volumeMounts = volumeMounts;
}
 
Example #11
Source File: JobMasterRequestObject.java    From twister2 with Apache License 2.0 4 votes vote down vote up
/**
 * construct a container
 */
public static V1Container constructContainer() {
  // construct container and add it to podSpec
  V1Container container = new V1Container();
  container.setName("twister2-job-master-0");

  String containerImage = KubernetesContext.twister2DockerImageForK8s(config);
  if (containerImage == null) {
    throw new RuntimeException("Container Image name is null. Config parameter: "
        + "twister2.resource.kubernetes.docker.image can not be null");
  }
  container.setImage(containerImage);
  container.setImagePullPolicy(KubernetesContext.imagePullPolicy(config));
  container.setCommand(Arrays.asList("/bin/bash"));
  container.setArgs(Arrays.asList("-c", "./init.sh"));

  int jmRam = JobMasterContext.jobMasterRAM(config) + 128;
  V1ResourceRequirements resReq = new V1ResourceRequirements();
  resReq.putRequestsItem("cpu", new Quantity(JobMasterContext.jobMasterCpu(config) + ""));
  resReq.putRequestsItem("memory", new Quantity(jmRam + "Mi"));
  container.setResources(resReq);

  ArrayList<V1VolumeMount> volumeMounts = new ArrayList<>();
  V1VolumeMount memoryVolumeMount = new V1VolumeMount();
  memoryVolumeMount.setName(KubernetesConstants.POD_MEMORY_VOLUME_NAME);
  memoryVolumeMount.setMountPath(KubernetesConstants.POD_MEMORY_VOLUME);
  volumeMounts.add(memoryVolumeMount);

  if (JobMasterContext.volatileVolumeRequested(config)) {
    V1VolumeMount volatileVolumeMount = new V1VolumeMount();
    volatileVolumeMount.setName(KubernetesConstants.POD_VOLATILE_VOLUME_NAME);
    volatileVolumeMount.setMountPath(KubernetesConstants.POD_VOLATILE_VOLUME);
    volumeMounts.add(volatileVolumeMount);
  }

  if (JobMasterContext.persistentVolumeRequested(config)) {
    V1VolumeMount persVolumeMount = new V1VolumeMount();
    persVolumeMount.setName(KubernetesConstants.PERSISTENT_VOLUME_NAME);
    persVolumeMount.setMountPath(KubernetesConstants.PERSISTENT_VOLUME_MOUNT);
    volumeMounts.add(persVolumeMount);
  }

  container.setVolumeMounts(volumeMounts);

  V1ContainerPort port = new V1ContainerPort();
  port.name("job-master-port");
  port.containerPort(JobMasterContext.jobMasterPort(config));
  port.setProtocol("TCP");
  container.setPorts(Arrays.asList(port));

  container.setEnv(constructEnvironmentVariables(JobMasterContext.jobMasterRAM(config)));

  return container;
}