You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ja...@apache.org on 2020/03/24 11:45:57 UTC
[camel-quarkus] branch master updated: Add Kubernetes extension
(JVM only)
This is an automated email from the ASF dual-hosted git repository.
jamesnetherton pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/master by this push:
new 87743b8 Add Kubernetes extension (JVM only)
87743b8 is described below
commit 87743b8becd93c7ad12a5c6cdc710d0e1497109c
Author: James Netherton <ja...@gmail.com>
AuthorDate: Tue Mar 24 10:07:44 2020 +0000
Add Kubernetes extension (JVM only)
Fixes #303
---
.../pages/list-of-camel-quarkus-extensions.adoc | 66 +++++++++++-
extensions-jvm/kubernetes/deployment/pom.xml | 79 ++++++++++++++
.../kubernetes/deployment/KubernetesProcessor.java | 60 +++++++++++
extensions-jvm/kubernetes/integration-test/pom.xml | 118 +++++++++++++++++++++
.../kubernetes/it/KubernetesResource.java | 105 ++++++++++++++++++
.../component/kubernetes/it/KubernetesIT.java | 24 +++++
.../component/kubernetes/it/KubernetesTest.java | 89 ++++++++++++++++
extensions-jvm/kubernetes/pom.xml | 40 +++++++
extensions-jvm/kubernetes/runtime/pom.xml | 87 +++++++++++++++
.../kubernetes/CamelKubernetesRecorder.java | 30 ++++++
.../main/resources/META-INF/quarkus-extension.yaml | 32 ++++++
extensions-jvm/pom.xml | 1 +
poms/bom-deployment/pom.xml | 5 +
poms/bom/pom.xml | 16 +++
14 files changed, 751 insertions(+), 1 deletion(-)
diff --git a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
index 2b8fb7c..aa6b710 100644
--- a/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
+++ b/docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
@@ -18,7 +18,7 @@ In case you are missing some Camel feature in the list:
== Camel Components
// components: START
-Number of Camel components: 124 in 104 JAR artifacts (0 deprecated)
+Number of Camel components: 140 in 105 JAR artifacts (0 deprecated)
[width="100%",cols="4,1,1,5",options="header"]
|===
@@ -329,6 +329,62 @@ Level | Since | Description
`kafka:topic` | Native +
Stable | 1.0.0-M1 | The kafka component allows messages to be sent to (or consumed from) Apache Kafka brokers.
+| link:https://camel.apache.org/components/latest/kubernetes-config-maps-component.html[Kubernetes ConfigMap] (camel-quarkus-kubernetes) +
+`kubernetes-config-maps:masterUrl` | JVM +
+ Preview | 1.0.0-M6 | The Kubernetes Configmaps component provides a producer to execute kubernetes configmap operations.
+
+| link:https://camel.apache.org/components/latest/kubernetes-deployments-component.html[Kubernetes Deployments] (camel-quarkus-kubernetes) +
+`kubernetes-deployments:masterUrl` | JVM +
+ Preview | 1.0.0-M6 | The Kubernetes Nodes component provides a producer to execute kubernetes node operations and a consumer to consume node events.
+
+| link:https://camel.apache.org/components/latest/kubernetes-hpa-component.html[Kubernetes HPA] (camel-quarkus-kubernetes) +
+`kubernetes-hpa:masterUrl` | JVM +
+ Preview | 1.0.0-M6 | The Kubernetes HPA component provides a producer to execute kubernetes hpa operations and a consumer to consume HPA events.
+
+| link:https://camel.apache.org/components/latest/kubernetes-job-component.html[Kubernetes Job] (camel-quarkus-kubernetes) +
+`kubernetes-job:masterUrl` | JVM +
+ Preview | 1.0.0-M6 | The Kubernetes Jobs component provides a producer to execute kubernetes job operations
+
+| link:https://camel.apache.org/components/latest/kubernetes-namespaces-component.html[Kubernetes Namespaces] (camel-quarkus-kubernetes) +
+`kubernetes-namespaces:masterUrl` | JVM +
+ Preview | 1.0.0-M6 | The Kubernetes Namespaces component provides a producer to execute kubernetes namespace operations and a consumer to consume namespace events.
+
+| link:https://camel.apache.org/components/latest/kubernetes-nodes-component.html[Kubernetes Nodes] (camel-quarkus-kubernetes) +
+`kubernetes-nodes:masterUrl` | JVM +
+ Preview | 1.0.0-M6 | The Kubernetes Nodes component provides a producer to execute kubernetes node operations and a consumer to consume node events.
+
+| link:https://camel.apache.org/components/latest/kubernetes-persistent-volumes-component.html[Kubernetes Persistent Volume] (camel-quarkus-kubernetes) +
+`kubernetes-persistent-volumes:masterUrl` | JVM +
+ Preview | 1.0.0-M6 | The Kubernetes Persistent Volumes component provides a producer to execute kubernetes persistent volume operations.
+
+| link:https://camel.apache.org/components/latest/kubernetes-persistent-volumes-claims-component.html[Kubernetes Persistent Volume Claim] (camel-quarkus-kubernetes) +
+`kubernetes-persistent-volumes-claims:masterUrl` | JVM +
+ Preview | 1.0.0-M6 | The Kubernetes Persistent Volumes Claims component provides a producer to execute kubernetes persistent volume claim operations.
+
+| link:https://camel.apache.org/components/latest/kubernetes-pods-component.html[Kubernetes Pods] (camel-quarkus-kubernetes) +
+`kubernetes-pods:masterUrl` | JVM +
+ Preview | 1.0.0-M6 | The Kubernetes Pods component provides a producer to execute kubernetes pod operations and a consumer to consume pod events.
+
+| link:https://camel.apache.org/components/latest/kubernetes-replication-controllers-component.html[Kubernetes Replication Controller] (camel-quarkus-kubernetes) +
+`kubernetes-replication-controllers:masterUrl` | JVM +
+ Preview | 1.0.0-M6 | The Kubernetes Replication Controllers component provides a producer to execute kubernetes replication controller operations and a consumer to consume replication controller events.
+
+| link:https://camel.apache.org/components/latest/kubernetes-resources-quota-component.html[Kubernetes Resources Quota] (camel-quarkus-kubernetes) +
+`kubernetes-resources-quota:masterUrl` | JVM +
+ Preview | 1.0.0-M6 | The Kubernetes Resources Quota component provides a producer to execute kubernetes resources quota operations.
+
+| link:https://camel.apache.org/components/latest/kubernetes-secrets-component.html[Kubernetes Secrets] (camel-quarkus-kubernetes) +
+`kubernetes-secrets:masterUrl` | JVM +
+ Preview | 1.0.0-M6 | The Kubernetes Secrets component provides a producer to execute kubernetes secret operations.
+
+| link:https://camel.apache.org/components/latest/kubernetes-service-accounts-component.html[Kubernetes Service Account] (camel-quarkus-kubernetes) +
+`kubernetes-service-accounts:masterUrl` | JVM +
+ Preview | 1.0.0-M6 | The Kubernetes Service Accounts component provides a producer to execute service account operations.
+
+| link:https://camel.apache.org/components/latest/kubernetes-services-component.html[Kubernetes Services] (camel-quarkus-kubernetes) +
+`kubernetes-services:masterUrl` | JVM +
+ Preview | 1.0.0-M6 | The Kubernetes Services component provides a producer to execute service operations and a consumer to consume service events.
+
| link:https://camel.apache.org/components/latest/kudu-component.html[Kudu] (camel-quarkus-kudu) +
`kudu:host:port/tableName` | JVM +
Preview | 1.0.0-M6 | Represents a Kudu endpoint. A kudu endpoint allows you to interact with Apache Kudu, a free and open source column-oriented data store of the Apache Hadoop ecosystem.
@@ -373,6 +429,14 @@ Level | Since | Description
`olingo4:apiName/methodName` | Native +
Stable | 1.0.0-M4 | Communicates with OData 4.0 services using Apache Olingo OData API.
+| link:https://camel.apache.org/components/latest/openshift-build-configs-component.html[Openshift Build Config] (camel-quarkus-kubernetes) +
+`openshift-build-configs:masterUrl` | JVM +
+ Preview | 1.0.0-M6 | The Kubernetes Build Config component provides a producer to execute kubernetes build config operations.
+
+| link:https://camel.apache.org/components/latest/openshift-builds-component.html[Openshift Builds] (camel-quarkus-kubernetes) +
+`openshift-builds:masterUrl` | JVM +
+ Preview | 1.0.0-M6 | The Openshift Builds component provides a producer to execute openshift build operations.
+
| link:https://camel.apache.org/components/latest/openstack-cinder-component.html[OpenStack Cinder] (camel-quarkus-openstack) +
`openstack-cinder:host` | JVM +
Preview | 1.0.0-M6 | The openstack-cinder component allows messages to be sent to an OpenStack block storage services.
diff --git a/extensions-jvm/kubernetes/deployment/pom.xml b/extensions-jvm/kubernetes/deployment/pom.xml
new file mode 100644
index 0000000..42d691c
--- /dev/null
+++ b/extensions-jvm/kubernetes/deployment/pom.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-kubernetes-parent</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-kubernetes-deployment</artifactId>
+ <name>Camel Quarkus :: Kubernetes :: Deployment</name>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-bom-deployment</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-kubernetes-client-deployment</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-core-deployment</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-kubernetes</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <annotationProcessorPaths>
+ <path>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-extension-processor</artifactId>
+ <version>${quarkus.version}</version>
+ </path>
+ </annotationProcessorPaths>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/extensions-jvm/kubernetes/deployment/src/main/java/org/apache/camel/quarkus/component/kubernetes/deployment/KubernetesProcessor.java b/extensions-jvm/kubernetes/deployment/src/main/java/org/apache/camel/quarkus/component/kubernetes/deployment/KubernetesProcessor.java
new file mode 100644
index 0000000..ba7893e
--- /dev/null
+++ b/extensions-jvm/kubernetes/deployment/src/main/java/org/apache/camel/quarkus/component/kubernetes/deployment/KubernetesProcessor.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.kubernetes.deployment;
+
+import io.fabric8.kubernetes.client.KubernetesClient;
+import io.quarkus.arc.deployment.BeanContainerBuildItem;
+import io.quarkus.deployment.annotations.BuildStep;
+import io.quarkus.deployment.annotations.ExecutionTime;
+import io.quarkus.deployment.annotations.Record;
+import io.quarkus.deployment.builditem.FeatureBuildItem;
+import io.quarkus.deployment.pkg.steps.NativeBuild;
+import org.apache.camel.quarkus.component.kubernetes.CamelKubernetesRecorder;
+import org.apache.camel.quarkus.core.JvmOnlyRecorder;
+import org.apache.camel.quarkus.core.deployment.CamelBeanBuildItem;
+import org.jboss.logging.Logger;
+
+class KubernetesProcessor {
+ private static final Logger LOG = Logger.getLogger(KubernetesProcessor.class);
+
+ private static final String FEATURE = "camel-kubernetes";
+
+ @BuildStep
+ FeatureBuildItem feature() {
+ return new FeatureBuildItem(FEATURE);
+ }
+
+ @BuildStep
+ @Record(ExecutionTime.STATIC_INIT)
+ CamelBeanBuildItem configureKubernetesClient(CamelKubernetesRecorder recorder, BeanContainerBuildItem beanContainer) {
+ // Enable Kubernetes endpoints to use the client configured by the Quarkus kubernetes-client extension
+ return new CamelBeanBuildItem(
+ "kubernetesClient",
+ KubernetesClient.class.getName(),
+ recorder.getKubernetesClient(beanContainer.getValue()));
+ }
+
+ /**
+ * Remove this once this extension starts supporting the native mode.
+ */
+ @BuildStep(onlyIf = NativeBuild.class)
+ @Record(value = ExecutionTime.RUNTIME_INIT)
+ void warnJvmInNative(JvmOnlyRecorder recorder) {
+ JvmOnlyRecorder.warnJvmInNative(LOG, FEATURE); // warn at build time
+ recorder.warnJvmInNative(FEATURE); // warn at runtime
+ }
+}
diff --git a/extensions-jvm/kubernetes/integration-test/pom.xml b/extensions-jvm/kubernetes/integration-test/pom.xml
new file mode 100644
index 0000000..48ef8be
--- /dev/null
+++ b/extensions-jvm/kubernetes/integration-test/pom.xml
@@ -0,0 +1,118 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-kubernetes-parent</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>camel-quarkus-kubernetes-integration-test</artifactId>
+ <name>Camel Quarkus :: Kubernetes :: Integration Test</name>
+ <description>Integration tests for Camel Quarkus Kubernetes extension</description>
+
+ <properties>
+ <!-- mvnd, a.k.a. Maven Daemon: https://github.com/gnodet/mvnd -->
+ <!-- The following rule tells mvnd to build the listed deployment modules before this module. -->
+ <!-- This is important because mvnd builds modules in parallel by default. The deployment modules are not -->
+ <!-- explicit dependencies of this module in the Maven sense, although they are required by the Quarkus Maven plugin. -->
+ <!-- Please update rule whenever you change the dependencies of this module by running -->
+ <!-- mvn process-resources -Pformat from the root directory -->
+ <mvnd.builder.rule>camel-quarkus-kubernetes-deployment,camel-quarkus-support-policy-deployment</mvnd.builder.rule>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-kubernetes</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-resteasy</artifactId>
+ </dependency>
+
+ <!-- test dependencies -->
+ <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>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-test-kubernetes-client</artifactId>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>build</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>native</id>
+ <activation>
+ <property>
+ <name>native</name>
+ </property>
+ </activation>
+ <properties>
+ <quarkus.package.type>native</quarkus.package.type>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
+
+</project>
diff --git a/extensions-jvm/kubernetes/integration-test/src/main/java/org/apache/camel/quarkus/component/kubernetes/it/KubernetesResource.java b/extensions-jvm/kubernetes/integration-test/src/main/java/org/apache/camel/quarkus/component/kubernetes/it/KubernetesResource.java
new file mode 100644
index 0000000..a8b9ef4
--- /dev/null
+++ b/extensions-jvm/kubernetes/integration-test/src/main/java/org/apache/camel/quarkus/component/kubernetes/it/KubernetesResource.java
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.kubernetes.it;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.enterprise.context.ApplicationScoped;
+import javax.inject.Inject;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
+import io.fabric8.kubernetes.api.model.Container;
+import io.fabric8.kubernetes.api.model.Pod;
+import io.fabric8.kubernetes.api.model.PodSpec;
+import org.apache.camel.ProducerTemplate;
+import org.apache.camel.component.kubernetes.KubernetesConstants;
+
+@Path("/kubernetes")
+@ApplicationScoped
+public class KubernetesResource {
+
+ @Inject
+ ProducerTemplate producerTemplate;
+
+ @Path("/pod/{namespace}/{podName}")
+ @GET
+ @Produces(MediaType.TEXT_PLAIN)
+ public String readPod(@PathParam("namespace") String namespace, @PathParam("podName") String podName) {
+ Map<String, Object> headers = new HashMap<>();
+ headers.put(KubernetesConstants.KUBERNETES_NAMESPACE_NAME, namespace);
+ headers.put(KubernetesConstants.KUBERNETES_POD_NAME, podName);
+ final Pod pod = producerTemplate.requestBodyAndHeaders(
+ "kubernetes-pods:///?kubernetesClient=#kubernetesClient&operation=getPod", null, headers, Pod.class);
+ return pod.getMetadata().getName();
+ }
+
+ @Path("/pod/{namespace}/{podName}")
+ @POST
+ @Produces(MediaType.TEXT_PLAIN)
+ public Response createPod(@PathParam("namespace") String namespace, @PathParam("podName") String podName) throws Exception {
+ Map<String, Object> headers = new HashMap<>();
+ headers.put(KubernetesConstants.KUBERNETES_NAMESPACE_NAME, namespace);
+ headers.put(KubernetesConstants.KUBERNETES_POD_NAME, podName);
+ headers.put(KubernetesConstants.KUBERNETES_POD_SPEC, createPodSpec(podName));
+ producerTemplate.requestBodyAndHeaders("kubernetes-pods:///?kubernetesClient=#kubernetesClient&operation=createPod",
+ null,
+ headers, Pod.class);
+ return Response
+ .created(new URI("https://camel.apache.org/"))
+ .build();
+ }
+
+ @Path("/pod/{namespace}/{podName}")
+ @DELETE
+ public Response deletePod(@PathParam("namespace") String namespace, @PathParam("podName") String podName) {
+ Map<String, Object> headers = new HashMap<>();
+ headers.put(KubernetesConstants.KUBERNETES_NAMESPACE_NAME, namespace);
+ headers.put(KubernetesConstants.KUBERNETES_POD_NAME, podName);
+ producerTemplate.requestBodyAndHeaders("kubernetes-pods:///?kubernetesClient=#kubernetesClient&operation=deletePod",
+ null,
+ headers);
+ return Response
+ .status(Response.Status.NO_CONTENT)
+ .build();
+ }
+
+ private PodSpec createPodSpec(String containerName) {
+ PodSpec podSpec = new PodSpec();
+
+ Container container = new Container();
+ container.setImage("docker.io/busybox:latest");
+ container.setName(containerName);
+
+ List<Container> containers = new ArrayList<>();
+ containers.add(container);
+
+ podSpec.setContainers(containers);
+
+ return podSpec;
+ }
+}
diff --git a/extensions-jvm/kubernetes/integration-test/src/test/java/org/apache/camel/quarkus/component/kubernetes/it/KubernetesIT.java b/extensions-jvm/kubernetes/integration-test/src/test/java/org/apache/camel/quarkus/component/kubernetes/it/KubernetesIT.java
new file mode 100644
index 0000000..c55ed17
--- /dev/null
+++ b/extensions-jvm/kubernetes/integration-test/src/test/java/org/apache/camel/quarkus/component/kubernetes/it/KubernetesIT.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.kubernetes.it;
+
+import io.quarkus.test.junit.NativeImageTest;
+
+@NativeImageTest
+class KubernetesIT extends KubernetesTest {
+
+}
diff --git a/extensions-jvm/kubernetes/integration-test/src/test/java/org/apache/camel/quarkus/component/kubernetes/it/KubernetesTest.java b/extensions-jvm/kubernetes/integration-test/src/test/java/org/apache/camel/quarkus/component/kubernetes/it/KubernetesTest.java
new file mode 100644
index 0000000..8ad97e8
--- /dev/null
+++ b/extensions-jvm/kubernetes/integration-test/src/test/java/org/apache/camel/quarkus/component/kubernetes/it/KubernetesTest.java
@@ -0,0 +1,89 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.kubernetes.it;
+
+import io.fabric8.kubernetes.api.model.Container;
+import io.fabric8.kubernetes.api.model.Pod;
+import io.fabric8.kubernetes.api.model.PodBuilder;
+import io.fabric8.kubernetes.client.server.mock.KubernetesMockServer;
+import io.quarkus.test.common.QuarkusTestResource;
+import io.quarkus.test.junit.QuarkusTest;
+import io.quarkus.test.kubernetes.client.KubernetesMockServerTestResource;
+import io.quarkus.test.kubernetes.client.MockServer;
+import io.restassured.RestAssured;
+import org.junit.jupiter.api.Test;
+
+import static org.hamcrest.Matchers.is;
+
+@QuarkusTest
+@QuarkusTestResource(KubernetesMockServerTestResource.class)
+public class KubernetesTest {
+
+ @MockServer
+ private KubernetesMockServer mockServer;
+
+ @Test
+ public void testKubernetesComponent() {
+ Container container = new Container();
+ container.setImage("docker.io/busybox:latest");
+ container.setName("camel-pod");
+
+ Pod pod = new PodBuilder()
+ .withNewMetadata()
+ .withName("camel-pod")
+ .withNamespace("test")
+ .and()
+ .withNewSpec()
+ .withContainers(container)
+ .and()
+ .build();
+
+ mockServer.expect()
+ .post()
+ .withPath("/api/v1/namespaces/test/pods")
+ .andReturn(201, pod)
+ .once();
+
+ mockServer.expect()
+ .get()
+ .withPath("/api/v1/namespaces/test/pods/camel-pod")
+ .andReturn(200, pod)
+ .always();
+
+ mockServer.expect()
+ .delete()
+ .withPath("/api/v1/namespaces/test/pods/camel-pod")
+ .andReturn(200, "{}")
+ .once();
+
+ RestAssured.when()
+ .post("/kubernetes/pod/test/camel-pod")
+ .then()
+ .statusCode(201);
+
+ RestAssured.when()
+ .get("/kubernetes/pod/test/camel-pod")
+ .then()
+ .statusCode(200)
+ .body(is("camel-pod"));
+
+ RestAssured.when()
+ .delete("/kubernetes/pod/test/camel-pod")
+ .then()
+ .statusCode(204);
+ }
+}
diff --git a/extensions-jvm/kubernetes/pom.xml b/extensions-jvm/kubernetes/pom.xml
new file mode 100644
index 0000000..8830ccd
--- /dev/null
+++ b/extensions-jvm/kubernetes/pom.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-build-parent</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <relativePath>../../poms/build-parent/pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-kubernetes-parent</artifactId>
+ <name>Camel Quarkus :: Kubernetes</name>
+ <packaging>pom</packaging>
+
+ <modules>
+ <module>deployment</module>
+ <module>runtime</module>
+ <module>integration-test</module>
+ </modules>
+</project>
diff --git a/extensions-jvm/kubernetes/runtime/pom.xml b/extensions-jvm/kubernetes/runtime/pom.xml
new file mode 100644
index 0000000..9c42f18
--- /dev/null
+++ b/extensions-jvm/kubernetes/runtime/pom.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-kubernetes-parent</artifactId>
+ <version>1.1.0-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>camel-quarkus-kubernetes</artifactId>
+ <name>Camel Quarkus :: Kubernetes :: Runtime</name>
+ <description>The Kubernetes component provides integration with Kubernetes APIs.</description>
+
+ <properties>
+ <firstVersion>1.0.0-M6</firstVersion>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-bom</artifactId>
+ <version>${project.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-kubernetes-client</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
+ <artifactId>camel-kubernetes</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-bootstrap-maven-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <annotationProcessorPaths>
+ <path>
+ <groupId>io.quarkus</groupId>
+ <artifactId>quarkus-extension-processor</artifactId>
+ <version>${quarkus.version}</version>
+ </path>
+ </annotationProcessorPaths>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/extensions-jvm/kubernetes/runtime/src/main/java/org/apache/camel/quarkus/component/kubernetes/CamelKubernetesRecorder.java b/extensions-jvm/kubernetes/runtime/src/main/java/org/apache/camel/quarkus/component/kubernetes/CamelKubernetesRecorder.java
new file mode 100644
index 0000000..c32fa79
--- /dev/null
+++ b/extensions-jvm/kubernetes/runtime/src/main/java/org/apache/camel/quarkus/component/kubernetes/CamelKubernetesRecorder.java
@@ -0,0 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.camel.quarkus.component.kubernetes;
+
+import io.fabric8.kubernetes.client.KubernetesClient;
+import io.quarkus.arc.runtime.BeanContainer;
+import io.quarkus.runtime.RuntimeValue;
+import io.quarkus.runtime.annotations.Recorder;
+
+@Recorder
+public class CamelKubernetesRecorder {
+ public RuntimeValue<?> getKubernetesClient(BeanContainer beanContainer) {
+ KubernetesClient client = beanContainer.instance(KubernetesClient.class);
+ return new RuntimeValue<>(client);
+ }
+}
diff --git a/extensions-jvm/kubernetes/runtime/src/main/resources/META-INF/quarkus-extension.yaml b/extensions-jvm/kubernetes/runtime/src/main/resources/META-INF/quarkus-extension.yaml
new file mode 100644
index 0000000..67b1945
--- /dev/null
+++ b/extensions-jvm/kubernetes/runtime/src/main/resources/META-INF/quarkus-extension.yaml
@@ -0,0 +1,32 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+---
+name: "Camel Quarkus Kubernetes"
+description: "Camel Quarkus Kubernetes & OpenShift support."
+metadata:
+ keywords:
+ - "camel"
+ - "cloud"
+ - "container"
+ - "kubernetes"
+ - "openshift"
+ - "paas"
+ guide: "https://camel.apache.org/components/latest/kubernetes-component.html"
+ categories:
+ - "integration"
+ status: "preview"
diff --git a/extensions-jvm/pom.xml b/extensions-jvm/pom.xml
index 9c21929..1ea94c8 100644
--- a/extensions-jvm/pom.xml
+++ b/extensions-jvm/pom.xml
@@ -60,6 +60,7 @@
<module>google-bigquery</module>
<module>groovy</module>
<module>influxdb</module>
+ <module>kubernetes</module>
<module>kudu</module>
<module>mongodb-gridfs</module>
<module>nitrite</module>
diff --git a/poms/bom-deployment/pom.xml b/poms/bom-deployment/pom.xml
index e0d9118..af3d2ff 100644
--- a/poms/bom-deployment/pom.xml
+++ b/poms/bom-deployment/pom.xml
@@ -494,6 +494,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-kubernetes-deployment</artifactId>
+ <version>${camel-quarkus.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-kudu-deployment</artifactId>
<version>${camel-quarkus.version}</version>
</dependency>
diff --git a/poms/bom/pom.xml b/poms/bom/pom.xml
index ee97174..89e5ff4 100644
--- a/poms/bom/pom.xml
+++ b/poms/bom/pom.xml
@@ -596,6 +596,17 @@
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
+ <artifactId>camel-kubernetes</artifactId>
+ <version>${camel.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>io.fabric8</groupId>
+ <artifactId>kubernetes-client</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel</groupId>
<artifactId>camel-kudu</artifactId>
<version>${camel.version}</version>
</dependency>
@@ -1375,6 +1386,11 @@
</dependency>
<dependency>
<groupId>org.apache.camel.quarkus</groupId>
+ <artifactId>camel-quarkus-kubernetes</artifactId>
+ <version>${camel-quarkus.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.camel.quarkus</groupId>
<artifactId>camel-quarkus-kudu</artifactId>
<version>${camel-quarkus.version}</version>
</dependency>