-
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 #14346 from mrizzi/issues-14345
Remove ApplyLabelSelectorDecorator from MinikubeHandler
- Loading branch information
Showing
8 changed files
with
344 additions
and
2 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
2 changes: 2 additions & 0 deletions
2
...ts/kubernetes/maven-invoker-way/src/it/minikube-with-existing-manifest/invoker.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,2 @@ | ||
# invoker.goals=clean package -Dquarkus.container.build=true -Dquarkus.package.type=native | ||
invoker.goals=clean package |
135 changes: 135 additions & 0 deletions
135
...gration-tests/kubernetes/maven-invoker-way/src/it/minikube-with-existing-manifest/pom.xml
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,135 @@ | ||
<?xml version="1.0"?> | ||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>org.acme</groupId> | ||
<artifactId>minikube-with-existing-manifest</artifactId> | ||
<version>0.1-SNAPSHOT</version> | ||
<properties> | ||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | ||
<surefire-plugin.version>3.0.0-M5</surefire-plugin.version> | ||
<maven.compiler.source>1.8</maven.compiler.source> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
<maven.compiler.target>1.8</maven.compiler.target> | ||
</properties> | ||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-bom</artifactId> | ||
<version>@project.version@</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-resteasy</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-kubernetes</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-minikube</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-container-image-docker</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-junit5</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.rest-assured</groupId> | ||
<artifactId>rest-assured</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-maven-plugin</artifactId> | ||
<version>@project.version@</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>build</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<version>${surefire-plugin.version}</version> | ||
<configuration> | ||
<systemPropertyVariables> | ||
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager> | ||
<maven.home>${maven.home}</maven.home> | ||
</systemPropertyVariables> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<profiles> | ||
<profile> | ||
<id>native</id> | ||
<activation> | ||
<property> | ||
<name>native</name> | ||
</property> | ||
</activation> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<configuration> | ||
<skipTests>${native.surefire.skip}</skipTests> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-maven-plugin</artifactId> | ||
<version>@project.version@</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>native-image</goal> | ||
</goals> | ||
<configuration> | ||
<enableHttpUrlHandler>true</enableHttpUrlHandler> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-failsafe-plugin</artifactId> | ||
<version>${surefire-plugin.version}</version> | ||
<executions> | ||
<execution> | ||
<goals> | ||
<goal>integration-test</goal> | ||
<goal>verify</goal> | ||
</goals> | ||
<configuration> | ||
<systemPropertyVariables> | ||
<native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path> | ||
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager> | ||
<maven.home>${maven.home}</maven.home> | ||
</systemPropertyVariables> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
</profiles> | ||
</project> |
22 changes: 22 additions & 0 deletions
22
...s/maven-invoker-way/src/it/minikube-with-existing-manifest/src/main/docker/Dockerfile.jvm
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,22 @@ | ||
#### | ||
# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode | ||
# | ||
# Before building the docker image run: | ||
# | ||
# mvn package | ||
# | ||
# Then, build the image with: | ||
# | ||
# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/getting-started-jvm . | ||
# | ||
# Then run the container using: | ||
# | ||
# docker run -i --rm -p 8080:8080 quarkus/getting-started-jvm | ||
# | ||
### | ||
FROM fabric8/java-alpine-openjdk8-jre | ||
ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" | ||
ENV AB_ENABLED=jmx_exporter | ||
COPY target/lib/* /deployments/lib/ | ||
COPY target/*-runner.jar /deployments/app.jar | ||
ENTRYPOINT [ "/deployments/run-java.sh" ] |
16 changes: 16 additions & 0 deletions
16
...aven-invoker-way/src/it/minikube-with-existing-manifest/src/main/java/org/acme/Hello.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,16 @@ | ||
package org.acme; | ||
|
||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.Produces; | ||
import javax.ws.rs.core.MediaType; | ||
|
||
@Path("/hello") | ||
public class Hello { | ||
|
||
@GET | ||
@Produces(MediaType.TEXT_PLAIN) | ||
public String hello() { | ||
return "hello"; | ||
} | ||
} |
119 changes: 119 additions & 0 deletions
119
...aven-invoker-way/src/it/minikube-with-existing-manifest/src/main/kubernetes/minikube.json
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,119 @@ | ||
[ | ||
{ | ||
"apiVersion": "v1", | ||
"kind": "Service", | ||
"metadata": { | ||
"labels": { | ||
"app.kubernetes.io/name": "postgres", | ||
"app.kubernetes.io/version" : "10.6" | ||
}, | ||
"name": "postgres" | ||
}, | ||
"spec": { | ||
"ports": [ | ||
{ | ||
"name": "tcp", | ||
"port": 5432, | ||
"protocol": "TCP", | ||
"targetPort": 5432 | ||
} | ||
], | ||
"selector": { | ||
"app.kubernetes.io/name": "postgres", | ||
"app.kubernetes.io/version" : "10.6" | ||
}, | ||
"sessionAffinity": "None", | ||
"type": "ClusterIP" | ||
} | ||
}, | ||
{ | ||
"apiVersion": "apps/v1", | ||
"kind": "Deployment", | ||
"metadata": { | ||
"labels": { | ||
"app.kubernetes.io/name": "postgres", | ||
"app.kubernetes.io/version" : "10.6" | ||
}, | ||
"name": "postgres" | ||
}, | ||
"spec": { | ||
"progressDeadlineSeconds": 600, | ||
"replicas": 1, | ||
"selector" : { | ||
"matchLabels": { | ||
"app.kubernetes.io/name": "postgres", | ||
"app.kubernetes.io/version" : "10.6" | ||
} | ||
}, | ||
"strategy": { | ||
"rollingUpdate": { | ||
"maxSurge": "25%", | ||
"maxUnavailable": "25%" | ||
}, | ||
"type": "RollingUpdate" | ||
}, | ||
"template": { | ||
"metadata": { | ||
"labels": { | ||
"app.kubernetes.io/name": "postgres", | ||
"app.kubernetes.io/version" : "10.6" | ||
} | ||
}, | ||
"spec": { | ||
"containers": [ | ||
{ | ||
"env": [ | ||
{ | ||
"name": "POSTGRES_USER", | ||
"value": "controls" | ||
}, | ||
{ | ||
"name": "POSTGRES_PASSWORD", | ||
"value": "controls" | ||
}, | ||
{ | ||
"name": "POSTGRES_DB", | ||
"value": "controls_db" | ||
} | ||
], | ||
"image": "postgres:10.6", | ||
"imagePullPolicy": "IfNotPresent", | ||
"name": "postgres", | ||
"ports": [ | ||
{ | ||
"containerPort": 5432, | ||
"protocol": "TCP" | ||
} | ||
], | ||
"readinessProbe": { | ||
"timeoutSeconds": 1, | ||
"initialDelaySeconds": 5, | ||
"exec": { | ||
"command": [ "psql", "-U", "$(POSTGRES_USER)", "-d", "$(POSTGRES_DB)", "-c", "SELECT 1" ] | ||
} | ||
}, | ||
"livenessProbe": { | ||
"timeoutSeconds": 10, | ||
"initialDelaySeconds": 120, | ||
"exec": { | ||
"command": [ "psql", "-U", "$(POSTGRES_USER)", "-d", "$(POSTGRES_DB)", "-c", "SELECT 1" ] | ||
} | ||
}, | ||
"resources": {}, | ||
"securityContext": { | ||
"privileged": false | ||
}, | ||
"terminationMessagePath": "/dev/termination-log", | ||
"terminationMessagePolicy": "File" | ||
} | ||
], | ||
"dnsPolicy": "ClusterFirst", | ||
"restartPolicy": "Always", | ||
"schedulerName": "default-scheduler", | ||
"securityContext": {}, | ||
"terminationGracePeriodSeconds": 30 | ||
} | ||
} | ||
} | ||
} | ||
] |
2 changes: 2 additions & 0 deletions
2
...oker-way/src/it/minikube-with-existing-manifest/src/main/resources/application.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,2 @@ | ||
# Configuration file | ||
# key = value |
48 changes: 48 additions & 0 deletions
48
...n-tests/kubernetes/maven-invoker-way/src/it/minikube-with-existing-manifest/verify.groovy
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 @@ | ||
import io.dekorate.utils.Serialization | ||
import io.dekorate.deps.kubernetes.api.model.KubernetesList | ||
import io.dekorate.deps.kubernetes.api.model.Container | ||
import io.dekorate.deps.kubernetes.api.model.Service | ||
import io.dekorate.deps.kubernetes.api.model.apps.Deployment; | ||
|
||
//Check that file exits | ||
String base = basedir | ||
File kubernetesYml = new File(base, "target/kubernetes/minikube.yml") | ||
assert kubernetesYml.exists() | ||
kubernetesYml.withInputStream { stream -> | ||
//Check that its parse-able | ||
KubernetesList list = Serialization.unmarshalAsList(stream) | ||
assert list != null | ||
|
||
//Check that it contains the existing Service provided | ||
Service service = list.items.find{ r -> r.kind == "Service" && r.metadata.name == "postgres"} | ||
assert service != null | ||
assert service.metadata.labels.get("app.kubernetes.io/name") == "postgres" | ||
assert service.metadata.labels.get("app.kubernetes.io/version") == "10.6" | ||
assert service.spec.selector.get("app.kubernetes.io/name") == "postgres" | ||
assert service.spec.selector.get("app.kubernetes.io/version") == "10.6" | ||
|
||
//Check that it contains the existing Deployment with provided labels and selector | ||
Deployment deploymentProvided = list.items.find{r -> r.kind == "Deployment" && r.metadata.name == "postgres"} | ||
assert deploymentProvided != null | ||
assert deploymentProvided.metadata.labels.get("app.kubernetes.io/name") == "postgres" | ||
assert deploymentProvided.metadata.labels.get("app.kubernetes.io/version") == "10.6" | ||
assert deploymentProvided.spec.replicas == 1 | ||
|
||
assert deploymentProvided.spec.selector.matchLabels.get("app.kubernetes.io/name") == "postgres" | ||
assert deploymentProvided.spec.selector.matchLabels.get("app.kubernetes.io/version") == "10.6" | ||
|
||
Container container = deploymentProvided.spec.template.spec.containers[0] | ||
assert container != null | ||
assert container.name == "postgres" | ||
assert container.ports.find{p -> p.protocol = "TCP"}.containerPort == 5432 | ||
|
||
//Check that it created the application's Deployment with right labels and selector | ||
Deployment deployment = list.items.find{r -> r.kind == "Deployment" && r.metadata.name == "minikube-with-existing-manifest"} | ||
assert deployment != null | ||
assert deployment.metadata.labels.get("app.kubernetes.io/name") == "minikube-with-existing-manifest" | ||
assert deployment.metadata.labels.get("app.kubernetes.io/version") == "0.1-SNAPSHOT" | ||
assert deployment.spec.replicas == 1 | ||
|
||
assert deployment.spec.selector.matchLabels.get("app.kubernetes.io/name") == "minikube-with-existing-manifest" | ||
assert deployment.spec.selector.matchLabels.get("app.kubernetes.io/version") == "0.1-SNAPSHOT" | ||
} |