Skip to content
This repository has been archived by the owner on Feb 20, 2024. It is now read-only.

Commit

Permalink
Added umbrella chart
Browse files Browse the repository at this point in the history
  • Loading branch information
qshao-pivotal committed May 17, 2018
1 parent deb0197 commit bf98881
Show file tree
Hide file tree
Showing 17 changed files with 254 additions and 125 deletions.
21 changes: 21 additions & 0 deletions .helmignore
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
appVersion: "1.0"
description: A Helm chart for Confluent Open Source
name: cp-helm-charts
version: 0.1.0
11 changes: 2 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,15 @@ git clone https://github.com/confluentinc/cp-helm-charts.git
The steps below will install a 3 node cp-zookeeper, a 3 node cp-kafka cluster,1 schema registry,1 rest proxy and 1 kafka connect in your k8s env.

```sh
# Update dependencies
helm dependency update ./charts/cp-kafka
helm install ./charts/cp-kafka
helm install cp-helm-charts
```

To install without rest proxy, schema registry and kafka connect

```sh
# Update dependencies

helm dependency update ./charts/cp-kafka
helm install --set schemaregistry.enabled=false,restproxy.enabled=false,kafkaconnect.enabled=false ./charts/cp-kafka
helm install --set cp-schema-registry.enabled=false,cp-kafka-rest.enabled=false,cp-kafka-connect.enabled=false cp-helm-charts/
```

NOTE: run `helm dependency update ...` whenever you modified the dependency chart.

## Optional: Verify the Kafka cluster

To manually verify that Kafka is working as expected, connect to one of the Kafka pods and produce some messages from the console. List your pods with `kubectl get pods`. Pick a running Kafka pod, and connect to it. You may need to wait for the Kafka cluster to finish starting up.
Expand Down
8 changes: 4 additions & 4 deletions charts/cp-kafka-rest/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,11 @@ The configuration parameters in this section control the resources requested and
### Zookeeper
| Parameter | Description | Default |
| --------- | ----------- | ------- |
| `zookeeper.url` | Service name of Zookeeper cluster (Not needed if this is installed along with cp-kafka chart). | `""` |
| `zookeeper.clientPort` | Port of Zookeeper Cluster | `2181` |
| `cp-zookeeper.url` | Service name of Zookeeper cluster (Not needed if this is installed along with cp-kafka chart). | `""` |
| `cp-zookeeper.clientPort` | Port of Zookeeper Cluster | `2181` |

### Schema Registry (optional)
| Parameter | Description | Default |
| --------- | ----------- | ------- |
| `schemaregistry.url` | Service name of Schema Registry (Not needed if this is installed along with cp-kafka chart). | `""` |
| `schemaregistry.port` | Port of Schema Registry Service | `8081` |
| `cp-schema-registry.url` | Service name of Schema Registry (Not needed if this is installed along with cp-kafka chart). | `""` |
| `cp-schema-registry.port` | Port of Schema Registry Service | `8081` |
16 changes: 8 additions & 8 deletions charts/cp-kafka-rest/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Create a default fully qualified zookeeper name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "cp-kafka-rest.cp-zookeeper.fullname" -}}
{{- $name := default "zookeeper" .Values.zookeeper.nameOverride -}}
{{- $name := default "cp-zookeeper" (index .Values "cp-zookeeper" "nameOverride") -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}

Expand All @@ -45,9 +45,9 @@ Form the Zookeeper URL. If zookeeper is installed as part of this chart, use k8s
else use user-provided URL
*/}}
{{- define "cp-kafka-rest.cp-zookeeper.service-name" }}
{{- $port := .Values.zookeeper.clientPort | toString }}
{{- if .Values.zookeeper.url -}}
{{- printf "%s:%s" .Values.zookeeper.url $port }}
{{- $port := (index .Values "cp-zookeeper" "clientPort") | toString }}
{{- if (index .Values "cp-zookeeper" "url") -}}
{{- printf "%s:%s" (index .Values "cp-zookeeper" "url") $port }}
{{- else -}}
{{- printf "%s:2181" (include "cp-kafka-rest.cp-zookeeper.fullname" .) }}
{{- end -}}
Expand All @@ -58,14 +58,14 @@ Create a default fully qualified schema registry name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "cp-kafka-rest.cp-schema-registry.fullname" -}}
{{- $name := default "schemaregistry" .Values.schemaregistry.nameOverride -}}
{{- $name := default "cp-schema-registry" (index .Values "cp-schema-registry" "nameOverride") -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{- define "cp-kafka-rest.cp-schema-registry.service-name" -}}
{{- $port := .Values.schemaregistry.port | toString -}}
{{- if .Values.schemaregistry.url -}}
{{- printf "%s:%s" .Values.schemaregistry.url $port -}}
{{- $port := (index .Values "cp-schema-registry" "port") | toString -}}
{{- if (index .Values "cp-schema-registry" "url") -}}
{{- printf "%s:%s" (index .Values "cp-schema-registry" "url") $port -}}
{{- else -}}
{{- printf "%s:8081" (include "cp-kafka-rest.cp-schema-registry.fullname" .) -}}
{{- end -}}
Expand Down
4 changes: 2 additions & 2 deletions charts/cp-kafka-rest/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ external:
type: LoadBalancer

## If the Kafka Chart is disabled a URL and port are required to connect
zookeeper:
cp-zookeeper:
url: ""
clientPort: 2181

## If the Kafka Chart is disabled a URL and port are required to connect
schemaregistry:
cp-schema-registry:
url: ""
port: 8081
34 changes: 9 additions & 25 deletions charts/cp-kafka/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,33 +152,17 @@ The configuration parameters in this section control the resources requested and
### External Access
| Parameter | Description | Default |
| --------- | ----------- | ------- |
| `external.enabled` | Whether or not to allow access to kafka cluster from outside k8s. | `true` |
| `external.servicePort` | The Port broker will advertise to external producers and consumers. | `19092` |
| `external.firstListenerPort` | The first NodePort that Kafka Broker will use for advertising to external producers and consumers. For each broker, advertise.listeners port for external will be set to `31090 + {index of broker pod}`. | `31090` |
| `nodeport.enabled` | Whether or not to allow access to kafka cluster from outside k8s through NodePort. | `false` |
| `nodeport.servicePort` | The Port broker will advertise to external producers and consumers. | `19092` |
| `nodeport.firstListenerPort` | The first NodePort that Kafka Broker will use for advertising to external producers and consumers. For each broker, advertise.listeners port for external will be set to `31090 + {index of broker pod}`. | `31090` |

## Dependencies
### Zookeeper
| Parameter | Description | Default |
| --------- | ----------- | ------- |
| `zookeeper.enabled` | Whether or not to install cp-zookeeper chart alongside cp-kafka chart | `true` |
| `zookeeper.persistence.enabled` | Whether to create a PVC. If `false`, an `emptyDir` on the host will be used. | `true` |
| `zookeeper.persistence.dataDirSize` | Size for Data dir, where ZooKeeper will store the in-memory database snapshots. This will overwrite corresponding value in cp-zookeeper chart's value.yaml | `5Gi` |
| `zookeeper.persistence.dataLogDirSize` | Size for data log dir, which is a dedicated log device to be used, and helps avoid competition between logging and snapshots. This will overwrite corresponding value in cp-zookeeper chart's value.yaml. | `5Gi` |
| `zookeeper.url` | Service name of Zookeeper cluster (Not needed if zookeeper.enabled is set to true). | `""` |
| `zookeeper.clientPort` | Port of Zookeeper Cluster | `2181` |

## Add-Ons
### Schema Registry
| Parameter | Description | Default |
| --------- | ----------- | ------- |
| `schemaregistry.enabled` | Whether or not to install cp-schema-registry chart alongside cp-kafka chart | `false` |

### Rest Proxy
| Parameter | Description | Default |
| --------- | ----------- | ------- |
| `restproxy.enabled` | Whether or not to install cp-kafka-rest chart alongside cp-kafka chart | `false` |

### Kafka Connect
| Parameter | Description | Default |
| --------- | ----------- | ------- |
| `kafkaconnect.enabled` | Whether or not to install cp-kafka-connect chart alongside cp-kafka chart | `false` |
| `cp-zookeeper.enabled` | Whether or not to install cp-zookeeper chart alongside cp-kafka chart | `true` |
| `cp-zookeeper.persistence.enabled` | Whether to create a PVC. If `false`, an `emptyDir` on the host will be used. | `true` |
| `cp-zookeeper.persistence.dataDirSize` | Size for Data dir, where ZooKeeper will store the in-memory database snapshots. This will overwrite corresponding value in cp-zookeeper chart's value.yaml | `5Gi` |
| `cp-zookeeper.persistence.dataLogDirSize` | Size for data log dir, which is a dedicated log device to be used, and helps avoid competition between logging and snapshots. This will overwrite corresponding value in cp-zookeeper chart's value.yaml. | `5Gi` |
| `cp-zookeeper.url` | Service name of Zookeeper cluster (Not needed if zookeeper.enabled is set to true). | `""` |
| `cp-zookeeper.clientPort` | Port of Zookeeper Cluster | `2181` |
18 changes: 1 addition & 17 deletions charts/cp-kafka/requirements.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,4 @@ dependencies:
- name: cp-zookeeper
version: 0.1.0
repository: file://../cp-zookeeper
condition: zookeeper.enabled
alias: zookeeper
- name: cp-schema-registry
version: 0.1.0
repository: file://../cp-schema-registry
condition: schemaregistry.enabled
alias: schemaregistry
- name: cp-kafka-rest
version: 0.1.0
repository: file://../cp-kafka-rest
condition: restproxy.enabled
alias: restproxy
- name: cp-kafka-connect
version: 0.1.0
repository: file://../cp-kafka-connect
condition: kafkaconnect.enabled
alias: kafkaconnect
condition: cp-zookeeper.enabled
10 changes: 5 additions & 5 deletions charts/cp-kafka/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Create a default fully qualified zookeeper name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "cp-kafka.cp-zookeeper.fullname" -}}
{{- $name := default "zookeeper" .Values.zookeeper.nameOverride -}}
{{- $name := default "cp-zookeeper" (index .Values "cp-zookeeper" "nameOverride") -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}

Expand All @@ -45,12 +45,12 @@ Form the Zookeeper URL. If zookeeper is installed as part of this chart, use k8s
else use user-provided URL
*/}}
{{- define "cp-kafka.cp-zookeeper.service-name" }}
{{- $port := .Values.zookeeper.clientPort | toString }}
{{- if .Values.zookeeper.enabled -}}
{{- $port := (index .Values "cp-zookeeper" "clientPort") | toString }}
{{- if (index .Values "cp-zookeeper" "enabled") -}}
{{- printf "%s:%s" (include "cp-kafka.cp-zookeeper.fullname" .) $port }}
{{- else -}}
{{- $zookeeperConnect := printf "%s:%s" .Values.zookeeper.url $port }}
{{- $zookeeperConnectOverride := index .Values "configurationOverrides" "zookeeper.connect" }}
{{- $zookeeperConnect := printf "%s:%s" (index .Values "cp-zookeeper" "url") $port }}
{{- $zookeeperConnectOverride := (index .Values "configurationOverrides" "zookeeper.connect") }}
{{- default $zookeeperConnect $zookeeperConnectOverride }}
{{- end -}}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
{{- if .Values.external.enabled }}
{{- if .Values.nodeport.enabled }}
{{- $fullName := include "cp-kafka.fullname" . }}
{{- $brokers := .Values.brokers | int }}
{{- $servicePort := .Values.external.servicePort }}
{{- $servicePort := .Values.nodeport.servicePort }}
{{- $root := . }}
{{- range $i, $e := until $brokers }}
{{- $externalListenerPort := add $root.Values.external.firstListenerPort $i }}
{{- $externalListenerPort := add $root.Values.nodeport.firstListenerPort $i }}
{{- $responsiblePod := printf "%s-%d" (printf "%s" $fullName) $i }}
---
apiVersion: v1
kind: Service
metadata:
name: {{ $root.Release.Name }}-{{ $i }}-external
name: {{ $root.Release.Name }}-{{ $i }}-nodeport
labels:
app: {{ include "cp-kafka.name" $root }}
chart: {{ template "cp-kafka.chart" $root }}
Expand Down
6 changes: 3 additions & 3 deletions charts/cp-kafka/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,12 @@ spec:
- containerPort: {{ .Values.jmx.port }}
name: jmx
{{- end }}
{{- if .Values.external.enabled }}
{{- if .Values.nodeport.enabled }}
{{- $brokers := .Values.brokers | int }}
{{- $root := . }}
{{- range $i, $e := until $brokers }}
- containerPort: {{ add $root.Values.external.firstListenerPort $i }}
name: external-{{ $i }}
- containerPort: {{ add $root.Values.nodeport.firstListenerPort $i }}
name: nodeport-{{ $i }}
{{- end }}
{{- end }}
resources:
Expand Down
26 changes: 4 additions & 22 deletions charts/cp-kafka/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -95,15 +95,15 @@ prometheus:
imageTag: a23062396cd5af1acdf76512632c20ea6be76885dfc20cd9ff40fb23846557e8
port: 5556

external:
enabled: enable
nodeport:
enabled: false
servicePort: 19092
firstListenerPort: 31090

## ------------------------------------------------------
## Zookeeper
## ------------------------------------------------------
zookeeper:
cp-zookeeper:
## If true, install the cp-zookeeper chart alongside cp-kafka
## ref: ../cp-zookeeper
enabled: true
Expand All @@ -115,22 +115,4 @@ zookeeper:

## If the Zookeeper Chart is disabled a URL and port are required to connect
url: ""
clientPort: 2181

## ------------------------------------------------------
## Schema Registry
## ------------------------------------------------------
schemaregistry:
enabled: false

## ------------------------------------------------------
## REST Proxy
## ------------------------------------------------------
restproxy:
enabled: false

## ------------------------------------------------------
## Kafka Connect
## ------------------------------------------------------
kafkaconnect:
enabled: false
clientPort: 2181
13 changes: 0 additions & 13 deletions kafka-client.yml

This file was deleted.

21 changes: 21 additions & 0 deletions requirements.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
dependencies:
- name: cp-kafka
version: 0.1.0
repository: file://./charts/cp-kafka
condition: cp-kafka.enabled
- name: cp-zookeeper
version: 0.1.0
repository: file://./charts/cp-zookeeper
condition: cp-zookeeper.enabled
- name: cp-schema-registry
version: 0.1.0
repository: file://./charts/cp-schema-registry
condition: cp-schema-registry.enabled
- name: cp-kafka-rest
version: 0.1.0
repository: file://./charts/cp-kafka-rest
condition: cp-kafka-rest.enabled
- name: cp-kafka-connect
version: 0.1.0
repository: file:/./charts/cp-kafka-connect
condition: cp-kafka-connect.enabled
Loading

0 comments on commit bf98881

Please sign in to comment.