private void discoverFolderMounts() { List<VolumeMount> volumeMounts = zaleniumPod.getSpec().getContainers().get(0).getVolumeMounts(); List<VolumeMount> validMounts = new ArrayList<>(); volumeMounts.stream() .filter(volumeMount -> !Arrays.asList(PROTECTED_NODE_MOUNT_POINTS).contains(volumeMount.getMountPath())) .forEach(validMounts::add); // Look through the volume mounts to see if the shared folder is mounted if (!validMounts.isEmpty()) { List<Volume> volumes = zaleniumPod.getSpec().getVolumes(); for (VolumeMount validMount : validMounts) { volumes.stream() .filter(volume -> validMount.getName().equalsIgnoreCase(volume.getName())) .findFirst() .ifPresent(volume -> mountedSharedFoldersMap.put(validMount, volume)); } } }
private boolean checkForPvc(PodSpec podSpec) { List<Volume> volumes = podSpec.getVolumes(); if (volumes != null) { for (Volume volume : volumes) { PersistentVolumeClaimVolumeSource persistentVolumeClaim = volume.getPersistentVolumeClaim(); if (persistentVolumeClaim != null) { return true; } } } return false; }
private boolean checkForPvc(PodSpec podSpec) { List<Volume> volumes = podSpec.getVolumes(); if (volumes != null) { for (Volume volume : volumes) { PersistentVolumeClaimVolumeSource persistentVolumeClaim = volume.getPersistentVolumeClaim(); if (persistentVolumeClaim != null) { return true; } } } return false; }
private Map<String, String> extractMountPoints(PodSpec podSpec) { Map<String, String> nameToMount = new LinkedHashMap<>(); List<Volume> volumes = podSpec.getVolumes(); if (volumes != null) { for (Volume volume : volumes) { PersistentVolumeClaimVolumeSource persistentVolumeClaim = volume.getPersistentVolumeClaim(); if (persistentVolumeClaim != null) { String name = volume.getName(); String mountPath = getMountPath(podSpec.getContainers(), name); nameToMount.put(name, mountPath); } } } return nameToMount; }
private Map<String, String> extractMountPoints(PodSpec podSpec) { Map<String, String> nameToMount = new LinkedHashMap<>(); List<Volume> volumes = podSpec.getVolumes(); if (volumes != null) { for (Volume volume : volumes) { PersistentVolumeClaimVolumeSource persistentVolumeClaim = volume.getPersistentVolumeClaim(); if (persistentVolumeClaim != null) { String name = volume.getName(); String mountPath = getMountPath(podSpec.getContainers(), name); nameToMount.put(name, mountPath); } } } return nameToMount; }
final Set<String> activeSecrets = pods.getItems().stream() .filter(pod -> !isTerminatedPod(pod)) .flatMap(pod -> pod.getSpec().getVolumes().stream()) .map(volume -> volume.getSecret().getSecretName()) .collect(Collectors.toSet());
List<Volume> volumes = current.getSpec().getTemplate().getSpec().getVolumes(); for (int i = 0; i < volumes.size(); i++) { Volume vol = volumes.get(i); if (vol.getName().startsWith(AbstractModel.VOLUME_NAME) && vol.getEmptyDir() != null) { desired.getSpec().getTemplate().getSpec().getVolumes().add(0, volumes.get(i)); break; List<Volume> volumes = desired.getSpec().getTemplate().getSpec().getVolumes(); for (int i = 0; i < volumes.size(); i++) { Volume vol = volumes.get(i);
if (pod.getSpec().getVolumes().stream().noneMatch(v -> WORKSPACE_VOLUME_NAME.equals(v.getName()))) { pod.getSpec().getVolumes() .add(new VolumeBuilder().withName(WORKSPACE_VOLUME_NAME).withNewEmptyDir().endEmptyDir().build());
Optional.ofNullable(parent.getSpec().getVolumes()).ifPresent(combinedVolumes::addAll); Optional.ofNullable(template.getSpec().getVolumes()).ifPresent(combinedVolumes::addAll);
Map<String, Volume> volumes = pod.getSpec().getVolumes().stream() .collect(Collectors.toMap(Volume::getName, Function.identity())); assertEquals(3, volumes.size());
podSpec.getVolumes().add(new VolumeBuilder().withName("config").withNewEmptyDir().endEmptyDir().build());
public PodSpecBuilder( PodSpecFluent<?> fluent , PodSpec instance ){ this.fluent = fluent; fluent.withActiveDeadlineSeconds(instance.getActiveDeadlineSeconds()); fluent.withContainers(instance.getContainers()); fluent.withDnsPolicy(instance.getDnsPolicy()); fluent.withHost(instance.getHost()); fluent.withHostNetwork(instance.getHostNetwork()); fluent.withImagePullSecrets(instance.getImagePullSecrets()); fluent.withNodeSelector(instance.getNodeSelector()); fluent.withRestartPolicy(instance.getRestartPolicy()); fluent.withServiceAccount(instance.getServiceAccount()); fluent.withTerminationGracePeriodSeconds(instance.getTerminationGracePeriodSeconds()); fluent.withVolumes(instance.getVolumes()); } public PodSpecBuilder( PodSpec instance ){
public PodSpecBuilder( PodSpecFluent<?> fluent , PodSpec instance ){ this.fluent = fluent; fluent.withActiveDeadlineSeconds(instance.getActiveDeadlineSeconds()); fluent.withContainers(instance.getContainers()); fluent.withDnsPolicy(instance.getDnsPolicy()); fluent.withHost(instance.getHost()); fluent.withHostNetwork(instance.getHostNetwork()); fluent.withImagePullSecrets(instance.getImagePullSecrets()); fluent.withNodeSelector(instance.getNodeSelector()); fluent.withRestartPolicy(instance.getRestartPolicy()); fluent.withServiceAccount(instance.getServiceAccount()); fluent.withTerminationGracePeriodSeconds(instance.getTerminationGracePeriodSeconds()); fluent.withVolumes(instance.getVolumes()); } public PodSpecBuilder( PodSpec instance ){
public PodSpecBuilder( PodSpec instance ){ this.fluent = this; this.withActiveDeadlineSeconds(instance.getActiveDeadlineSeconds()); this.withContainers(instance.getContainers()); this.withDnsPolicy(instance.getDnsPolicy()); this.withHost(instance.getHost()); this.withHostNetwork(instance.getHostNetwork()); this.withImagePullSecrets(instance.getImagePullSecrets()); this.withNodeSelector(instance.getNodeSelector()); this.withRestartPolicy(instance.getRestartPolicy()); this.withServiceAccount(instance.getServiceAccount()); this.withTerminationGracePeriodSeconds(instance.getTerminationGracePeriodSeconds()); this.withVolumes(instance.getVolumes()); }
public PodSpecBuilder( PodSpec instance ){ this.fluent = this; this.withActiveDeadlineSeconds(instance.getActiveDeadlineSeconds()); this.withContainers(instance.getContainers()); this.withDnsPolicy(instance.getDnsPolicy()); this.withHost(instance.getHost()); this.withHostNetwork(instance.getHostNetwork()); this.withImagePullSecrets(instance.getImagePullSecrets()); this.withNodeSelector(instance.getNodeSelector()); this.withRestartPolicy(instance.getRestartPolicy()); this.withServiceAccount(instance.getServiceAccount()); this.withTerminationGracePeriodSeconds(instance.getTerminationGracePeriodSeconds()); this.withVolumes(instance.getVolumes()); }
public PodSpecFluentImpl(PodSpec instance){ this.withActiveDeadlineSeconds(instance.getActiveDeadlineSeconds()); this.withContainers(instance.getContainers()); this.withDnsPolicy(instance.getDnsPolicy()); this.withHost(instance.getHost()); this.withHostIPC(instance.getHostIPC()); this.withHostNetwork(instance.getHostNetwork()); this.withHostPID(instance.getHostPID()); this.withHostname(instance.getHostname()); this.withImagePullSecrets(instance.getImagePullSecrets()); this.withNodeName(instance.getNodeName()); this.withNodeSelector(instance.getNodeSelector()); this.withRestartPolicy(instance.getRestartPolicy()); this.withSecurityContext(instance.getSecurityContext()); this.withServiceAccount(instance.getServiceAccount()); this.withServiceAccountName(instance.getServiceAccountName()); this.withSubdomain(instance.getSubdomain()); this.withTerminationGracePeriodSeconds(instance.getTerminationGracePeriodSeconds()); this.withVolumes(instance.getVolumes()); }
public PodSpecBuilder(PodSpec instance,Boolean validationEnabled){ this.fluent = this; this.withActiveDeadlineSeconds(instance.getActiveDeadlineSeconds()); this.withContainers(instance.getContainers()); this.withDnsPolicy(instance.getDnsPolicy()); this.withHost(instance.getHost()); this.withHostIPC(instance.getHostIPC()); this.withHostNetwork(instance.getHostNetwork()); this.withHostPID(instance.getHostPID()); this.withHostname(instance.getHostname()); this.withImagePullSecrets(instance.getImagePullSecrets()); this.withNodeName(instance.getNodeName()); this.withNodeSelector(instance.getNodeSelector()); this.withRestartPolicy(instance.getRestartPolicy()); this.withSecurityContext(instance.getSecurityContext()); this.withServiceAccount(instance.getServiceAccount()); this.withServiceAccountName(instance.getServiceAccountName()); this.withSubdomain(instance.getSubdomain()); this.withTerminationGracePeriodSeconds(instance.getTerminationGracePeriodSeconds()); this.withVolumes(instance.getVolumes()); this.validationEnabled = validationEnabled; }
public PodSpecBuilder(PodSpecFluent<?> fluent,PodSpec instance,Boolean validationEnabled){ this.fluent = fluent; fluent.withActiveDeadlineSeconds(instance.getActiveDeadlineSeconds()); fluent.withContainers(instance.getContainers()); fluent.withDnsPolicy(instance.getDnsPolicy()); fluent.withHost(instance.getHost()); fluent.withHostIPC(instance.getHostIPC()); fluent.withHostNetwork(instance.getHostNetwork()); fluent.withHostPID(instance.getHostPID()); fluent.withHostname(instance.getHostname()); fluent.withImagePullSecrets(instance.getImagePullSecrets()); fluent.withNodeName(instance.getNodeName()); fluent.withNodeSelector(instance.getNodeSelector()); fluent.withRestartPolicy(instance.getRestartPolicy()); fluent.withSecurityContext(instance.getSecurityContext()); fluent.withServiceAccount(instance.getServiceAccount()); fluent.withServiceAccountName(instance.getServiceAccountName()); fluent.withSubdomain(instance.getSubdomain()); fluent.withTerminationGracePeriodSeconds(instance.getTerminationGracePeriodSeconds()); fluent.withVolumes(instance.getVolumes()); this.validationEnabled = validationEnabled; } public PodSpecBuilder(PodSpec instance){