diff --git a/tile-generator.html.md.erb b/tile-generator.html.md.erb index 03acbf19..30c9a0b5 100644 --- a/tile-generator.html.md.erb +++ b/tile-generator.html.md.erb @@ -521,10 +521,10 @@ in a Pivotal Cloud Foundry (PCF) environment. [Helm](https://helm.sh/) is a conv package Kubernetes services. Tile Generator provides a convenient way to package your Helm Chart, along with -the [Kibosh](https://github.com/cf-platform-eng/kibosh) OSBAPI broker into a PCF Tile. +the [Kibosh](https://github.com/cf-platform-eng/kibosh) OSBAPI broker, into a PCF Tile. When the tile is deployed, your Helm chart service will be available in the cf marketplace. -Developers can then `cf create-service` causing the chart to be helm installed on a +Developers can then `cf create-service` causing the chart to be Helm installed on a Kubernetes cluster, and developer can `cf bind` the service to their application. Use the following format in your tile.yml: @@ -538,24 +538,82 @@ By convention the name should match the name of the Helm chart found in Chart.ya helm_chart_dir is the path to the directory that contains Chart.yaml. Prior to running `tile build`, there are some minor modifications that -may need be done to your helm chart. As described in the Configuration section of the +may need be done to your Helm chart. As described in the Configuration section of the [Kibosh Readme](https://github.com/cf-platform-eng/kibosh/blob/master/README.md) you will need to: - Create a plans.yaml file that defines the naming of your service in the cf marketplace. - Create an images directory under helm_chart_dir. - Download the Docker images used by your Helm chart from your repository - (such as hub.docker.com) and put them into the images directory as .tgz files. - - Reference each of those Docker images in your values.yaml file. + (such as hub.docker.com) and put them into the images directory as .tgz files. You can name the + files arbitrarily as long as they have a .tgz extension. All .tgz Docker images in this directory + will be loaded by the tile into the private registry and the metadata inside the Docker image + is the link to the image definitions in values.yaml. + - Reference each of those Docker images in your values.yaml file. + - Modify any references to images in your Helm templates to point to the images using the + required values.yaml structure. These additions to the Helm chart allow the Kibosh broker and your tile to manage and deploy your Helm chart in a consistent way across the PCF environment. -Here are some limitations to be aware of when deploying Helm charts into PKS Kubernetes clusters: +Example of building [Apache Spark Helm Chart](https://github.com/kubernetes/charts/tree/master/stable/spark) into a tile: + +First, fetch the chart and the Docker images: +``` +$ git clone git@github.com:kubernetes/charts.git +$ cd charts/stable/spark +$ mkdir images && cd images +$ docker pull k8s.gcr.io/spark:1.5.1_v3 +$ docker save k8s.gcr.io/spark:1.5.1_v3 -o spark-1.5.1_v3.tgz +$ docker pull apache/zeppelin:0.7.3 +$ docker save apache/zeppelin:0.7.3 -o zeppelin-0.7.3.tgz +``` +NOTE: in order to find the Docker images paths, look in [values.yml](https://github.com/kubernetes/charts/blob/master/stable/spark/values.yaml). + +Next, modify values.yml and add: +``` +images: + spark: + image: "k8s.gcr.io/spark" + imageTag: "1.5.1_v3" + zeppelin: + image: "apache/zeppelin" + imageTag: "0.7.3" +``` + +Then, update your templates. Change references to `Image` and `ImageTag` (like this `{{ .Values.Master.Image }}`) to +the new image pattern (like `{{ .Values.images.spark.image }}`). Note that Helm charts may use different +patterns for specifying images. The purpose of this step is to make those references consistent. + +Create the tile. +``` +# Create a directory outside the helm chart used above. +$ mkdir spark-tile && cd spark-tile +$ tile init +``` +Replace the contents of tile.yml with the following: +``` +--- +name: spark +icon_file: icon.jpg +label: Spark +description: Spark k8s Tile + +packages: +- name: spark + type: kibosh + helm_chart_dir: +``` +Finally, generate the tile. (It is located at spark-tile/product/spark-.pivotal) +``` +$ tile build +``` + +Some limitations to be aware of when deploying Helm charts into PKS Kubernetes clusters: - Once deployed, a persistent volume claim cannot be resized. This is the error that you may get if you try to resize: `Error: UPGRADE FAILED: PersistentVolumeClaim is invalid: spec: Forbidden: field is immutable after creation` - Some disk types can be resized, but this requires enabling alpha [Feature Gates](https://kubernetes.io/docs/reference/feature-gates) - [Selectors](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#selector) - are immutable. Many helm charts use name and other things as selectors, so cautions around changes. + are immutable. Many Helm charts use name and other things as selectors, so cautions around changes. ### Custom Forms and Properties