Skip to content

Commit

Permalink
Add option to configure DeploymentConfig with args
Browse files Browse the repository at this point in the history
  • Loading branch information
tommaso-borgato committed Nov 5, 2024
1 parent c69af77 commit fd595bc
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
Expand Down Expand Up @@ -43,6 +44,7 @@ public class ContainerBuilder implements EnvironmentConfiguration, ResourceLimit
private final String name;

private final Map<String, String> envVars = new HashMap<>();
private final List<String> args = new LinkedList<>();
private final Map<String, Entry> referredEnvVars = new HashMap<>();
private final Set<ContainerPort> ports = new HashSet<>();
private final Set<VolumeMount> volumeMounts = new HashSet<>();
Expand Down Expand Up @@ -104,6 +106,11 @@ public ContainerBuilder port(int port, TransportProtocol protocol, String name)
return this;
}

public ContainerBuilder args(String value) {
args.add(value);
return this;
}

public ContainerBuilder envVar(String key, String value) {
return configEntry(key, value);
}
Expand Down Expand Up @@ -197,6 +204,9 @@ public Container build() {
builder.withEnv(Stream.concat(definedVars, referredVars).collect(Collectors.toList()));
builder.withImage(imageName);
builder.withImagePullPolicy("Always");
if (!args.isEmpty()) {
builder.withArgs(args);
}

if (command != null) {
builder.withCommand(command);
Expand Down

0 comments on commit fd595bc

Please sign in to comment.