Skip to content

Commit

Permalink
Incorporating contents of #184. Overall version refresh. Incorporatin…
Browse files Browse the repository at this point in the history
…g spirit of #195.

Signed-off-by: Laird Nelson <[email protected]>
  • Loading branch information
ljnelson committed Feb 14, 2019
1 parent 44c15ab commit dc1b6a5
Show file tree
Hide file tree
Showing 5 changed files with 159 additions and 46 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ to do these operations.

The microBean Helm project's version number tracks the Helm and Tiller
release it works with, together with its own version semantics. For
example, a microBean Helm version of `2.8.2.1.1.0` means that the Helm
version it tracks is `2.8.2` and the (SemVer-compatible) version of
the non-generated code that is part of _this_ project is `1.1.0`.
example, a microBean Helm version of `2.12.3.0.0.1` means that the Helm
version it tracks is `2.12.3` and the (SemVer-compatible) version of
the non-generated code that is part of _this_ project is `0.0.1`.

# Installation

Expand All @@ -32,7 +32,7 @@ like this:
<groupId>org.microbean</groupId>
<artifactId>microbean-helm</artifactId>
<!-- See http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.microbean%22%20AND%20a%3A%22microbean-helm%22 for available releases. -->
<version>2.8.2.1.1.0</version>
<version>2.12.3.0.0.1</version>
<type>jar</type>
</dependency>

Expand Down
45 changes: 26 additions & 19 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@

<groupId>org.microbean</groupId>
<artifactId>microbean-helm</artifactId>
<version>2.8.2.1.1.2-SNAPSHOT</version>
<version>2.12.3.0.0.1-SNAPSHOT</version>

<parent>
<groupId>org.microbean</groupId>
<artifactId>microbean-pluginmanagement-pom</artifactId>
<version>5</version>
<version>9</version>
<relativePath/>
</parent>

<name>microBean Helm</name>
Expand Down Expand Up @@ -57,50 +58,50 @@
<dependency>
<groupId>com.google.protobuf</groupId>
<artifactId>protobuf-java</artifactId>
<version>3.5.1</version>
<version>3.6.1</version>
<type>jar</type>
</dependency>

<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-netty</artifactId>
<version>1.10.0</version>
<version>1.18.0</version>
<type>jar</type>
</dependency>

<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-protobuf</artifactId>
<version>1.10.0</version>
<version>1.18.0</version>
<type>jar</type>
</dependency>

<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-services</artifactId>
<version>1.10.0</version>
<version>1.18.0</version>
<type>jar</type>
</dependency>

<dependency>
<groupId>io.grpc</groupId>
<artifactId>grpc-stub</artifactId>
<version>1.10.0</version>
<version>1.18.0</version>
<type>jar</type>
</dependency>

<dependency>
<groupId>io.fabric8</groupId>
<artifactId>kubernetes-client</artifactId>
<version>3.1.8</version>
<version>4.1.1</version>
<type>jar</type>
</dependency>

<!-- See https://github.com/grpc/grpc-java/blob/master/SECURITY.md#openssl-statically-linked-netty-tcnative-boringssl-static -->
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-tcnative-boringssl-static</artifactId>
<version>2.0.7.Final</version>
<version>2.0.20.Final</version>
<type>jar</type>
<classifier>${os.detected.classifier}</classifier>
</dependency>
Expand All @@ -125,18 +126,20 @@
<version>0.1.1</version>
<type>jar</type>
</dependency>


<!--
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.25</version>
<type>jar</type>
</dependency>
-->

<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.20</version>
<version>1.23</version>
<type>jar</type>
</dependency>

Expand Down Expand Up @@ -244,12 +247,14 @@
<scope>test</scope>
</dependency>

<!--
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<type>jar</type>
<scope>test</scope>
</dependency>
-->

</dependencies>

Expand All @@ -259,7 +264,7 @@
<extension>
<groupId>kr.motd.maven</groupId>
<artifactId>os-maven-plugin</artifactId>
<version>1.5.0.Final</version>
<version>1.6.2</version>
</extension>
</extensions>

Expand All @@ -271,7 +276,7 @@

<resource>
<targetPath>META-INF</targetPath>
<directory />
<directory>${project.basedir}</directory>
<includes>
<include>LICENSE</include>
</includes>
Expand Down Expand Up @@ -306,14 +311,16 @@

<plugin>
<artifactId>maven-scm-plugin</artifactId>
<version>1.9.5</version>
<version>1.11.1</version>
</plugin>

<!--
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>3.0.4</version>
</plugin>
-->

<plugin>
<groupId>org.jboss.jandex</groupId>
Expand All @@ -324,7 +331,7 @@
<plugin>
<groupId>org.xolstice.maven.plugins</groupId>
<artifactId>protobuf-maven-plugin</artifactId>
<version>0.5.1</version>
<version>0.6.1</version>
</plugin>

</plugins>
Expand Down Expand Up @@ -379,7 +386,7 @@
<checkoutDirectory>${project.build.directory}/generated-sources/helm</checkoutDirectory>
<connectionUrl>scm:git:https://github.com/kubernetes/helm.git</connectionUrl>
<includes>_proto/hapi/**</includes>
<scmVersion>v2.8.2</scmVersion>
<scmVersion>v2.12.3</scmVersion>
<scmVersionType>tag</scmVersionType>
</configuration>
</execution>
Expand Down Expand Up @@ -428,10 +435,10 @@
</goals>
<configuration>
<checkStaleness>true</checkStaleness>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.10.0:exe:${os.detected.classifier}</pluginArtifact>
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.18.0:exe:${os.detected.classifier}</pluginArtifact>
<pluginId>grpc-java</pluginId>
<protoSourceRoot>${project.build.directory}/generated-sources/helm/_proto</protoSourceRoot>
<protocArtifact>com.google.protobuf:protoc:3.5.1-1:exe:${os.detected.classifier}</protocArtifact>
<protocArtifact>com.google.protobuf:protoc:3.6.1:exe:${os.detected.classifier}</protocArtifact>
</configuration>
</execution>
</executions>
Expand All @@ -449,7 +456,7 @@

<!-- maven-javadoc-plugin properties; see https://maven.apache.org/plugins/maven-javadoc-plugin/javadoc-mojo.html -->
<doctitle>&lt;a href="${project.url}" target="_parent"&gt;&lt;span style="font-family:Lobster, cursive;"&gt;µb&lt;/span&gt; ${project.artifactId}&lt;/a&gt; ${project.version} &lt;a href="https://travis-ci.org/microbean/${project.artifactId}" target="_parent"&gt;&lt;img src="https://travis-ci.org/microbean/${project.artifactId}.svg?branch=master"&gt;&lt;/a&gt;</doctitle>
<links>https://www.grpc.io/grpc-java/javadoc/,https://developers.google.com/protocol-buffers/docs/reference/java/,https://google.github.io/guava/releases/19.0/api/docs/,https://microbean.github.io/microbean-kubernetes/apidocs/,https://microbean.github.io/microbean-development-annotations/apidocs/,http://static.javadoc.io/com.github.zafarkhaja/java-semver/0.9.0,http://static.javadoc.io/io.fabric8/kubernetes-client/3.1.8,http://static.javadoc.io/io.fabric8/kubernetes-model/2.0.4,http://static.javadoc.io/org.kamranzafar/jtar/2.3,http://static.javadoc.io/org.yaml/snakeyaml/1.19</links>
<links>https://www.grpc.io/grpc-java/javadoc/,https://developers.google.com/protocol-buffers/docs/reference/java/,https://google.github.io/guava/releases/19.0/api/docs/,https://microbean.github.io/microbean-kubernetes/apidocs/,https://microbean.github.io/microbean-development-annotations/apidocs/,http://static.javadoc.io/com.github.zafarkhaja/java-semver/0.9.0,http://static.javadoc.io/io.fabric8/kubernetes-client/4.1.1,http://static.javadoc.io/io.fabric8/kubernetes-model/4.1.1,http://static.javadoc.io/org.kamranzafar/jtar/2.3,http://static.javadoc.io/org.yaml/snakeyaml/1.19</links>
<stylesheetfile>css/stylesheet.css</stylesheetfile>

<!-- maven-release-plugin properties; see http://maven.apache.org/maven-release/maven-release-plugin/perform-mojo.html -->
Expand Down
113 changes: 107 additions & 6 deletions src/main/java/org/microbean/helm/Tiller.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@

import java.util.concurrent.TimeUnit;

import java.util.function.Function;

import hapi.services.tiller.ReleaseServiceGrpc;
import hapi.services.tiller.ReleaseServiceGrpc.ReleaseServiceBlockingStub;
import hapi.services.tiller.ReleaseServiceGrpc.ReleaseServiceFutureStub;
Expand Down Expand Up @@ -85,7 +87,7 @@ public class Tiller implements ConfigAware<Config>, Closeable {
*
* <p>This field is never {@code null}.</p>
*/
public static final String VERSION = "2.8.2";
public static final String VERSION = "2.12.3";

/**
* The Kubernetes namespace into which Tiller server instances are
Expand Down Expand Up @@ -207,13 +209,43 @@ public Tiller(final ManagedChannel channel) {
*
* @exception NullPointerException if {@code portForward} is {@code
* null}
*
* @see #Tiller(LocalPortForward, Function)
*/
public Tiller(final LocalPortForward portForward) {
this(portForward, null);
}

/**
* Creates a new {@link Tiller} that will use information from the
* supplied {@link LocalPortForward} to establish a communications
* channel with the Tiller server.
*
* @param portForward the {@link LocalPortForward} to use; must not
* be {@code null}
*
* @param channelBuilder a {@link Function} capable of accepting a
* {@link LocalPortForward} and returning a new {@link
* ManagedChannel}; if {@code null} the {@link
* #buildChannel(LocalPortForward)} method will be used instead; if
* non-{@code null} then the {@link #buildChannel(LocalPortForward)}
* method will never be called
*
* @exception NullPointerException if {@code portForward} is {@code
* null}
*
* @see #Tiller(LocalPortForward, Function)
*/
public Tiller(final LocalPortForward portForward, final Function<? super LocalPortForward, ? extends ManagedChannel> channelBuilder) {
super();
Objects.requireNonNull(portForward);
this.config = null;
this.portForward = null; // yes, null
this.channel = this.buildChannel(portForward);
if (channelBuilder == null) {
this.channel = this.buildChannel(portForward);
} else {
this.channel = channelBuilder.apply(portForward);
}
}

/**
Expand Down Expand Up @@ -242,9 +274,11 @@ public Tiller(final LocalPortForward portForward) {
* identifying a Pod within the cluster that houses a Tiller instance
*
* @exception NullPointerException if {@code client} is {@code null}
*
* @see #Tiller(HttpClientAware, String, int, Map, Function)
*/
public <T extends HttpClientAware & KubernetesClient> Tiller(final T client) throws MalformedURLException {
this(client, DEFAULT_NAMESPACE, DEFAULT_PORT, DEFAULT_LABELS);
this(client, DEFAULT_NAMESPACE, DEFAULT_PORT, DEFAULT_LABELS, null);
}

/**
Expand Down Expand Up @@ -283,9 +317,11 @@ public <T extends HttpClientAware & KubernetesClient> Tiller(final T client) thr
*
* @exception TillerException if a ready Tiller pod could not be
* found and consequently a connection could not be established
*
* @see #Tiller(HttpClientAware, String, int, Map, Function)
*/
public <T extends HttpClientAware & KubernetesClient> Tiller(final T client, final String namespaceHousingTiller) throws MalformedURLException {
this(client, namespaceHousingTiller, DEFAULT_PORT, DEFAULT_LABELS);
this(client, namespaceHousingTiller, DEFAULT_PORT, DEFAULT_LABELS, null);
}

/**
Expand Down Expand Up @@ -330,11 +366,72 @@ public <T extends HttpClientAware & KubernetesClient> Tiller(final T client, fin
*
* @exception TillerException if a ready Tiller pod could not be
* found and consequently a connection could not be established
*
* @see #Tiller(HttpClientAware, String, int, Map, Function)
*/
public <T extends HttpClientAware & KubernetesClient> Tiller(final T client,
String namespaceHousingTiller,
int tillerPort,
Map<String, String> tillerLabels) throws MalformedURLException {
Map<String, String> tillerLabels)
throws MalformedURLException {
this(client, namespaceHousingTiller, tillerPort, tillerLabels, null);
}

/**
* Creates a new {@link Tiller} that will forward a local port to
* the supplied (remote) port on a Pod housing Tiller in the supplied
* namespace running in the Kubernetes cluster with which the
* supplied {@link KubernetesClient} is capable of communicating.
*
* <p>The {@linkplain Pods#getFirstReadyPod(Listable) first ready
* Pod} with labels matching the supplied {@code tillerLabels} is
* deemed to be the pod housing the Tiller instance to connect
* to.</p>
*
* @param <T> a {@link KubernetesClient} implementation that is also
* an {@link HttpClientAware} implementation, such as {@link
* DefaultKubernetesClient}
*
* @param client the {@link KubernetesClient}-and-{@link
* HttpClientAware} implementation that can communicate with a
* Kubernetes cluster; must not be {@code null}; no reference to
* this object is retained by this {@link Tiller} instance
*
* @param namespaceHousingTiller the namespace within which a Tiller
* instance is hopefully running; if {@code null}, then the value of
* {@link #DEFAULT_NAMESPACE} will be used instead
*
* @param tillerPort the remote port to attempt to forward a local
* port to; normally {@code 44134}
*
* @param tillerLabels a {@link Map} representing the Kubernetes
* labels (and their values) identifying a Pod housing a Tiller
* instance; if {@code null} then the value of {@link
* #DEFAULT_LABELS} will be used instead
*
* @param channelBuilder a {@link Function} capable of accepting a
* {@link LocalPortForward} and returning a new {@link
* ManagedChannel}; if {@code null} the {@link
* #buildChannel(LocalPortForward)} method will be used instead; if
* non-{@code null} then the {@link #buildChannel(LocalPortForward)}
* method will never be called
*
* @exception MalformedURLException if there was a problem
* identifying a Pod within the cluster that houses a Tiller instance
*
* @exception NullPointerException if {@code client} is {@code null}
*
* @exception KubernetesClientException if there was a problem
* connecting to Kubernetes
*
* @exception TillerException if a ready Tiller pod could not be
* found and consequently a connection could not be established
*/
public <T extends HttpClientAware & KubernetesClient> Tiller(final T client,
String namespaceHousingTiller,
int tillerPort,
Map<String, String> tillerLabels,
Function<? super LocalPortForward, ? extends ManagedChannel> channelBuilder) throws MalformedURLException {
super();
Objects.requireNonNull(client);
this.config = client.getConfiguration();
Expand All @@ -357,7 +454,11 @@ public <T extends HttpClientAware & KubernetesClient> Tiller(final T client,
if (this.portForward == null) {
throw new TillerException("Could not forward port to a Ready Tiller pod's port " + tillerPort + " in namespace " + namespaceHousingTiller + " with labels " + tillerLabels);
}
this.channel = this.buildChannel(this.portForward);
if (channelBuilder == null) {
this.channel = this.buildChannel(this.portForward);
} else {
this.channel = channelBuilder.apply(this.portForward);
}
}


Expand Down
Loading

0 comments on commit dc1b6a5

Please sign in to comment.