fix dependencies
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/d1b4941a Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/d1b4941a Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/d1b4941a Branch: refs/heads/master Commit: d1b4941aba8cb98367410dc0353d78a7ebcf58ef Parents: 02b457d Author: andreaturli <andrea.tu...@gmail.com> Authored: Mon Mar 26 10:48:24 2018 +0200 Committer: andreaturli <andrea.tu...@gmail.com> Committed: Mon Mar 26 10:48:24 2018 +0200 ---------------------------------------------------------------------- locations/container/README.md | 30 ++++++++++++++++ locations/container/pom.xml | 37 +++++++------------- .../KubernetesClientRegistryImpl.java | 3 +- .../location/kubernetes/KubernetesLocation.java | 9 ++++- pom.xml | 2 +- 5 files changed, 54 insertions(+), 27 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d1b4941a/locations/container/README.md ---------------------------------------------------------------------- diff --git a/locations/container/README.md b/locations/container/README.md new file mode 100644 index 0000000..5c62b01 --- /dev/null +++ b/locations/container/README.md @@ -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. \ No newline at end of file http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d1b4941a/locations/container/pom.xml ---------------------------------------------------------------------- diff --git a/locations/container/pom.xml b/locations/container/pom.xml index 56f0bf4..cc24aea 100644 --- a/locations/container/pom.xml +++ b/locations/container/pom.xml @@ -31,53 +31,35 @@ <relativePath>../../parent/pom.xml</relativePath> </parent> - <properties> - <kubernetes-client.version>2.5.6</kubernetes-client.version> - </properties> - <dependencies> <dependency> + <!-- depends on io.fabric8:kubernetes-client, version should always match --> <groupId>org.microbean</groupId> <artifactId>microbean-helm</artifactId> - <version>2.7.2.1.0.0</version> + <version>2.8.2.1.0.3</version> <exclusions> - <exclusion> - <groupId>com.google.api.grpc</groupId> - <artifactId>proto-google-common-protos</artifactId> - </exclusion> + <!-- jclouds depends on a previous version --> <exclusion> <groupId>com.google.errorprone</groupId> <artifactId>error_prone_annotations</artifactId> </exclusion> - <exclusion> - <groupId>io.grpc</groupId> - <artifactId>grpc-context</artifactId> - </exclusion> </exclusions> </dependency> <dependency> - <groupId>io.grpc</groupId> - <artifactId>grpc-context</artifactId> - <version>1.4.0</version> + <groupId>com.squareup.okio</groupId> + <artifactId>okio</artifactId> + <version>1.13.0</version> </dependency> <dependency> <groupId>io.fabric8</groupId> <artifactId>kubernetes-client</artifactId> <version>${kubernetes-client.version}</version> - <classifier>bundle</classifier> - <exclusions> - <exclusion> - <groupId>com.squareup.okio</groupId> - <artifactId>okio</artifactId> - </exclusion> - </exclusions> </dependency> <dependency> <groupId>io.fabric8</groupId> <artifactId>openshift-client</artifactId> <version>${kubernetes-client.version}</version> - <classifier>bundle</classifier> </dependency> <dependency> <groupId>org.apache.brooklyn</groupId> @@ -95,6 +77,13 @@ <groupId>org.apache.brooklyn</groupId> <artifactId>brooklyn-locations-jclouds</artifactId> <version>${brooklyn.version}</version> + <!-- io.fabric8:kubernetes-client and jclouds require different versions --> + <exclusions> + <exclusion> + <groupId>com.squareup.okio</groupId> + <artifactId>okio</artifactId> + </exclusion> + </exclusions> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d1b4941a/locations/container/src/main/java/org/apache/brooklyn/container/location/kubernetes/KubernetesClientRegistryImpl.java ---------------------------------------------------------------------- diff --git a/locations/container/src/main/java/org/apache/brooklyn/container/location/kubernetes/KubernetesClientRegistryImpl.java b/locations/container/src/main/java/org/apache/brooklyn/container/location/kubernetes/KubernetesClientRegistryImpl.java index 8ac1c64..6878ac1 100644 --- a/locations/container/src/main/java/org/apache/brooklyn/container/location/kubernetes/KubernetesClientRegistryImpl.java +++ b/locations/container/src/main/java/org/apache/brooklyn/container/location/kubernetes/KubernetesClientRegistryImpl.java @@ -106,7 +106,8 @@ public class KubernetesClientRegistryImpl implements KubernetesClientRegistry { configBuilder.withMasterUrl(cluster.getServer()); configBuilder.withCaCertFile(getRelativeFile(cluster.getCertificateAuthority(), configFolder)); configBuilder.withCaCertData(cluster.getCertificateAuthorityData()); - configBuilder.withApiVersion(Optional.fromNullable(cluster.getApiVersion()).or("v1")); + // FIXME + // configBuilder.withApiVersion(Optional.fromNullable(cluster.getApiVersion()).or("v1")); configBuilder.withTrustCerts(Boolean.TRUE.equals(cluster.getInsecureSkipTlsVerify())); LOG.debug("Cluster {} server: {}", clusterName, cluster.getServer()); LOG.debug("Cluster {} additional properties: {}", clusterName, cluster.getAdditionalProperties()); http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d1b4941a/locations/container/src/main/java/org/apache/brooklyn/container/location/kubernetes/KubernetesLocation.java ---------------------------------------------------------------------- diff --git a/locations/container/src/main/java/org/apache/brooklyn/container/location/kubernetes/KubernetesLocation.java b/locations/container/src/main/java/org/apache/brooklyn/container/location/kubernetes/KubernetesLocation.java index 0b6c2b5..3a10449 100644 --- a/locations/container/src/main/java/org/apache/brooklyn/container/location/kubernetes/KubernetesLocation.java +++ b/locations/container/src/main/java/org/apache/brooklyn/container/location/kubernetes/KubernetesLocation.java @@ -139,6 +139,7 @@ import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.Callable; +import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; @@ -312,14 +313,19 @@ public class KubernetesLocation extends AbstractLocation implements MachineProvi final String releaseName = entity.sensors().get(KubernetesResource.RESOURCE_NAME); ReleaseManager chartManager = new ReleaseManager(tiller); try { - Future<UninstallReleaseResponse> response = chartManager.uninstall(UninstallReleaseRequest.newBuilder() + Future<UninstallReleaseResponse> uninstallReleaseResponseFuture = chartManager.uninstall(UninstallReleaseRequest.newBuilder() .setTimeout(300L) .setName(releaseName) .setPurge(true) .build()); + UninstallReleaseResponse response = uninstallReleaseResponseFuture.get(); LOG.debug("Release {} uninstalled", response); } catch (IOException e) { throw Throwables.propagate(e); + } catch (InterruptedException e) { + throw Throwables.propagate(e); + } catch (ExecutionException e) { + throw Throwables.propagate(e); } } @@ -561,6 +567,7 @@ public class KubernetesLocation extends AbstractLocation implements MachineProvi } Chart.Builder chartBuilder = chartRepository.resolve(chartName, chartVersion); + Future<InstallReleaseResponse> releaseFuture = chartManager.install(requestBuilder, chartBuilder); Release release = releaseFuture.get().getRelease(); http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d1b4941a/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index cf97425..22aff1c 100644 --- a/pom.xml +++ b/pom.xml @@ -173,7 +173,7 @@ <karaf.version>4.1.2</karaf.version> <karaf.plugin.version>4.1.1</karaf.plugin.version> <felix-osgi-compendium.version>1.4.0</felix-osgi-compendium.version> - <kubernetes-client.version>1.4.27</kubernetes-client.version> + <kubernetes-client.version>3.1.8</kubernetes-client.version> <!-- Transitive dependencies, declared explicitly to avoid version mismatch --> <clojure.version>1.4.0</clojure.version> <zookeeper.version>3.3.4</zookeeper.version>