Skip to content

Commit

Permalink
Add Kubernetes extension (JVM only)
Browse files Browse the repository at this point in the history
Fixes #303
  • Loading branch information
jamesnetherton committed Mar 24, 2020
1 parent bc1343f commit 87743b8
Show file tree
Hide file tree
Showing 14 changed files with 751 additions and 1 deletion.
66 changes: 65 additions & 1 deletion docs/modules/ROOT/pages/list-of-camel-quarkus-extensions.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
|===
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
79 changes: 79 additions & 0 deletions extensions-jvm/kubernetes/deployment/pom.xml
Original file line number Diff line number Diff line change
@@ -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>
Original file line number Diff line number Diff line change
@@ -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
}
}
118 changes: 118 additions & 0 deletions extensions-jvm/kubernetes/integration-test/pom.xml
Original file line number Diff line number Diff line change
@@ -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>

0 comments on commit 87743b8

Please sign in to comment.