Skip to content

Commit

Permalink
Drop setting quarkus.http.host from Jib and S2I
Browse files Browse the repository at this point in the history
There is no need to set these to 0.0.0.0 as that value
is the default. Furthermore setting them in such a way
means that if the property is set in application.properties,
it will have no effect when running the container image

Fixes: quarkusio#11911
  • Loading branch information
geoand authored and gsmet committed Sep 8, 2020
1 parent 6a2914f commit 6c9de91
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ public class JibConfig {
/**
* Additional JVM arguments to pass to the JVM when starting the application
*/
@ConfigItem(defaultValue = "-Dquarkus.http.host=0.0.0.0,-Djava.util.logging.manager=org.jboss.logmanager.LogManager")
@ConfigItem(defaultValue = "-Djava.util.logging.manager=org.jboss.logmanager.LogManager")
public List<String> jvmArguments;

/**
* Additional arguments to pass when starting the native application
*/
@ConfigItem(defaultValue = "-Dquarkus.http.host=0.0.0.0")
public List<String> nativeArguments;
@ConfigItem
public Optional<List<String>> nativeArguments;

/**
* If this is set, then it will be used as the entry point of the container image.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,10 @@ private JibContainerBuilder createContainerBuilderFromNative(ContainerImageConfi
if (jibConfig.nativeEntrypoint.isPresent()) {
entrypoint = jibConfig.nativeEntrypoint.get();
} else {
entrypoint = new ArrayList<>(jibConfig.nativeArguments.size() + 1);
List<String> nativeArguments = jibConfig.nativeArguments.orElse(Collections.emptyList());
entrypoint = new ArrayList<>(nativeArguments.size() + 1);
entrypoint.add("./" + BINARY_NAME_IN_CONTAINER);
entrypoint.addAll(jibConfig.nativeArguments);
entrypoint.addAll(nativeArguments);
}
try {
AbsoluteUnixPath workDirInContainer = AbsoluteUnixPath.get("/work");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,14 @@ public class S2iConfig {
/**
* Additional JVM arguments to pass to the JVM when starting the application
*/
@ConfigItem(defaultValue = "-Dquarkus.http.host=0.0.0.0,-Djava.util.logging.manager=org.jboss.logmanager.LogManager")
@ConfigItem(defaultValue = "-Djava.util.logging.manager=org.jboss.logmanager.LogManager")
public List<String> jvmArguments;

/**
* Additional arguments to pass when starting the native application
*/
@ConfigItem(defaultValue = "-Dquarkus.http.host=0.0.0.0")
public List<String> nativeArguments;
@ConfigItem
public Optional<List<String>> nativeArguments;

/**
* The directory where the jar is added during the assemble phase.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,17 +134,17 @@ public void s2iRequirementsNative(S2iConfig s2iConfig,

builderImageProducer.produce(new BaseImageInfoBuildItem(s2iConfig.baseNativeImage));
Optional<S2iBaseNativeImage> baseImage = S2iBaseNativeImage.findMatching(s2iConfig.baseNativeImage);
List<String> nativeArguments = s2iConfig.nativeArguments.orElse(Collections.emptyList());
baseImage.ifPresent(b -> {
envProducer.produce(
KubernetesEnvBuildItem.createSimpleVar(b.getHomeDirEnvVar(), s2iConfig.nativeBinaryDirectory, OPENSHIFT));
envProducer.produce(
KubernetesEnvBuildItem.createSimpleVar(b.getOptsEnvVar(), String.join(" ", s2iConfig.nativeArguments),
KubernetesEnvBuildItem.createSimpleVar(b.getOptsEnvVar(), String.join(" ", nativeArguments),
OPENSHIFT));
});

if (!baseImage.isPresent()) {
commandProducer.produce(new KubernetesCommandBuildItem(pathToNativeBinary,
s2iConfig.nativeArguments.toArray(new String[s2iConfig.nativeArguments.size()])));
commandProducer.produce(new KubernetesCommandBuildItem(pathToNativeBinary, nativeArguments.toArray(new String[0])));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ public void assertGeneratedResources() throws IOException {
});
assertThat(envVars).anySatisfy(envVar -> {
assertThat(envVar.getName()).isEqualTo("JAVA_OPTIONS");
assertThat(envVar.getValue()).contains("-Dquarkus.http.host=0.0.0.0");
assertThat(envVar.getValue())
.contains("-Djava.util.logging.manager=org.jboss.logmanager.LogManager");
});
Expand Down

0 comments on commit 6c9de91

Please sign in to comment.