diff --git a/kubernetes-maven-plugin/it/src/it/nodeSelector/expected/kubernetes.yml b/kubernetes-maven-plugin/it/src/it/nodeSelector/expected/kubernetes.yml new file mode 100644 index 0000000000..73dcbdd1c9 --- /dev/null +++ b/kubernetes-maven-plugin/it/src/it/nodeSelector/expected/kubernetes.yml @@ -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 diff --git a/kubernetes-maven-plugin/it/src/it/nodeSelector/invoker.properties b/kubernetes-maven-plugin/it/src/it/nodeSelector/invoker.properties new file mode 100644 index 0000000000..13ffb54f36 --- /dev/null +++ b/kubernetes-maven-plugin/it/src/it/nodeSelector/invoker.properties @@ -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 \ No newline at end of file diff --git a/kubernetes-maven-plugin/it/src/it/nodeSelector/pom.xml b/kubernetes-maven-plugin/it/src/it/nodeSelector/pom.xml new file mode 100644 index 0000000000..b8a06c7c79 --- /dev/null +++ b/kubernetes-maven-plugin/it/src/it/nodeSelector/pom.xml @@ -0,0 +1,83 @@ + + + + + 4.0.0 + + jkube-maven-sample-node-selector + org.eclipse.jkube + 0.1-SNAPSHOT + + + quarkus-bom + io.quarkus.platform + 3.8.3 + + + + + + ${quarkus.platform.group-id} + ${quarkus.platform.artifact-id} + ${quarkus.platform.version} + pom + import + + + + + + + io.quarkus + quarkus-arc + + + io.quarkus + quarkus-resteasy-reactive + + + + + + + + ${quarkus.platform.group-id} + quarkus-maven-plugin + ${quarkus.platform.version} + true + + + + org.eclipse.jkube + kubernetes-maven-plugin + @jkube.version@ + + + + + east + user-node + + + + + + + + + + \ No newline at end of file diff --git a/kubernetes-maven-plugin/it/src/it/nodeSelector/src/main/java/org/eclipse/jkube/GreetingResource.java b/kubernetes-maven-plugin/it/src/it/nodeSelector/src/main/java/org/eclipse/jkube/GreetingResource.java new file mode 100644 index 0000000000..bf5afb13e2 --- /dev/null +++ b/kubernetes-maven-plugin/it/src/it/nodeSelector/src/main/java/org/eclipse/jkube/GreetingResource.java @@ -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"; + } +} diff --git a/kubernetes-maven-plugin/it/src/it/nodeSelector/verify.groovy b/kubernetes-maven-plugin/it/src/it/nodeSelector/verify.groovy new file mode 100644 index 0000000000..0166ea6dc2 --- /dev/null +++ b/kubernetes-maven-plugin/it/src/it/nodeSelector/verify.groovy @@ -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