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 isVolumeAlreadyExists(List<Volume> volumes, String volumeName) { for (Volume v : volumes) { if (volumeName.equals(v.getName())) { return true; } } return false; } });
private boolean isVolumeAlreadyExists(List<Volume> volumes, String volumeName) { for (Volume v : volumes) { if (volumeName.equals(v.getName())) { 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; }
protected List<Volume> getVolumes(boolean isOpenShift) { List<Volume> volumeList = new ArrayList<>(1); volumeList.add(createConfigMapVolume(logAndMetricsConfigVolumeName, ancillaryConfigName)); if (trustedCertificates != null && trustedCertificates.size() > 0) { for (CertSecretSource certSecretSource: trustedCertificates) { // skipping if a volume with same Secret name was already added if (!volumeList.stream().anyMatch(v -> v.getName().equals(certSecretSource.getSecretName()))) { volumeList.add(createSecretVolume(certSecretSource.getSecretName(), certSecretSource.getSecretName(), isOpenShift)); } } } if (tlsAuthCertAndKey != null) { // skipping if a volume with same Secret name was already added if (!volumeList.stream().anyMatch(v -> v.getName().equals(tlsAuthCertAndKey.getSecretName()))) { volumeList.add(createSecretVolume(tlsAuthCertAndKey.getSecretName(), tlsAuthCertAndKey.getSecretName(), isOpenShift)); } } else if (passwordSecret != null) { volumeList.add(createSecretVolume(passwordSecret.getSecretName(), passwordSecret.getSecretName(), isOpenShift)); } volumeList.addAll(getExternalConfigurationVolumes(isOpenShift)); return volumeList; }
protected void createClientSecretVolume(KafkaMirrorMakerClientSpec client, CertAndKeySecretSource clientTlsAuthCertAndKey, PasswordSecretSource clientPasswordSecret, List<Volume> volumeList, boolean isOpenShift) { if (client.getTls() != null && client.getTls().getTrustedCertificates() != null && client.getTls().getTrustedCertificates().size() > 0) { for (CertSecretSource certSecretSource: client.getTls().getTrustedCertificates()) { // skipping if a volume with same Secret name was already added if (!volumeList.stream().anyMatch(v -> v.getName().equals(certSecretSource.getSecretName()))) { volumeList.add(createSecretVolume(certSecretSource.getSecretName(), certSecretSource.getSecretName(), isOpenShift)); } } } if (clientTlsAuthCertAndKey != null) { if (!volumeList.stream().anyMatch(v -> v.getName().equals(clientTlsAuthCertAndKey.getSecretName()))) { volumeList.add(createSecretVolume(clientTlsAuthCertAndKey.getSecretName(), clientTlsAuthCertAndKey.getSecretName(), isOpenShift)); } } else if (clientPasswordSecret != null) { volumeList.add(createSecretVolume(clientPasswordSecret.getSecretName(), clientPasswordSecret.getSecretName(), isOpenShift)); } }
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());
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; for (int i = 0; i < volumes.size(); i++) { Volume vol = volumes.get(i); if (vol.getName().startsWith(AbstractModel.VOLUME_NAME) && vol.getEmptyDir() != null) { volumes.remove(i); break;
.anyMatch(volumeMount -> volumeMount.getName().equals(volume.getName()))) .collect(Collectors.toList()));
public VolumeBuilder( Volume instance ){ this.fluent = this; this.withAwsElasticBlockStore(instance.getAwsElasticBlockStore()); this.withEmptyDir(instance.getEmptyDir()); this.withGcePersistentDisk(instance.getGcePersistentDisk()); this.withGitRepo(instance.getGitRepo()); this.withGlusterfs(instance.getGlusterfs()); this.withHostPath(instance.getHostPath()); this.withIscsi(instance.getIscsi()); this.withName(instance.getName()); this.withNfs(instance.getNfs()); this.withPersistentVolumeClaim(instance.getPersistentVolumeClaim()); this.withRbd(instance.getRbd()); this.withSecret(instance.getSecret()); }
public VolumeBuilder( VolumeFluent<?> fluent , Volume instance ){ this.fluent = fluent; fluent.withAwsElasticBlockStore(instance.getAwsElasticBlockStore()); fluent.withEmptyDir(instance.getEmptyDir()); fluent.withGcePersistentDisk(instance.getGcePersistentDisk()); fluent.withGitRepo(instance.getGitRepo()); fluent.withGlusterfs(instance.getGlusterfs()); fluent.withHostPath(instance.getHostPath()); fluent.withIscsi(instance.getIscsi()); fluent.withName(instance.getName()); fluent.withNfs(instance.getNfs()); fluent.withPersistentVolumeClaim(instance.getPersistentVolumeClaim()); fluent.withRbd(instance.getRbd()); fluent.withSecret(instance.getSecret()); } public VolumeBuilder( Volume instance ){
public VolumeBuilder( VolumeFluent<?> fluent , Volume instance ){ this.fluent = fluent; fluent.withAwsElasticBlockStore(instance.getAwsElasticBlockStore()); fluent.withEmptyDir(instance.getEmptyDir()); fluent.withGcePersistentDisk(instance.getGcePersistentDisk()); fluent.withGitRepo(instance.getGitRepo()); fluent.withGlusterfs(instance.getGlusterfs()); fluent.withHostPath(instance.getHostPath()); fluent.withIscsi(instance.getIscsi()); fluent.withName(instance.getName()); fluent.withNfs(instance.getNfs()); fluent.withPersistentVolumeClaim(instance.getPersistentVolumeClaim()); fluent.withRbd(instance.getRbd()); fluent.withSecret(instance.getSecret()); } public VolumeBuilder( Volume instance ){
public VolumeBuilder( Volume instance ){ this.fluent = this; this.withAwsElasticBlockStore(instance.getAwsElasticBlockStore()); this.withEmptyDir(instance.getEmptyDir()); this.withGcePersistentDisk(instance.getGcePersistentDisk()); this.withGitRepo(instance.getGitRepo()); this.withGlusterfs(instance.getGlusterfs()); this.withHostPath(instance.getHostPath()); this.withIscsi(instance.getIscsi()); this.withName(instance.getName()); this.withNfs(instance.getNfs()); this.withPersistentVolumeClaim(instance.getPersistentVolumeClaim()); this.withRbd(instance.getRbd()); this.withSecret(instance.getSecret()); }
public VolumeBuilder(VolumeFluent<?> fluent,Volume instance,Boolean validationEnabled){ this.fluent = fluent; fluent.withAwsElasticBlockStore(instance.getAwsElasticBlockStore()); fluent.withAzureFile(instance.getAzureFile()); fluent.withCephfs(instance.getCephfs()); fluent.withCinder(instance.getCinder()); fluent.withConfigMap(instance.getConfigMap()); fluent.withDownwardAPI(instance.getDownwardAPI()); fluent.withEmptyDir(instance.getEmptyDir()); fluent.withFc(instance.getFc()); fluent.withFlexVolume(instance.getFlexVolume()); fluent.withFlocker(instance.getFlocker()); fluent.withGcePersistentDisk(instance.getGcePersistentDisk()); fluent.withGitRepo(instance.getGitRepo()); fluent.withGlusterfs(instance.getGlusterfs()); fluent.withHostPath(instance.getHostPath()); fluent.withIscsi(instance.getIscsi()); fluent.withMetadata(instance.getMetadata()); fluent.withName(instance.getName()); fluent.withNfs(instance.getNfs()); fluent.withPersistentVolumeClaim(instance.getPersistentVolumeClaim()); fluent.withRbd(instance.getRbd()); fluent.withSecret(instance.getSecret()); fluent.withVsphereVolume(instance.getVsphereVolume()); this.validationEnabled = validationEnabled; } public VolumeBuilder(Volume instance){
public VolumeFluentImpl(Volume instance){ this.withAwsElasticBlockStore(instance.getAwsElasticBlockStore()); this.withAzureFile(instance.getAzureFile()); this.withCephfs(instance.getCephfs()); this.withCinder(instance.getCinder()); this.withConfigMap(instance.getConfigMap()); this.withDownwardAPI(instance.getDownwardAPI()); this.withEmptyDir(instance.getEmptyDir()); this.withFc(instance.getFc()); this.withFlexVolume(instance.getFlexVolume()); this.withFlocker(instance.getFlocker()); this.withGcePersistentDisk(instance.getGcePersistentDisk()); this.withGitRepo(instance.getGitRepo()); this.withGlusterfs(instance.getGlusterfs()); this.withHostPath(instance.getHostPath()); this.withIscsi(instance.getIscsi()); this.withMetadata(instance.getMetadata()); this.withName(instance.getName()); this.withNfs(instance.getNfs()); this.withPersistentVolumeClaim(instance.getPersistentVolumeClaim()); this.withRbd(instance.getRbd()); this.withSecret(instance.getSecret()); this.withVsphereVolume(instance.getVsphereVolume()); }
public VolumeBuilder(Volume instance,Boolean validationEnabled){ this.fluent = this; this.withAwsElasticBlockStore(instance.getAwsElasticBlockStore()); this.withAzureFile(instance.getAzureFile()); this.withCephfs(instance.getCephfs()); this.withCinder(instance.getCinder()); this.withConfigMap(instance.getConfigMap()); this.withDownwardAPI(instance.getDownwardAPI()); this.withEmptyDir(instance.getEmptyDir()); this.withFc(instance.getFc()); this.withFlexVolume(instance.getFlexVolume()); this.withFlocker(instance.getFlocker()); this.withGcePersistentDisk(instance.getGcePersistentDisk()); this.withGitRepo(instance.getGitRepo()); this.withGlusterfs(instance.getGlusterfs()); this.withHostPath(instance.getHostPath()); this.withIscsi(instance.getIscsi()); this.withMetadata(instance.getMetadata()); this.withName(instance.getName()); this.withNfs(instance.getNfs()); this.withPersistentVolumeClaim(instance.getPersistentVolumeClaim()); this.withRbd(instance.getRbd()); this.withSecret(instance.getSecret()); this.withVsphereVolume(instance.getVsphereVolume()); this.validationEnabled = validationEnabled; }