Skip to content

Instantly share code, notes, and snippets.

@ljnelson
Created June 17, 2017 04:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ljnelson/43b4342116732a56fcabe5d076625a3f to your computer and use it in GitHub Desktop.
Save ljnelson/43b4342116732a56fcabe5d076625a3f to your computer and use it in GitHub Desktop.
import java.util.List;
import hapi.release.ReleaseOuterClass.Release;
import hapi.services.tiller.ReleaseServiceGrpc;
import hapi.services.tiller.ReleaseServiceGrpc.ReleaseServiceBlockingStub;
import hapi.services.tiller.Tiller.GetHistoryRequest;
import hapi.services.tiller.Tiller.GetHistoryResponse;
import io.fabric8.kubernetes.client.DefaultKubernetesClient;
import org.microbean.helm.Tiller;
// Use a DefaultKubernetesClient to set up a port forwarding situation
// with a Tiller pod running in your cluster, and make sure both are
// in a try-with-resources block so they're closed properly:
try (final DefaultKubernetesClient client = new DefaultKubernetesClient();
final Tiller tiller = new Tiller(client)) {
// Let's do the equivalent of helm history someRelease.
final GetHistoryRequest.Builder builder = GetHistoryRequest.newBuilder();
assertNotNull(builder);
builder.setMax(1);
builder.setName(releaseName);
final GetHistoryRequest request = builder.build();
final ReleaseServiceBlockingStub stub = tiller.getReleaseServiceBlockingStub();
final GetHistoryResponse response = stub.getHistory(request);
final List<? extends Release> releasesList = response.getReleasesList();
final Release release = releasesList.get(0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment