Signed-off-by: wind57 <eugen.rabii@gmail.com>
This commit is contained in:
wind57
2025-04-02 12:15:36 +03:00
parent 390188a38a
commit 7612ac36c4
2 changed files with 11 additions and 6 deletions

View File

@@ -132,7 +132,7 @@ public final class Util {
}
}
public void deleteAndWait(String namespace, @Nullable Deployment deployment, Service service) {
public void deleteAndWait(String namespace, @Nullable Deployment deployment, @Nullable Service service) {
try {
long startTime = System.currentTimeMillis();
@@ -150,8 +150,10 @@ public final class Util {
}
System.out.println("Ended deployment delete in " + (System.currentTimeMillis() - startTime) + "ms");
client.services().inNamespace(namespace).resource(service).delete();
waitForServiceToBeDeleted(namespace, service);
if (service != null) {
client.services().inNamespace(namespace).resource(service).delete();
waitForServiceToBeDeleted(namespace, service);
}
}
catch (Exception e) {

View File

@@ -209,10 +209,13 @@ public final class Util {
waitForDeploymentToBeDeleted(deploymentName, namespace);
waitForDeploymentPodsToBeDeleted(podLabels, namespace);
service.getMetadata().setNamespace(namespace);
coreV1Api.deleteNamespacedService(service.getMetadata().getName(), service.getMetadata().getNamespace(),
if (service != null) {
service.getMetadata().setNamespace(namespace);
coreV1Api.deleteNamespacedService(service.getMetadata().getName(), service.getMetadata().getNamespace(),
null, null, null, null, null, null);
waitForServiceToBeDeleted(service.getMetadata().getName(), namespace);
waitForServiceToBeDeleted(service.getMetadata().getName(), namespace);
}
}
catch (Exception e) {
throw new RuntimeException(e);