Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,9 @@ public Pod build() {
String podName = agent.getPodName();
int i = 0;
for (final PodVolume volume : template.getVolumes()) {
final String volumeName = "volume-" + i;
final String volumeName = (volume instanceof HostPathVolume hp)
? normalizePath(hp.getHostPath()).replaceFirst("^/", "").replaceAll("[^a-zA-Z0-9-]", "-")
: "volume-" + i;
final String mountPath = normalizePath(volume.getMountPath());
if (!volumeMounts.containsKey(mountPath)) {
VolumeMountBuilder volumeMountBuilder = new VolumeMountBuilder() //
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ private void validatePod(Pod pod, boolean fromYaml, boolean directConnection) {
assertNotNull(volumes.get("empty-volume"));
assertNotNull(volumes.get("host-volume"));
} else {
assertNotNull(volumes.get("volume-0"));
assertNotNull(volumes.get("host-data"));
assertNotNull(volumes.get("volume-1"));
}

Expand Down Expand Up @@ -427,7 +427,7 @@ private void validatePod(Pod pod, boolean fromYaml, boolean directConnection) {
equalTo(
new VolumeMountBuilder() //
.withMountPath("/container/data")
.withName("volume-0")
.withName("host-data")
.withReadOnly(false)
.build()),
equalTo(
Expand Down