mirror of
https://github.com/corda/corda.git
synced 2024-12-18 20:47:57 +00:00
truncate pod name from start rather than end
This commit is contained in:
parent
d54f2ddd87
commit
f8b4b334e3
@ -104,8 +104,7 @@ public class KubesTest extends DefaultTask {
|
||||
}
|
||||
|
||||
List<Future<KubePodResult>> futures = IntStream.range(0, numberOfPods).mapToObj(i -> {
|
||||
String potentialPodName = (taskToExecuteName + "-" + stableRunId + random + i).toLowerCase();
|
||||
String podName = potentialPodName.substring(0, Math.min(potentialPodName.length(), 62));
|
||||
String podName = generatePodName(stableRunId, random, i);
|
||||
return submitBuild(NAMESPACE, numberOfPods, i, podName, printOutput, 3);
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
@ -125,6 +124,16 @@ public class KubesTest extends DefaultTask {
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private String generatePodName(String stableRunId, String random, int i) {
|
||||
int magicMaxLength = 63;
|
||||
String provisionalName = taskToExecuteName.toLowerCase() + "-" + stableRunId + "-" + random + "-" + i;
|
||||
//length = 100
|
||||
//100-63 = 37
|
||||
//subString(37, 100) -? string of 63 characters
|
||||
return provisionalName.substring(Math.max(provisionalName.length() - magicMaxLength, 0));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private KubernetesClient getKubernetesClient() {
|
||||
io.fabric8.kubernetes.client.Config config = new io.fabric8.kubernetes.client.ConfigBuilder()
|
||||
|
Loading…
Reference in New Issue
Block a user