Skip to content

Commit

Permalink
Add support for specifying timeout in catalogs
Browse files Browse the repository at this point in the history
Since some chart may use more than the standard 5 min timeout that helm
is configured with
  • Loading branch information
johnksv committed Sep 2, 2024
1 parent 5e48651 commit 6ecca40
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
import fr.insee.onyxia.model.catalog.CatalogStatus;
import fr.insee.onyxia.model.helm.Repository;
import io.swagger.v3.oas.annotations.media.Schema;

import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Pattern;
Expand Down Expand Up @@ -54,6 +56,9 @@ public class CatalogWrapper {
@Schema(description = "Skip tls certificate checks for the repository")
private boolean skipTlsVerify;

@Schema(description = "value to wait for helm command to complete")
private Duration timeout;

@Schema(description = "Verify certificates of HTTPS-enabled servers using this CA bundle")
private String caFile;

Expand Down Expand Up @@ -199,6 +204,14 @@ public void setSkipTlsVerify(boolean skipTlsVerify) {
this.skipTlsVerify = skipTlsVerify;
}

public Duration getTimeout() {
return timeout;
}

public void setTimeout(Duration timeout) {
this.timeout = timeout;
}

public String getCaFile() {
return caFile;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;

import java.time.Duration;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.function.Consumer;
Expand Down Expand Up @@ -248,6 +250,7 @@ private void suspendOrResume(Region region, Project project, String serviceId, b
user,
serviceId,
catalog.get().getSkipTlsVerify(),
catalog.get().getTimeout(),
catalog.get().getCaFile(),
false);
} else {
Expand All @@ -260,6 +263,7 @@ private void suspendOrResume(Region region, Project project, String serviceId, b
user,
serviceId,
catalog.get().getSkipTlsVerify(),
catalog.get().getTimeout(),
catalog.get().getCaFile(),
false);
}
Expand Down Expand Up @@ -473,10 +477,11 @@ private Collection<Object> publishApps(

boolean skipTlsVerify = catalog.getSkipTlsVerify();
String caFile = catalog.getCaFile();
Duration timeout = catalog.getTimeout();
Map<String, Object> fusion = new HashMap<>();
fusion.putAll((Map<String, Object>) requestDTO.getOptions());
return helmAppsService.installApp(
region, project, requestDTO, catalogId, pkg, user, fusion, skipTlsVerify, caFile);
region, project, requestDTO, catalogId, pkg, user, fusion, skipTlsVerify, timeout, caFile);
}

public static class SuspendOrResumeRequestDTO {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import io.github.inseefrlab.helmwrapper.service.HelmInstallService;
import java.io.IOException;
import java.text.ParseException;
import java.time.Duration;
import java.util.Collection;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
Expand All @@ -40,6 +41,7 @@ Collection<Object> installApp(
User user,
Map<String, Object> fusion,
final boolean skipTlsVerify,
Duration timeout,
final String caFile)
throws Exception;

Expand Down Expand Up @@ -69,6 +71,7 @@ void resume(
User user,
String serviceId,
boolean skipTlsVerify,
Duration timeout,
String caFile,
boolean dryRun)
throws IOException, InterruptedException, TimeoutException;
Expand All @@ -82,6 +85,7 @@ void suspend(
User user,
String serviceId,
boolean skipTlsVerify,
Duration timeout,
String caFile,
boolean dryRun)
throws IOException, InterruptedException, TimeoutException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import java.io.File;
import java.io.IOException;
import java.text.ParseException;
import java.time.Duration;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.TimeoutException;
Expand Down Expand Up @@ -103,6 +104,7 @@ public Collection<Object> installApp(
User user,
Map<String, Object> fusion,
final boolean skipTlsVerify,
Duration timeout,
final String caFile)
throws IOException, TimeoutException, InterruptedException {

Expand All @@ -123,6 +125,7 @@ public Collection<Object> installApp(
values,
null,
skipTlsVerify,
timeout,
caFile);
InstallServiceEvent installServiceEvent =
new InstallServiceEvent(
Expand Down Expand Up @@ -410,6 +413,7 @@ public void suspend(
User user,
String serviceId,
boolean skipTlsVerify,
Duration timeout,
String caFile,
boolean dryRun)
throws IOException, InterruptedException, TimeoutException {
Expand All @@ -422,6 +426,7 @@ public void suspend(
user,
serviceId,
skipTlsVerify,
timeout,
caFile,
dryRun,
true);
Expand All @@ -437,6 +442,7 @@ public void resume(
User user,
String serviceId,
boolean skipTlsVerify,
Duration timeout,
String caFile,
boolean dryRun)
throws IOException, InterruptedException, TimeoutException {
Expand All @@ -449,6 +455,7 @@ public void resume(
user,
serviceId,
skipTlsVerify,
timeout,
caFile,
dryRun,
false);
Expand All @@ -463,6 +470,7 @@ public void suspendOrResume(
User user,
String serviceId,
boolean skipTlsVerify,
Duration timeout,
String caFile,
boolean dryRun,
boolean suspend)
Expand All @@ -479,6 +487,7 @@ public void suspendOrResume(
version,
dryRun,
skipTlsVerify,
timeout,
caFile);
} else {
getHelmInstallService()
Expand All @@ -490,6 +499,7 @@ public void suspendOrResume(
version,
dryRun,
skipTlsVerify,
timeout,
caFile);
}
SuspendResumeServiceEvent event =
Expand Down

0 comments on commit 6ecca40

Please sign in to comment.