forked from eclipse-jkube/jkube
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(controller-enricher): Add Maven integration test for nodeSelecto…
…r via Maven XML and Groovy DSL Signed-off-by: Sun Seng David TAN <[email protected]>
- Loading branch information
Showing
5 changed files
with
247 additions
and
0 deletions.
There are no files selected for viewing
96 changes: 96 additions & 0 deletions
96
kubernetes-maven-plugin/it/src/it/nodeSelector/expected/kubernetes.yml
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,96 @@ | ||
# | ||
# Copyright (c) 2019 Red Hat, Inc. | ||
# This program and the accompanying materials are made | ||
# available under the terms of the Eclipse Public License 2.0 | ||
# which is available at: | ||
# | ||
# https://www.eclipse.org/legal/epl-2.0/ | ||
# | ||
# SPDX-License-Identifier: EPL-2.0 | ||
# | ||
# Contributors: | ||
# Red Hat, Inc. - initial API and implementation | ||
# | ||
|
||
--- | ||
apiVersion: v1 | ||
kind: List | ||
items: | ||
- apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
annotations: | ||
jkube.eclipse.org/git-commit: "@ignore@" | ||
prometheus.io/scrape: "true" | ||
jkube.eclipse.org/git-branch: "@ignore@" | ||
prometheus.io/port: "9779" | ||
labels: | ||
provider: jkube | ||
app: jkube-maven-sample-node-selector | ||
version: "@ignore@" | ||
group: org.eclipse.jkube | ||
name: jkube-maven-sample-node-selector | ||
spec: | ||
ports: | ||
- name: http | ||
port: 8080 | ||
protocol: TCP | ||
targetPort: 8080 | ||
selector: | ||
app: jkube-maven-sample-node-selector | ||
provider: jkube | ||
group: org.eclipse.jkube | ||
- apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
annotations: | ||
jkube.eclipse.org/git-commit: "@ignore@" | ||
jkube.eclipse.org/git-branch: "@ignore@" | ||
labels: | ||
provider: jkube | ||
app: jkube-maven-sample-node-selector | ||
version: "@ignore@" | ||
group: org.eclipse.jkube | ||
name: jkube-maven-sample-node-selector | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: jkube-maven-sample-node-selector | ||
provider: jkube | ||
group: org.eclipse.jkube | ||
template: | ||
metadata: | ||
annotations: | ||
jkube.eclipse.org/git-commit: "@ignore@" | ||
jkube.eclipse.org/git-branch: "@ignore@" | ||
labels: | ||
provider: jkube | ||
app: jkube-maven-sample-node-selector | ||
version: "@ignore@" | ||
group: org.eclipse.jkube | ||
spec: | ||
nodeSelector: | ||
region: east | ||
type: user-node | ||
containers: | ||
- env: | ||
- name: KUBERNETES_NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
image: "@matches('jkube/jkube-maven-sample-node-selector:.*$')@" | ||
imagePullPolicy: IfNotPresent | ||
name: quarkus | ||
ports: | ||
- containerPort: 8080 | ||
name: http | ||
protocol: TCP | ||
- containerPort: 9779 | ||
name: prometheus | ||
protocol: TCP | ||
- containerPort: 8778 | ||
name: jolokia | ||
protocol: TCP | ||
securityContext: | ||
privileged: false |
17 changes: 17 additions & 0 deletions
17
kubernetes-maven-plugin/it/src/it/nodeSelector/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,17 @@ | ||
# | ||
# Copyright (c) 2019 Red Hat, Inc. | ||
# This program and the accompanying materials are made | ||
# available under the terms of the Eclipse Public License 2.0 | ||
# which is available at: | ||
# | ||
# https://www.eclipse.org/legal/epl-2.0/ | ||
# | ||
# SPDX-License-Identifier: EPL-2.0 | ||
# | ||
# Contributors: | ||
# Red Hat, Inc. - initial API and implementation | ||
# | ||
|
||
invoker.goals.1=clean k8s:resource | ||
invoker.mavenOpts=-Djkube.verbose -Djkube.offline=true | ||
invoker.debug=false |
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,83 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (c) 2019 Red Hat, Inc. | ||
This program and the accompanying materials are made | ||
available under the terms of the Eclipse Public License 2.0 | ||
which is available at: | ||
https://www.eclipse.org/legal/epl-2.0/ | ||
SPDX-License-Identifier: EPL-2.0 | ||
Contributors: | ||
Red Hat, Inc. - initial API and implementation | ||
--> | ||
<project> | ||
|
||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>jkube-maven-sample-node-selector</artifactId> | ||
<groupId>org.eclipse.jkube</groupId> | ||
<version>0.1-SNAPSHOT</version> | ||
|
||
<properties> | ||
<quarkus.platform.artifact-id>quarkus-bom</quarkus.platform.artifact-id> | ||
<quarkus.platform.group-id>io.quarkus.platform</quarkus.platform.group-id> | ||
<quarkus.platform.version>3.8.3</quarkus.platform.version> | ||
</properties> | ||
|
||
<dependencyManagement> | ||
<dependencies> | ||
<dependency> | ||
<groupId>${quarkus.platform.group-id}</groupId> | ||
<artifactId>${quarkus.platform.artifact-id}</artifactId> | ||
<version>${quarkus.platform.version}</version> | ||
<type>pom</type> | ||
<scope>import</scope> | ||
</dependency> | ||
</dependencies> | ||
</dependencyManagement> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-arc</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-resteasy-reactive</artifactId> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
|
||
<plugins> | ||
<plugin> | ||
<groupId>${quarkus.platform.group-id}</groupId> | ||
<artifactId>quarkus-maven-plugin</artifactId> | ||
<version>${quarkus.platform.version}</version> | ||
<extensions>true</extensions> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>org.eclipse.jkube</groupId> | ||
<artifactId>kubernetes-maven-plugin</artifactId> | ||
<version>@jkube.version@</version> | ||
<configuration> | ||
<resources> | ||
<controller> | ||
<nodeSelector> | ||
<region>east</region> | ||
<type>user-node</type> | ||
</nodeSelector> | ||
</controller> | ||
</resources> | ||
</configuration> | ||
</plugin> | ||
|
||
</plugins> | ||
</build> | ||
|
||
</project> |
29 changes: 29 additions & 0 deletions
29
...maven-plugin/it/src/it/nodeSelector/src/main/java/org/eclipse/jkube/GreetingResource.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,29 @@ | ||
/* | ||
* Copyright (c) 2019 Red Hat, Inc. | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at: | ||
* | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Red Hat, Inc. - initial API and implementation | ||
*/ | ||
package org.eclipse.jkube; | ||
|
||
import jakarta.ws.rs.GET; | ||
import jakarta.ws.rs.Path; | ||
import jakarta.ws.rs.Produces; | ||
import jakarta.ws.rs.core.MediaType; | ||
|
||
@Path("/hello") | ||
public class GreetingResource { | ||
|
||
@GET | ||
@Produces(MediaType.TEXT_PLAIN) | ||
public String hello() { | ||
return "Hello JKube"; | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
kubernetes-maven-plugin/it/src/it/nodeSelector/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,22 @@ | ||
/* | ||
* Copyright (c) 2019 Red Hat, Inc. | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at: | ||
* | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Red Hat, Inc. - initial API and implementation | ||
*/ | ||
import org.eclipse.jkube.maven.it.Verify | ||
|
||
[ "kubernetes" ].each { | ||
Verify.verifyResourceDescriptors( | ||
new File(basedir, sprintf("/target/classes/META-INF/jkube/%s.yml",it)), | ||
new File(basedir, sprintf("/expected/%s.yml",it))) | ||
} | ||
|
||
true |