Skip to content

Commit dc1b6a5

Browse files
committed
Incorporating contents of #184. Overall version refresh. Incorporating spirit of #195.
Signed-off-by: Laird Nelson <[email protected]>
1 parent 44c15ab commit dc1b6a5

File tree

5 files changed

+159
-46
lines changed

5 files changed

+159
-46
lines changed

README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ to do these operations.
1818

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

2525
# Installation
2626

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

pom.xml

+26-19
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44

55
<groupId>org.microbean</groupId>
66
<artifactId>microbean-helm</artifactId>
7-
<version>2.8.2.1.1.2-SNAPSHOT</version>
7+
<version>2.12.3.0.0.1-SNAPSHOT</version>
88

99
<parent>
1010
<groupId>org.microbean</groupId>
1111
<artifactId>microbean-pluginmanagement-pom</artifactId>
12-
<version>5</version>
12+
<version>9</version>
13+
<relativePath/>
1314
</parent>
1415

1516
<name>microBean Helm</name>
@@ -57,50 +58,50 @@
5758
<dependency>
5859
<groupId>com.google.protobuf</groupId>
5960
<artifactId>protobuf-java</artifactId>
60-
<version>3.5.1</version>
61+
<version>3.6.1</version>
6162
<type>jar</type>
6263
</dependency>
6364

6465
<dependency>
6566
<groupId>io.grpc</groupId>
6667
<artifactId>grpc-netty</artifactId>
67-
<version>1.10.0</version>
68+
<version>1.18.0</version>
6869
<type>jar</type>
6970
</dependency>
7071

7172
<dependency>
7273
<groupId>io.grpc</groupId>
7374
<artifactId>grpc-protobuf</artifactId>
74-
<version>1.10.0</version>
75+
<version>1.18.0</version>
7576
<type>jar</type>
7677
</dependency>
7778

7879
<dependency>
7980
<groupId>io.grpc</groupId>
8081
<artifactId>grpc-services</artifactId>
81-
<version>1.10.0</version>
82+
<version>1.18.0</version>
8283
<type>jar</type>
8384
</dependency>
8485

8586
<dependency>
8687
<groupId>io.grpc</groupId>
8788
<artifactId>grpc-stub</artifactId>
88-
<version>1.10.0</version>
89+
<version>1.18.0</version>
8990
<type>jar</type>
9091
</dependency>
9192

9293
<dependency>
9394
<groupId>io.fabric8</groupId>
9495
<artifactId>kubernetes-client</artifactId>
95-
<version>3.1.8</version>
96+
<version>4.1.1</version>
9697
<type>jar</type>
9798
</dependency>
9899

99100
<!-- See https://github.com/grpc/grpc-java/blob/master/SECURITY.md#openssl-statically-linked-netty-tcnative-boringssl-static -->
100101
<dependency>
101102
<groupId>io.netty</groupId>
102103
<artifactId>netty-tcnative-boringssl-static</artifactId>
103-
<version>2.0.7.Final</version>
104+
<version>2.0.20.Final</version>
104105
<type>jar</type>
105106
<classifier>${os.detected.classifier}</classifier>
106107
</dependency>
@@ -125,18 +126,20 @@
125126
<version>0.1.1</version>
126127
<type>jar</type>
127128
</dependency>
128-
129+
130+
<!--
129131
<dependency>
130132
<groupId>org.slf4j</groupId>
131133
<artifactId>slf4j-simple</artifactId>
132134
<version>1.7.25</version>
133135
<type>jar</type>
134136
</dependency>
137+
-->
135138

136139
<dependency>
137140
<groupId>org.yaml</groupId>
138141
<artifactId>snakeyaml</artifactId>
139-
<version>1.20</version>
142+
<version>1.23</version>
140143
<type>jar</type>
141144
</dependency>
142145

@@ -244,12 +247,14 @@
244247
<scope>test</scope>
245248
</dependency>
246249

250+
<!--
247251
<dependency>
248252
<groupId>org.slf4j</groupId>
249253
<artifactId>slf4j-simple</artifactId>
250254
<type>jar</type>
251255
<scope>test</scope>
252256
</dependency>
257+
-->
253258

254259
</dependencies>
255260

@@ -259,7 +264,7 @@
259264
<extension>
260265
<groupId>kr.motd.maven</groupId>
261266
<artifactId>os-maven-plugin</artifactId>
262-
<version>1.5.0.Final</version>
267+
<version>1.6.2</version>
263268
</extension>
264269
</extensions>
265270

@@ -271,7 +276,7 @@
271276

272277
<resource>
273278
<targetPath>META-INF</targetPath>
274-
<directory />
279+
<directory>${project.basedir}</directory>
275280
<includes>
276281
<include>LICENSE</include>
277282
</includes>
@@ -306,14 +311,16 @@
306311

307312
<plugin>
308313
<artifactId>maven-scm-plugin</artifactId>
309-
<version>1.9.5</version>
314+
<version>1.11.1</version>
310315
</plugin>
311316

317+
<!--
312318
<plugin>
313319
<groupId>org.codehaus.mojo</groupId>
314320
<artifactId>findbugs-maven-plugin</artifactId>
315321
<version>3.0.4</version>
316322
</plugin>
323+
-->
317324

318325
<plugin>
319326
<groupId>org.jboss.jandex</groupId>
@@ -324,7 +331,7 @@
324331
<plugin>
325332
<groupId>org.xolstice.maven.plugins</groupId>
326333
<artifactId>protobuf-maven-plugin</artifactId>
327-
<version>0.5.1</version>
334+
<version>0.6.1</version>
328335
</plugin>
329336

330337
</plugins>
@@ -379,7 +386,7 @@
379386
<checkoutDirectory>${project.build.directory}/generated-sources/helm</checkoutDirectory>
380387
<connectionUrl>scm:git:https://github.com/kubernetes/helm.git</connectionUrl>
381388
<includes>_proto/hapi/**</includes>
382-
<scmVersion>v2.8.2</scmVersion>
389+
<scmVersion>v2.12.3</scmVersion>
383390
<scmVersionType>tag</scmVersionType>
384391
</configuration>
385392
</execution>
@@ -428,10 +435,10 @@
428435
</goals>
429436
<configuration>
430437
<checkStaleness>true</checkStaleness>
431-
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.10.0:exe:${os.detected.classifier}</pluginArtifact>
438+
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.18.0:exe:${os.detected.classifier}</pluginArtifact>
432439
<pluginId>grpc-java</pluginId>
433440
<protoSourceRoot>${project.build.directory}/generated-sources/helm/_proto</protoSourceRoot>
434-
<protocArtifact>com.google.protobuf:protoc:3.5.1-1:exe:${os.detected.classifier}</protocArtifact>
441+
<protocArtifact>com.google.protobuf:protoc:3.6.1:exe:${os.detected.classifier}</protocArtifact>
435442
</configuration>
436443
</execution>
437444
</executions>
@@ -449,7 +456,7 @@
449456

450457
<!-- maven-javadoc-plugin properties; see https://maven.apache.org/plugins/maven-javadoc-plugin/javadoc-mojo.html -->
451458
<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>
452-
<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>
459+
<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>
453460
<stylesheetfile>css/stylesheet.css</stylesheetfile>
454461

455462
<!-- maven-release-plugin properties; see http://maven.apache.org/maven-release/maven-release-plugin/perform-mojo.html -->

src/main/java/org/microbean/helm/Tiller.java

+107-6
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@
2929

3030
import java.util.concurrent.TimeUnit;
3131

32+
import java.util.function.Function;
33+
3234
import hapi.services.tiller.ReleaseServiceGrpc;
3335
import hapi.services.tiller.ReleaseServiceGrpc.ReleaseServiceBlockingStub;
3436
import hapi.services.tiller.ReleaseServiceGrpc.ReleaseServiceFutureStub;
@@ -85,7 +87,7 @@ public class Tiller implements ConfigAware<Config>, Closeable {
8587
*
8688
* <p>This field is never {@code null}.</p>
8789
*/
88-
public static final String VERSION = "2.8.2";
90+
public static final String VERSION = "2.12.3";
8991

9092
/**
9193
* The Kubernetes namespace into which Tiller server instances are
@@ -207,13 +209,43 @@ public Tiller(final ManagedChannel channel) {
207209
*
208210
* @exception NullPointerException if {@code portForward} is {@code
209211
* null}
212+
*
213+
* @see #Tiller(LocalPortForward, Function)
210214
*/
211215
public Tiller(final LocalPortForward portForward) {
216+
this(portForward, null);
217+
}
218+
219+
/**
220+
* Creates a new {@link Tiller} that will use information from the
221+
* supplied {@link LocalPortForward} to establish a communications
222+
* channel with the Tiller server.
223+
*
224+
* @param portForward the {@link LocalPortForward} to use; must not
225+
* be {@code null}
226+
*
227+
* @param channelBuilder a {@link Function} capable of accepting a
228+
* {@link LocalPortForward} and returning a new {@link
229+
* ManagedChannel}; if {@code null} the {@link
230+
* #buildChannel(LocalPortForward)} method will be used instead; if
231+
* non-{@code null} then the {@link #buildChannel(LocalPortForward)}
232+
* method will never be called
233+
*
234+
* @exception NullPointerException if {@code portForward} is {@code
235+
* null}
236+
*
237+
* @see #Tiller(LocalPortForward, Function)
238+
*/
239+
public Tiller(final LocalPortForward portForward, final Function<? super LocalPortForward, ? extends ManagedChannel> channelBuilder) {
212240
super();
213241
Objects.requireNonNull(portForward);
214242
this.config = null;
215243
this.portForward = null; // yes, null
216-
this.channel = this.buildChannel(portForward);
244+
if (channelBuilder == null) {
245+
this.channel = this.buildChannel(portForward);
246+
} else {
247+
this.channel = channelBuilder.apply(portForward);
248+
}
217249
}
218250

219251
/**
@@ -242,9 +274,11 @@ public Tiller(final LocalPortForward portForward) {
242274
* identifying a Pod within the cluster that houses a Tiller instance
243275
*
244276
* @exception NullPointerException if {@code client} is {@code null}
277+
*
278+
* @see #Tiller(HttpClientAware, String, int, Map, Function)
245279
*/
246280
public <T extends HttpClientAware & KubernetesClient> Tiller(final T client) throws MalformedURLException {
247-
this(client, DEFAULT_NAMESPACE, DEFAULT_PORT, DEFAULT_LABELS);
281+
this(client, DEFAULT_NAMESPACE, DEFAULT_PORT, DEFAULT_LABELS, null);
248282
}
249283

250284
/**
@@ -283,9 +317,11 @@ public <T extends HttpClientAware & KubernetesClient> Tiller(final T client) thr
283317
*
284318
* @exception TillerException if a ready Tiller pod could not be
285319
* found and consequently a connection could not be established
320+
*
321+
* @see #Tiller(HttpClientAware, String, int, Map, Function)
286322
*/
287323
public <T extends HttpClientAware & KubernetesClient> Tiller(final T client, final String namespaceHousingTiller) throws MalformedURLException {
288-
this(client, namespaceHousingTiller, DEFAULT_PORT, DEFAULT_LABELS);
324+
this(client, namespaceHousingTiller, DEFAULT_PORT, DEFAULT_LABELS, null);
289325
}
290326

291327
/**
@@ -330,11 +366,72 @@ public <T extends HttpClientAware & KubernetesClient> Tiller(final T client, fin
330366
*
331367
* @exception TillerException if a ready Tiller pod could not be
332368
* found and consequently a connection could not be established
369+
*
370+
* @see #Tiller(HttpClientAware, String, int, Map, Function)
333371
*/
334372
public <T extends HttpClientAware & KubernetesClient> Tiller(final T client,
335373
String namespaceHousingTiller,
336374
int tillerPort,
337-
Map<String, String> tillerLabels) throws MalformedURLException {
375+
Map<String, String> tillerLabels)
376+
throws MalformedURLException {
377+
this(client, namespaceHousingTiller, tillerPort, tillerLabels, null);
378+
}
379+
380+
/**
381+
* Creates a new {@link Tiller} that will forward a local port to
382+
* the supplied (remote) port on a Pod housing Tiller in the supplied
383+
* namespace running in the Kubernetes cluster with which the
384+
* supplied {@link KubernetesClient} is capable of communicating.
385+
*
386+
* <p>The {@linkplain Pods#getFirstReadyPod(Listable) first ready
387+
* Pod} with labels matching the supplied {@code tillerLabels} is
388+
* deemed to be the pod housing the Tiller instance to connect
389+
* to.</p>
390+
*
391+
* @param <T> a {@link KubernetesClient} implementation that is also
392+
* an {@link HttpClientAware} implementation, such as {@link
393+
* DefaultKubernetesClient}
394+
*
395+
* @param client the {@link KubernetesClient}-and-{@link
396+
* HttpClientAware} implementation that can communicate with a
397+
* Kubernetes cluster; must not be {@code null}; no reference to
398+
* this object is retained by this {@link Tiller} instance
399+
*
400+
* @param namespaceHousingTiller the namespace within which a Tiller
401+
* instance is hopefully running; if {@code null}, then the value of
402+
* {@link #DEFAULT_NAMESPACE} will be used instead
403+
*
404+
* @param tillerPort the remote port to attempt to forward a local
405+
* port to; normally {@code 44134}
406+
*
407+
* @param tillerLabels a {@link Map} representing the Kubernetes
408+
* labels (and their values) identifying a Pod housing a Tiller
409+
* instance; if {@code null} then the value of {@link
410+
* #DEFAULT_LABELS} will be used instead
411+
*
412+
* @param channelBuilder a {@link Function} capable of accepting a
413+
* {@link LocalPortForward} and returning a new {@link
414+
* ManagedChannel}; if {@code null} the {@link
415+
* #buildChannel(LocalPortForward)} method will be used instead; if
416+
* non-{@code null} then the {@link #buildChannel(LocalPortForward)}
417+
* method will never be called
418+
*
419+
* @exception MalformedURLException if there was a problem
420+
* identifying a Pod within the cluster that houses a Tiller instance
421+
*
422+
* @exception NullPointerException if {@code client} is {@code null}
423+
*
424+
* @exception KubernetesClientException if there was a problem
425+
* connecting to Kubernetes
426+
*
427+
* @exception TillerException if a ready Tiller pod could not be
428+
* found and consequently a connection could not be established
429+
*/
430+
public <T extends HttpClientAware & KubernetesClient> Tiller(final T client,
431+
String namespaceHousingTiller,
432+
int tillerPort,
433+
Map<String, String> tillerLabels,
434+
Function<? super LocalPortForward, ? extends ManagedChannel> channelBuilder) throws MalformedURLException {
338435
super();
339436
Objects.requireNonNull(client);
340437
this.config = client.getConfiguration();
@@ -357,7 +454,11 @@ public <T extends HttpClientAware & KubernetesClient> Tiller(final T client,
357454
if (this.portForward == null) {
358455
throw new TillerException("Could not forward port to a Ready Tiller pod's port " + tillerPort + " in namespace " + namespaceHousingTiller + " with labels " + tillerLabels);
359456
}
360-
this.channel = this.buildChannel(this.portForward);
457+
if (channelBuilder == null) {
458+
this.channel = this.buildChannel(this.portForward);
459+
} else {
460+
this.channel = channelBuilder.apply(this.portForward);
461+
}
361462
}
362463

363464

0 commit comments

Comments
 (0)