-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29120 from Sgitario/route_named_port
Allow to configure target port in OpenShift routes
- Loading branch information
Showing
4 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
...standard-way/src/test/java/io/quarkus/it/kubernetes/OpenshiftWithRouteTargetPortTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package io.quarkus.it.kubernetes; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
import java.io.IOException; | ||
import java.nio.file.Path; | ||
import java.util.List; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.fabric8.kubernetes.api.model.HasMetadata; | ||
import io.fabric8.openshift.api.model.Route; | ||
import io.quarkus.test.ProdBuildResults; | ||
import io.quarkus.test.ProdModeTestResults; | ||
import io.quarkus.test.QuarkusProdModeTest; | ||
|
||
public class OpenshiftWithRouteTargetPortTest { | ||
|
||
private static final String APP_NAME = "openshift-with-route-target-port"; | ||
|
||
@RegisterExtension | ||
static final QuarkusProdModeTest config = new QuarkusProdModeTest() | ||
.withApplicationRoot((jar) -> jar.addClasses(GreetingResource.class)) | ||
.setApplicationName(APP_NAME) | ||
.setApplicationVersion("0.1-SNAPSHOT") | ||
.withConfigurationResource(APP_NAME + ".properties"); | ||
|
||
@ProdBuildResults | ||
private ProdModeTestResults prodModeTestResults; | ||
|
||
@Test | ||
public void assertGeneratedResources() throws IOException { | ||
Path kubernetesDir = prodModeTestResults.getBuildDir().resolve("kubernetes"); | ||
assertThat(kubernetesDir) | ||
.isDirectoryContaining(p -> p.getFileName().endsWith("openshift.json")) | ||
.isDirectoryContaining(p -> p.getFileName().endsWith("openshift.yml")); | ||
List<HasMetadata> openshiftList = DeserializationUtil | ||
.deserializeAsList(kubernetesDir.resolve("openshift.yml")); | ||
|
||
assertThat(openshiftList).filteredOn(i -> "Route".equals(i.getKind())).singleElement().satisfies(i -> { | ||
assertThat(i).isInstanceOfSatisfying(Route.class, r -> { | ||
assertThat(r.getSpec().getPort().getTargetPort().getStrVal()).isEqualTo("my-port"); | ||
assertThat(r.getSpec().getHost()).isEqualTo("foo.bar.io"); | ||
}); | ||
}); | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
...netes/quarkus-standard-way/src/test/resources/openshift-with-route-target-port.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
quarkus.kubernetes.deployment-target=openshift | ||
quarkus.openshift.route.expose=true | ||
quarkus.openshift.route.host=foo.bar.io | ||
quarkus.openshift.route.target-port=my-port |