Skip to content

Commit

Permalink
Brings back the helm code
Browse files Browse the repository at this point in the history
Revert "Revert "This closes #830""

This reverts commit 4236ff2.
  • Loading branch information
Duncan Grant authored and iuliana committed May 12, 2020
1 parent 8b43eb2 commit 543c698
Show file tree
Hide file tree
Showing 9 changed files with 443 additions and 94 deletions.
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
```
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.
48 changes: 48 additions & 0 deletions locations/container/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@
</parent>

<dependencies>
<dependency>
<groupId>org.microbean</groupId>
<artifactId>microbean-helm</artifactId>
<version>2.8.2.1.1.1</version>
<exclusions>
<exclusion>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_annotations</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.fabric8</groupId>
<artifactId>openshift-client</artifactId>
Expand Down Expand Up @@ -150,4 +161,41 @@
<scope>test</scope>
</dependency>
</dependencies>


<build>
<extensions>
<!-- Use os-maven-plugin to initialize the "os.detected" properties -->
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.5.0.Final</version>
</extension>
</extensions>
<plugins>
<!-- Use Ant to configure the appropriate "tcnative.classifier" property -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>initialize</phase>
<configuration>
<exportAntProperties>true</exportAntProperties>
<target>
<condition property="tcnative.classifier"
value="${os.detected.classifier}-fedora"
else="${os.detected.classifier}">
<isset property="os.detected.release.fedora"/>
</condition>
</target>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* 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;
import org.apache.brooklyn.util.core.ResourcePredicates;

@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();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* 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.core.entity.BrooklynConfigKeys;
import org.apache.brooklyn.entity.software.base.EmptySoftwareProcessImpl;

public class KubernetesHelmChartImpl extends EmptySoftwareProcessImpl implements KubernetesHelmChart {

@Override
public void init() {
super.init();

config().set(BrooklynConfigKeys.SKIP_ON_BOX_BASE_DIR_RESOLUTION, true);
config().set(PROVISIONING_PROPERTIES.subKey("useJcloudsSshInit"), false);
config().set(PROVISIONING_PROPERTIES.subKey("waitForSshable"), false);
config().set(PROVISIONING_PROPERTIES.subKey("pollForFirstReachableAddress"), false);
config().set(EmptySoftwareProcessImpl.USE_SSH_MONITORING, false);
}

}
Loading

0 comments on commit 543c698

Please sign in to comment.