diff --git a/src/main/java/com/dajudge/kindcontainer/helm/InstallFluent.java b/src/main/java/com/dajudge/kindcontainer/helm/InstallFluent.java index 63aecec..5dd6d25 100644 --- a/src/main/java/com/dajudge/kindcontainer/helm/InstallFluent.java +++ b/src/main/java/com/dajudge/kindcontainer/helm/InstallFluent.java @@ -2,12 +2,11 @@ import com.dajudge.kindcontainer.BaseSidecarContainer.ExecInContainer; import com.dajudge.kindcontainer.exception.ExecutionException; +import org.testcontainers.containers.ContainerState; +import org.testcontainers.utility.MountableFile; import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import static java.util.Arrays.asList; @@ -17,6 +16,7 @@ public class InstallFluent
{
private final P parent;
private String namespace;
private boolean createNamespace;
+ private String version;
private final Map set(final String key, final String value) {
params.put(key, value);
return this;
}
+ /**
+ * Adds the given values file as -f parameter to the Helm install command.
+ * Make sure the values file is available in the Helm container.
+ * @see ContainerState#copyFileToContainer(MountableFile, String)
+ * @param path Path to the values file in the Helm container.
+ * @return The fluent API
+ */
public InstallFluent values(final String path) {
values.add(path);
return this;
}
+ /**
+ * Sets the given namespace as target namespace (--namespace parameter) for the Helm install command.
+ * @param namespace required
+ * @return The fluent API
+ */
public InstallFluent namespace(final String namespace) {
this.namespace = namespace;
return this;
}
+ /**
+ * Enables or disables the creation of the target namespace for the Helm install command. (--create-namespace parameter)
+ * @param createNamespace true to enable creation, false otherwise
+ * @return The fluent API
+ */
public InstallFluent createNamespace(final boolean createNamespace) {
this.createNamespace = createNamespace;
return this;
}
+ /**
+ * Enables the creation of the target namespace for the Helm install command.
+ * @return The fluent API
+ */
public InstallFluent createNamespace() {
return createNamespace(true);
}
+ /**
+ * Sets the version for the Helm chart to be installed. (--version parameter)
+ * @param version required
+ * @return The fluent API
+ */
+ public InstallFluent version(final String version) {
+ this.version = version;
+ return this;
+ }
+
+ /**
+ * Runs the Helm install command.
+ * @param releaseName The release name of the Helm installation
+ * @param chart The chart name of the Helm installation
+ * @return Parent container
+ * @throws IOException
+ * @throws InterruptedException
+ * @throws ExecutionException
+ */
public P run(final String releaseName, final String chart) throws IOException, InterruptedException, ExecutionException {
try {
final List