Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Brings back the helm code #1100

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
187 changes: 94 additions & 93 deletions karaf/features/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,101 +19,102 @@
-->
<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.brooklyn</groupId>
<artifactId>brooklyn-karaf</artifactId>
<version>1.1.0-SNAPSHOT</version> <!-- BROOKLYN_VERSION -->
</parent>

<artifactId>brooklyn-features</artifactId>
<name>Brooklyn Karaf Features</name>
<packaging>pom</packaging>
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.apache.brooklyn</groupId>
<artifactId>brooklyn-karaf</artifactId>
<version>1.1.0-SNAPSHOT</version> <!-- BROOKLYN_VERSION -->
</parent>

<build>
<resources>
<resource>
<directory>src/main/feature</directory>
<filtering>true</filtering>
<includes>
<include>**/*</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<configuration>
<useDefaultDelimiters>false</useDefaultDelimiters>
<delimiters>
<delimiter>${*}</delimiter>
</delimiters>
</configuration>
<executions>
<execution>
<id>filter</id>
<phase>generate-resources</phase>
<goals>
<goal>resources</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>target/classes/feature.xml</file>
<classifier>features</classifier>
<type>xml</type>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
<versionRange>[4.1.6,)</versionRange>
<goals>
<goal>verify</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<artifactId>brooklyn-features</artifactId>
<name>Brooklyn Karaf Features</name>
<packaging>pom</packaging>

<build>
<resources>
<resource>
<directory>src/main/feature</directory>
<filtering>true</filtering>
<includes>
<include>**/*</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<configuration>
<useDefaultDelimiters>false</useDefaultDelimiters>
<delimiters>
<delimiter>${*}</delimiter>
</delimiters>
</configuration>
<executions>
<execution>
<id>filter</id>
<phase>generate-resources</phase>
<goals>
<goal>resources</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>attach-artifact</goal>
</goals>
<configuration>
<artifacts>
<artifact>
<file>target/classes/feature.xml</file>
<classifier>features</classifier>
<type>xml</type>
</artifact>
</artifacts>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>karaf-maven-plugin</artifactId>
<versionRange>[4.1.6,)</versionRange>
<goals>
<goal>verify</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>

</project>

52 changes: 43 additions & 9 deletions karaf/features/src/main/feature/feature.xml
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
<feature>brooklyn-camp-brooklyn</feature>
<feature>brooklyn-camp-base</feature>

<feature>cxf-jaxrs-with-optional-dependencies</feature>
<feature>cxf-jaxrs</feature>
<bundle dependency="true">mvn:org.apache.cxf/cxf-rt-rs-security-cors/${cxf.version}</bundle>
<bundle dependency="true">mvn:org.apache.cxf/cxf-rt-frontend-jaxrs/${cxf.version}</bundle>
<bundle dependency="true">mvn:org.apache.cxf.karaf/cxf-karaf-commands/${cxf.version}</bundle>
Expand All @@ -218,14 +218,6 @@
</config>
</feature>

<feature name="cxf-jaxrs-with-optional-dependencies" version="${project.version}" description="cxf-jaxrs with optional dependencies">
<feature>cxf-jaxrs</feature>

<!-- otherwise causes jackson-jaxrs-json-provider to be rewired when this optional dep is installed -->
<bundle dependency="true" start-level="35">mvn:com.fasterxml.jackson.module/jackson-module-jaxb-annotations/${fasterxml.jackson.version}</bundle>
</feature>


<feature name="brooklyn-rest-resources" version="${project.version}" description="Brooklyn REST Resources">
<feature>brooklyn-rest-resources-prereqs</feature>
<bundle>mvn:org.apache.brooklyn/brooklyn-rest-resources/${project.version}</bundle>
Expand Down Expand Up @@ -301,6 +293,8 @@

<feature name="brooklyn-container-service" version="${project.version}" description="Brooklyn Container Service and Location Targets">
<feature>brooklyn-core</feature>
<feature>brooklyn-utils-common</feature>
<feature>brooklyn-locations-jclouds</feature>

<bundle dependency='true'>mvn:com.fasterxml.jackson.module/jackson-module-jaxb-annotations/${fasterxml.jackson.version}</bundle>
<bundle dependency='true'>mvn:com.fasterxml.jackson.dataformat/jackson-dataformat-yaml/${fasterxml.jackson.version}</bundle>
Expand All @@ -315,16 +309,56 @@
<!-- (3) -->
<bundle dependency='true'>wrap:mvn:com.squareup.okhttp3/okhttp/3.12.6$Bundle-SymbolicName=squareup-okhttp3&amp;Bundle-Version=3.12.6&amp;Import-Package=okio;version=1.15,*;resolution:=optional</bundle>
<bundle dependency='true'>wrap:mvn:com.squareup.okhttp3/logging-interceptor/3.12.6$Bundle-SymbolicName=squareup-okhttp3-logging-interceptor&amp;Bundle-Version=3.12.6&amp;Import-Package=*;resolution:=mandatory</bundle>

<!-- (4) -->
<!-- these are the main required bundles for these features above -->
<bundle>mvn:io.fabric8/zjsonpatch/0.3.0</bundle>
<bundle>mvn:io.fabric8/kubernetes-model/${kubernetes-client.version}</bundle>
<bundle>mvn:io.fabric8/kubernetes-client/${kubernetes-client.version}/jar/bundle</bundle>
<bundle>mvn:io.fabric8/openshift-client/${kubernetes-client.version}/jar/bundle</bundle>

<bundle dependency='true'>mvn:org.microbean/microbean-helm/2.12.4-SNAPSHOT</bundle>
<!-- All teh following are microbean-helm dependencies -->
<bundle dependency='true'>wrap:mvn:org.microbean/microbean-development-annotations/0.1.3$Bundle-SymbolicName=microbean-development-annotations&amp;Bundle-Version=0.1.3&amp;Import-Package=*;resolution:=mandatory</bundle>
<bundle dependency='true'>wrap:mvn:org.kamranzafar/jtar/2.3$Bundle-SymbolicName=jtar&amp;Bundle-Version=2.3&amp;Import-Package=*;resolution:=mandatory</bundle>
<bundle dependency='true'>wrap:mvn:com.github.zafarkhaja/java-semver/0.9.0$Bundle-SymbolicName=java-semver&amp;Bundle-Version=0.9.0&amp;Import-Package=*;resolution:=mandatory</bundle>
<bundle dependency='true'>wrap:mvn:org.microbean/microbean-kubernetes/0.1.3$Bundle-SymbolicName=microbean-kubernetes&amp;Bundle-Version=0.1.3&amp;Import-Package=*;resolution:=mandatory</bundle>

<bundle dependency='true'>wrap:mvn:io.grpc/grpc-netty/1.23.0$Bundle-SymbolicName=grpc-netty&amp;Bundle-Version=1.23.0&amp;Import-Package=*;resolution:=mandatory</bundle>
<bundle dependency='true'>mvn:io.netty/netty-codec-http2/4.1.38.Final</bundle>
<bundle dependency='true'>mvn:io.netty/netty-resolver/4.1.38.Final</bundle>
<bundle dependency='true'>mvn:io.netty/netty-common/4.1.38.Final</bundle>
<bundle dependency='true'>mvn:io.netty/netty-buffer/4.1.38.Final</bundle>
<bundle dependency='true'>mvn:io.netty/netty-codec/4.1.38.Final</bundle>
<bundle dependency='true'>mvn:io.netty/netty-transport/4.1.38.Final</bundle>
<bundle dependency='true'>mvn:io.netty/netty-codec-http/4.1.38.Final</bundle>
<bundle dependency='true'>mvn:io.netty/netty-codec-socks/4.1.38.Final</bundle>
<bundle dependency='true'>mvn:io.netty/netty-handler/4.1.38.Final</bundle>
<bundle dependency='true'>mvn:io.netty/netty-handler-proxy/4.1.38.Final</bundle>
<bundle dependency='true'>wrap:mvn:io.grpc/grpc-core/1.23.0$Bundle-SymbolicName=grpc-core&amp;Bundle-Version=1.23.0&amp;Import-Package=*;resolution:=mandatory</bundle>
<bundle dependency='true'>wrap:mvn:io.grpc/grpc-context/1.23.0$Bundle-SymbolicName=grpc-context&amp;Bundle-Version=1.23.0&amp;Import-Package=*;resolution:=mandatory</bundle>
<bundle dependency='true'>wrap:mvn:io.opencensus/opencensus-api/0.11.0$Bundle-SymbolicName=opencensus-api&amp;Bundle-Version=0.11.0&amp;Import-Package=*;resolution:=mandatory</bundle>
<bundle dependency='true'>wrap:mvn:io.opencensus/opencensus-contrib-grpc-metrics/0.11.0$Bundle-SymbolicName=opencensus-contrib-grpc-metrics&amp;Bundle-Version=0.11.0&amp;Import-Package=*;resolution:=mandatory</bundle>

<bundle dependency='true'>mvn:com.google.protobuf/protobuf-java/3.9.0</bundle>
<bundle dependency='true'>wrap:mvn:io.grpc/grpc-protobuf/1.23.0$Bundle-SymbolicName=grpc-protobuf&amp;Bundle-Version=1.23.0&amp;Import-Package=*;resolution:=mandatory</bundle>
<bundle dependency='true'>wrap:mvn:io.grpc/grpc-services/1.23.0$Bundle-SymbolicName=grpc-services&amp;Bundle-Version=1.23.0&amp;Import-Package=*;resolution:=mandatory</bundle>
<bundle dependency='true'>wrap:mvn:io.grpc/grpc-stub/1.23.0$Bundle-SymbolicName=grpc-stub&amp;Bundle-Version=1.23.0&amp;Import-Package=*;resolution:=mandatory</bundle>
<bundle dependency='true'>wrap:mvn:io.grpc/grpc-protobuf-lite/1.23.0$Bundle-SymbolicName=grpc-protobuf-lite&amp;Bundle-Version=1.23.0&amp;Import-Package=*;resolution:=mandatory</bundle>
<bundle dependency='true'>mvn:com.google.protobuf/protobuf-java-util/3.9.0</bundle>
<bundle dependency='true'>wrap:mvn:com.google.api.grpc/proto-google-common-protos/1.12.0$Bundle-SymbolicName=proto-google-common-protos&amp;Bundle-Version=1.12.0&amp;Import-Package=*;resolution:=mandatory</bundle>
<bundle dependency='true'>wrap:mvn:io.grpc/grpc-core/1.23.0$Bundle-SymbolicName=grpc-core&amp;Bundle-Version=1.23.0&amp;Import-Package=*;resolution:=mandatory</bundle>
<bundle dependency='true'>wrap:mvn:com.google.instrumentation/instrumentation-api/0.4.3$Bundle-SymbolicName=instrumentation-api&amp;Bundle-Version=0.4.3&amp;Import-Package=*;resolution:=mandatory</bundle>

<bundle dependency='true'>wrap:mvn:com.google.errorprone/error_prone_annotations/2.3.2$Bundle-SymbolicName=error_prone_annotations&amp;Bundle-Version=2.3.2&amp;Import-Package=*;resolution:=optional</bundle>
<bundle dependency='true'>wrap:mvn:io.perfmark/perfmark-api/0.17.0$Bundle-SymbolicName=perfmark-api&amp;Bundle-Version=0.17.0&amp;Import-Package=*;resolution:=optional</bundle>
<!-- to keep this in mind in case it doesn't work without the classifier: https://github.com/grpc/grpc-java/blob/master/SECURITY.md#openssl-statically-linked-netty-tcnative-boringssl-static -->
<bundle dependency='true'>mvn:io.netty/netty-tcnative-boringssl-static/2.0.30.Final</bundle>

<bundle start-level="85">mvn:org.apache.brooklyn/brooklyn-locations-container/${project.version}</bundle>
</feature>


<feature name="brooklyn-test-framework" version="${project.version}" description="Brooklyn Test Framework" >
<bundle>mvn:org.apache.brooklyn/brooklyn-test-framework/${project.version}</bundle>
</feature>
Expand Down
30 changes: 30 additions & 0 deletions locations/container/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

# Kubernetes Location

Brooklyn Container Location has an extensive support for Kubernetes deployments
In particular, it supports

- KubernetesResource
- KubernetesHelmChart
- KubernetesContainer

## Kubernets Helm Chart

Here's an example of an Helm based blueprint

```YAML
location:
kubernetes:
endpoint: https://localhost:6443
kubeconfig: /home/user/.kube/config
services:
- type: org.apache.brooklyn.container.entity.kubernetes.KubernetesHelmChart
name: jenkins-helm
chartName: jenkins
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a way to load a chart embedded in a BOM? that would be handy to document here.

Copy link
Contributor Author

@iuliana iuliana May 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure yet, solving the dependency hell is still ongoing.

```

Notice, in this case, it is pointing at a local k8s cluster (created using Docker on Mac) and specify a `kubeconfig`
file for connection details.

The `KubernetesHelmChart` entity will install the latest version of the `chart` named `jenkins` from the Chart repository `stable` at `https://kubernetes-charts.storage.googleapis.com/`
You can install a specific version of the chart by using `chartVersion` config key.
26 changes: 26 additions & 0 deletions locations/container/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,31 @@
</parent>

<dependencies>
<dependency>
<groupId>org.microbean</groupId>
<artifactId>microbean-helm</artifactId>
<version>2.12.4-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_annotations</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-boringssl-static</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- Added this dependency explicitly, to calm down IntelliJ IDEA and also upgrade this -->
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-boringssl-static</artifactId>
<version>2.0.30.Final</version>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>openshift-client</artifactId>
Expand Down Expand Up @@ -150,4 +175,5 @@
<scope>test</scope>
</dependency>
</dependencies>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* 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.brooklyn.container.entity.kubernetes;

import org.apache.brooklyn.api.entity.ImplementedBy;
import org.apache.brooklyn.config.ConfigKey;
import org.apache.brooklyn.core.config.ConfigKeys;
import org.apache.brooklyn.entity.software.base.SoftwareProcess;

@ImplementedBy(KubernetesHelmChartImpl.class)
public interface KubernetesHelmChart extends SoftwareProcess {

ConfigKey<String> CHART_NAME = ConfigKeys.builder(String.class)
.name("chartName")
.description("Helm Chart name")
.build();

ConfigKey<String> CHART_VERSION = ConfigKeys.builder(String.class)
.name("chartVersion")
.description("Helm Chart version")
.build();
}
Loading