diff --git a/incubator/schema-registry/.helmignore b/incubator/schema-registry/.helmignore new file mode 100644 index 0000000000..f0c1319444 --- /dev/null +++ b/incubator/schema-registry/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/incubator/schema-registry/Chart.yaml b/incubator/schema-registry/Chart.yaml new file mode 100644 index 0000000000..6b6b715d8f --- /dev/null +++ b/incubator/schema-registry/Chart.yaml @@ -0,0 +1,16 @@ +name: schema-registry +home: https://docs.confluent.io/current/schema-registry/docs/index.html +version: 0.1.0 +description: Schema Registry provides a serving layer for your metadata. It provides a RESTful + interface for storing and retrieving Avro schemas. It stores a versioned history of all schemas, + provides multiple compatibility settings and allows evolution of schemas according to the + configured compatibility setting. It provides serializers that plug into Kafka clients that + handle schema storage and retrieval for Kafka messages that are sent in the Avro format. +icon: https://www.confluent.io/wp-content/themes/confluent/assets/images/confluent-logo-300.png +apiVersion: v1 +sources: +- https://github.com/confluentinc/schema-registry +- https://github.com/confluentinc/cp-docker-images +maintainers: +- name: benjigoldberg + email: ben@spothero.com diff --git a/incubator/schema-registry/README.md b/incubator/schema-registry/README.md new file mode 100644 index 0000000000..fdd73be9c6 --- /dev/null +++ b/incubator/schema-registry/README.md @@ -0,0 +1,72 @@ +# Schema-Registry Helm Chart +This helm chart creates a [Confluent Schema-Registry server](https://github.com/confluentinc/schema-registry). + +## Prerequisites +* Kubernetes 1.6 +* A running Kafka Installation +* A running Zookeeper Installation + +## Chart Components +This chart will dot he following: + +* Create a Schema-Registry deployment +* Create a Service configured to connect to the available Schema-Registry pods on the configured + client port. + +## Installing the Chart +You can install the chart with the release name `mysr` as below. + +```console +$ helm repo add incubator http://storage.googleapis.com/kubernetes-charts-incubator +$ helm install --name mysr incubator/schema-registry +``` + +If you do not specify a name, helm will select a name for you. + +### Installed Components +You can use `kubectl get` to view all of the installed components. + +```console{%raw} +$ kubectl get all -l app=schema-registry +NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE +deploy/mysr-schema-registry 1 1 1 1 23m + +NAME DESIRED CURRENT READY AGE +rs/mysr-schema-registry-bcb4c994c 1 1 1 23m + +NAME READY STATUS RESTARTS AGE +po/mysr-schema-registry-bcb4c994c-qjqbj 1/1 Running 1 23m +``` + +1. `deploy/mysr-schema-registry` is the Deployment created by this chart. +1. `rs/mysr-schema-registry-bcb4c994c` is the ReplicaSet created by this Chart's Deployment. +1. `po/mysr-schema-registry-bcb4c994c-qjqbj` is the Pod created by the ReplicaSet under this Chart's Deployment. + +## Configuration +You can specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. + +Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example, + +```console +$ helm install --name my-release -f values.yaml incubator/schema-registry +``` + +> **Tip**: You can use the default [values.yaml](values.yaml) + +### Parameters +The following tables lists the configurable parameters of the SchemaRegistry chart and their default values. + +| Parameter | Description | Default | +| --------- | ----------- | ------- | +| `image` | The `SchemaRegistry` image repository | `confluentinc/cp-schema-registry` | +| `imageTag` | The `SchemaRegistry` image tag | `4.0.0` | +| `imagePullPolicy` | Image Pull Policy | `IfNotPresent` | +| `replicaCount` | The number of `SchemaRegistry` Pods in the Deployment | `1` | +| `configurationOverrides` | `SchemaRegistry` [configuration setting](https://github.com/confluentinc/schema-registry/blob/master/docs/config.rst#configuration-options) overrides in the dictionary format `setting.name: value` | `{}` | +| `resources` | CPU/Memory resource requests/limits | `{}` | +| `servicePort` | The port on which the SchemaRegistry server will be exposed. | `8081` | +| `kafka.enabled` | If `true`, install Kafka/Zookeeper alongside the `SchemaRegistry`. This is intended for testing and argument-less helm installs of this chart only and should not be used in Production. | `true` | +| `kafka.replicas` | The number of Kafka Pods to install as part of the `StatefulSet` if `kafka.Enabled` is `true`| `1` | +| `kafka.zookeeper.servers` | The number of Zookeeper Pods to install as part of the `StatefulSet` if `kafka.Enabled` is `true`| `1` | +| `kafka.ZookeeperUrl` | The URL of the Zookeeper servicing the Kafka installation if `Kafka.Enabled` is `false` | `""` | +| `kafka.ZookeeperPort` | The Port of the Zookeeper servicing the Kafka installation if `Kafka.Enabled` is `false` | `2181` | diff --git a/incubator/schema-registry/requirements.lock b/incubator/schema-registry/requirements.lock new file mode 100644 index 0000000000..ecbc7e8aed --- /dev/null +++ b/incubator/schema-registry/requirements.lock @@ -0,0 +1,6 @@ +dependencies: +- name: kafka + repository: https://kubernetes-charts-incubator.storage.googleapis.com/ + version: 0.2.2 +digest: sha256:43aedc891276fa0f681a738c003e0bf8f458bf05cf3087e010b0ee3f3bb5c9ec +generated: 2017-11-29T14:12:11.958088-06:00 diff --git a/incubator/schema-registry/requirements.yaml b/incubator/schema-registry/requirements.yaml new file mode 100644 index 0000000000..5eca74be36 --- /dev/null +++ b/incubator/schema-registry/requirements.yaml @@ -0,0 +1,5 @@ +dependencies: +- name: kafka + version: 0.2.2 + repository: https://kubernetes-charts-incubator.storage.googleapis.com/ + condition: kafka.enabled diff --git a/incubator/schema-registry/templates/NOTES.txt b/incubator/schema-registry/templates/NOTES.txt new file mode 100644 index 0000000000..c93630e38b --- /dev/null +++ b/incubator/schema-registry/templates/NOTES.txt @@ -0,0 +1,7 @@ +Confluent Schema-Registry is now installed on your Kubernetes cluster. For more information on +Schema-Registry, please navigate to https://github.com/confluentinc/schema-registry + +1. Get the application URL by running these commands: + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "schema-registry.name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl port-forward $POD_NAME 8080:{{ .Values.servicePort }} diff --git a/incubator/schema-registry/templates/_helpers.tpl b/incubator/schema-registry/templates/_helpers.tpl new file mode 100644 index 0000000000..bd3522ac2a --- /dev/null +++ b/incubator/schema-registry/templates/_helpers.tpl @@ -0,0 +1,29 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "schema-registry.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "schema-registry.fullname" -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Form the Kafka URL. If Kafka is installed as part of this chart, use k8s service discovery, +else use user-provided URL +*/}} +{{- define "kafka-zookeeper.url" }} +{{- $port := .Values.kafka.zookeeperPort | toString }} +{{- if .Values.kafka.enabled -}} +{{- printf "%s-zookeeper:%s" .Release.Name $port }} +{{- else -}} +{{- printf "%s:%s" .Values.kafka.zookeeperUrl $port }} +{{- end -}} +{{- end -}} diff --git a/incubator/schema-registry/templates/deployment.yaml b/incubator/schema-registry/templates/deployment.yaml new file mode 100644 index 0000000000..7b346a0d2f --- /dev/null +++ b/incubator/schema-registry/templates/deployment.yaml @@ -0,0 +1,48 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ template "schema-registry.fullname" . }} + labels: + app: {{ template "schema-registry.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + replicas: {{ .Values.replicaCount }} + template: + metadata: + labels: + app: {{ template "schema-registry.name" . }} + release: {{ .Release.Name }} + spec: + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image }}:{{ .Values.imageTag }}" + imagePullPolicy: {{ .Values.imagePullPolicy }} + ports: + - containerPort: {{ .Values.servicePort }} + livenessProbe: + httpGet: + path: / + port: {{ .Values.servicePort }} + initialDelaySeconds: 10 + timeoutSeconds: 5 + readinessProbe: + httpGet: + path: / + port: {{ .Values.servicePort }} + initialDelaySeconds: 10 + timeoutSeconds: 5 + env: + - name: SCHEMA_REGISTRY_HOST_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: SCHEMA_REGISTRY_KAFKASTORE_CONNECTION_URL + value: {{ template "kafka-zookeeper.url" . }}/ + {{ range $configName, $configValue := .Values.configurationOverrides }} + - name: SCHEMA_REGISTRY_{{ $configName | replace "." "_" | upper }} + value: {{ $configValue }} + {{ end }} + resources: +{{ toYaml .Values.resources | indent 12 }} diff --git a/incubator/schema-registry/templates/service.yaml b/incubator/schema-registry/templates/service.yaml new file mode 100644 index 0000000000..5e9204906b --- /dev/null +++ b/incubator/schema-registry/templates/service.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "schema-registry.fullname" . }} + labels: + app: {{ template "schema-registry.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name | quote }} + heritage: {{ .Release.Service | quote }} +spec: + ports: + - name: schema-registry + port: {{ .Values.servicePort }} + selector: + app: {{ template "schema-registry.name" . }} + release: {{ .Release.Name | quote}} diff --git a/incubator/schema-registry/values.yaml b/incubator/schema-registry/values.yaml new file mode 100644 index 0000000000..94b233d08f --- /dev/null +++ b/incubator/schema-registry/values.yaml @@ -0,0 +1,49 @@ +# Default values for Confluent Schema-Registry +# This is a YAML-formatted file. +# Declare name/value pairs to be passed into your templates. +# name: value + +## schema-registry repository +image: "confluentinc/cp-schema-registry" +## The container tag to use +imageTag: "4.0.0" +## Specify a imagePullPolicy +## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images +imagePullPolicy: "IfNotPresent" + +## Number of Schema Registry Pods to Deploy +replicaCount: 1 + +## Schema Registry Settings Overrides +## Configuration Options can be found here: https://docs.confluent.io/current/schema-registry/docs/config.html +configurationOverrides: {} + +## Configure resource requests and limits +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## Confluent has production deployment guidelines here: +## ref: https://github.com/confluentinc/schema-registry/blob/master/docs/deployment.rst +## +resources: {} + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +## The port on which the SchemaRegistry will be available and serving requests +servicePort: 8081 + +## Kafka Settings +kafka: + ## This is enabled only to allow installations of this chart without arguments + enabled: true + ## Install only a single Kafka pod in the StatefulSet + Replicas: 1 + ## Install only a single Zookeeper pod in the StatefulSet + zookeeper: + Servers: 1 + ## If `Kafka.Enabled` is `false`, the Zookeeper url servicing the Kafka cluster must be provided + zookeeperUrl: "" + ## If `Kafka.Enabled` is `false`, the Zookeeper port servicing the Kafka cluster must be provided + zookeeperPort: 2181