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

Commit 81ff624

Browse files
davidsunggAmUssA
authored andcommitted
add control-center charts (#271)
* add control-center charts * rename cp-enterprise-control-center to cp-control-center
1 parent b681f4c commit 81ff624

12 files changed

+407
-4
lines changed

charts/cp-control-center/.helmignore

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Patterns to ignore when building packages.
2+
# This supports shell glob matching, relative path matching, and
3+
# negation (prefixed with !). Only one pattern per line.
4+
.DS_Store
5+
# Common VCS dirs
6+
.git/
7+
.gitignore
8+
.bzr/
9+
.bzrignore
10+
.hg/
11+
.hgignore
12+
.svn/
13+
# Common backup files
14+
*.swp
15+
*.bak
16+
*.tmp
17+
*~
18+
# Various IDEs
19+
.project
20+
.idea/
21+
*.tmproj

charts/cp-control-center/Chart.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
apiVersion: v1
2+
appVersion: "1.0"
3+
description: A Helm chart Confluent Control Center for Kubernetes
4+
name: cp-control-center
5+
version: 0.1.0
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
This chart installs a Confluent Control Center
2+
3+
To connect to Confluent Control Center directly from outside the k8s cluster:
4+
5+
1. Execute the following command to setup port forward from k8s to localhost
6+
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "cp-control-center.name" . }}" -o jsonpath="{.items[0].metadata.name}")
7+
kubectl port-forward $POD_NAME {{ .Values.serviceHttpPort }}
8+
9+
2. Open a browser and visit http://localhost:{{ .Values.serviceHttpPort }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
{{/* vim: set filetype=mustache: */}}
2+
{{/*
3+
Expand the name of the chart.
4+
*/}}
5+
{{- define "cp-control-center.name" -}}
6+
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
7+
{{- end -}}
8+
9+
{{/*
10+
Create a default fully qualified app name.
11+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
12+
If release name contains chart name it will be used as a full name.
13+
*/}}
14+
{{- define "cp-control-center.fullname" -}}
15+
{{- if .Values.fullnameOverride -}}
16+
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
17+
{{- else -}}
18+
{{- $name := default .Chart.Name .Values.nameOverride -}}
19+
{{- if contains $name .Release.Name -}}
20+
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
21+
{{- else -}}
22+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
23+
{{- end -}}
24+
{{- end -}}
25+
{{- end -}}
26+
27+
{{/*
28+
Create chart name and version as used by the chart label.
29+
*/}}
30+
{{- define "cp-control-center.chart" -}}
31+
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
32+
{{- end -}}
33+
34+
{{/*
35+
Create a default fully qualified kafka headless name.
36+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
37+
*/}}
38+
{{- define "cp-control-center.cp-kafka-headless.fullname" -}}
39+
{{- $name := "cp-kafka-headless" -}}
40+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
41+
{{- end -}}
42+
43+
{{/*
44+
Form the Kafka URL. If Kafka is installed as part of this chart, use k8s service discovery,
45+
else use user-provided URL
46+
*/}}
47+
{{- define "cp-control-center.kafka.bootstrapServers" -}}
48+
{{- if .Values.kafka.bootstrapServers -}}
49+
{{- .Values.kafka.bootstrapServers -}}
50+
{{- else -}}
51+
{{- printf "PLAINTEXT://%s:9092" (include "cp-control-center.cp-kafka-headless.fullname" .) -}}
52+
{{- end -}}
53+
{{- end -}}
54+
55+
{{/*
56+
Create a default fully qualified schema registry name.
57+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
58+
*/}}
59+
{{- define "cp-control-center.cp-schema-registry.fullname" -}}
60+
{{- $name := default "cp-schema-registry" (index .Values "cp-schema-registry" "nameOverride") -}}
61+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
62+
{{- end -}}
63+
64+
{{- define "cp-control-center.cp-schema-registry.service-name" -}}
65+
{{- if (index .Values "cp-schema-registry" "url") -}}
66+
{{- printf "%s" (index .Values "cp-schema-registry" "url") -}}
67+
{{- else -}}
68+
{{- printf "http://%s:8081" (include "cp-control-center.cp-schema-registry.fullname" .) -}}
69+
{{- end -}}
70+
{{- end -}}
71+
72+
{{/*
73+
Create a default fully qualified connect name.
74+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
75+
*/}}
76+
{{- define "cp-control-center.cp-kafka-connect.fullname" -}}
77+
{{- $name := default "cp-kafka-connect" (index .Values "cp-kafka-connect" "nameOverride") -}}
78+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
79+
{{- end -}}
80+
81+
{{- define "cp-control-center.cp-kafka-connect.service-name" -}}
82+
{{- if (index .Values "cp-kafka-connect" "url") -}}
83+
{{- printf "%s" (index .Values "cp-kafka-connect" "url") -}}
84+
{{- else -}}
85+
{{- printf "http://%s:8083" (include "cp-control-center.cp-kafka-connect.fullname" .) -}}
86+
{{- end -}}
87+
{{- end -}}
88+
89+
{{/*
90+
Create a default fully qualified ksql name.
91+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
92+
*/}}
93+
{{- define "cp-control-center.cp-ksql-server.fullname" -}}
94+
{{- $name := default "cp-ksql-server" (index .Values "cp-ksql-server" "nameOverride") -}}
95+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
96+
{{- end -}}
97+
98+
{{- define "cp-control-center.cp-ksql-server.service-name" -}}
99+
{{- if (index .Values "cp-ksql-server" "url") -}}
100+
{{- printf "%s" (index .Values "cp-ksql-server" "url") -}}
101+
{{- else -}}
102+
{{- printf "http://%s:8088" (include "cp-control-center.cp-ksql-server.fullname" .) -}}
103+
{{- end -}}
104+
{{- end -}}
105+
106+
{{/*
107+
Create a default fully qualified zookeeper name.
108+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
109+
*/}}
110+
{{- define "cp-control-center.cp-zookeeper.fullname" -}}
111+
{{- $name := default "cp-zookeeper" (index .Values "cp-zookeeper" "nameOverride") -}}
112+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
113+
{{- end -}}
114+
115+
{{/*
116+
Form the Zookeeper URL. If zookeeper is installed as part of this chart, use k8s service discovery,
117+
else use user-provided URL
118+
*/}}
119+
{{- define "cp-control-center.cp-zookeeper.service-name" }}
120+
{{- if (index .Values "cp-zookeeper" "enabled") -}}
121+
{{- $clientPort := default 2181 (index .Values "cp-zookeeper" "clientPort") | int -}}
122+
{{- printf "%s:%d" (include "cp-control-center.cp-zookeeper.fullname" .) $clientPort }}
123+
{{- else -}}
124+
{{- $zookeeperConnect := printf "%s" (index .Values "cp-zookeeper" "url") }}
125+
{{- $zookeeperConnectOverride := (index .Values "configurationOverrides" "zookeeper.connect") }}
126+
{{- default $zookeeperConnect $zookeeperConnectOverride }}
127+
{{- end -}}
128+
{{- end -}}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
apiVersion: apps/v1beta2
2+
kind: Deployment
3+
metadata:
4+
name: {{ include "cp-control-center.fullname" . }}
5+
labels:
6+
app: {{ include "cp-control-center.name" . }}
7+
chart: {{ include "cp-control-center.chart" . }}
8+
release: {{ .Release.Name }}
9+
heritage: {{ .Release.Service }}
10+
spec:
11+
replicas: {{ .Values.replicaCount }}
12+
selector:
13+
matchLabels:
14+
app: {{ include "cp-control-center.name" . }}
15+
release: {{ .Release.Name }}
16+
template:
17+
metadata:
18+
labels:
19+
app: {{ include "cp-control-center.name" . }}
20+
release: {{ .Release.Name }}
21+
{{- if or .Values.podAnnotations .Values.prometheus.jmx.enabled }}
22+
annotations:
23+
{{- range $key, $value := .Values.podAnnotations }}
24+
{{ $key }}: {{ $value | quote }}
25+
{{- end }}
26+
{{- if .Values.prometheus.jmx.enabled }}
27+
prometheus.io/scrape: "true"
28+
prometheus.io/port: {{ .Values.prometheus.jmx.port | quote }}
29+
{{- end }}
30+
{{- end }}
31+
spec:
32+
containers:
33+
- name: {{ .Chart.Name }}
34+
image: "{{ .Values.image }}:{{ .Values.imageTag }}"
35+
imagePullPolicy: {{ .Values.imagePullPolicy }}
36+
ports:
37+
- name: cc-http
38+
containerPort: {{ .Values.serviceHttpPort}}
39+
protocol: TCP
40+
resources:
41+
{{- toYaml .Values.resources | indent 12 }}
42+
env:
43+
- name: CONTROL_CENTER_BOOTSTRAP_SERVERS
44+
value: {{ template "cp-control-center.kafka.bootstrapServers" . }}
45+
- name: CONTROL_CENTER_ZOOKEEPER_CONNECT
46+
value: {{ template "cp-control-center.cp-zookeeper.service-name" . }}
47+
- name: CONTROL_CENTER_CONNECT_CLUSTER
48+
value: {{ template "cp-control-center.cp-kafka-connect.service-name" . }}
49+
- name: CONTROL_CENTER_KSQL_URL
50+
value: {{ template "cp-control-center.cp-ksql-server.service-name" . }}
51+
- name: CONTROL_CENTER_KSQL_ADVERTISED_URL
52+
value: {{ template "cp-control-center.cp-ksql-server.service-name" . }}
53+
- name: CONTROL_CENTER_SCHEMA_REGISTRY_URL
54+
value: {{ template "cp-control-center.cp-schema-registry.service-name" . }}
55+
- name: KAFKA_HEAP_OPTS
56+
value: "{{ .Values.heapOptions }}"
57+
{{- range $key, $value := .Values.configurationOverrides }}
58+
- name: {{ printf "CONTROL_CENTER_%s" $key | replace "." "_" | upper | quote }}
59+
value: {{ $value | quote }}
60+
{{- end }}
61+
{{- range $key, $value := .Values.customEnv }}
62+
- name: {{ $key | quote }}
63+
value: {{ $value | quote }}
64+
{{- end }}
65+
{{- if .Values.imagePullSecrets }}
66+
imagePullSecrets:
67+
{{ toYaml .Values.imagePullSecrets | indent 8 }}
68+
{{- end }}
69+
{{- with .Values.nodeSelector }}
70+
nodeSelector:
71+
{{- toYaml . | nindent 8 }}
72+
{{- end }}
73+
{{- with .Values.affinity }}
74+
affinity:
75+
{{- toYaml . | nindent 8 }}
76+
{{- end }}
77+
{{- with .Values.tolerations }}
78+
tolerations:
79+
{{- toYaml . | nindent 8 }}
80+
{{- end }}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: {{ template "cp-control-center.fullname" . }}
5+
labels:
6+
app: {{ template "cp-control-center.name" . }}
7+
chart: {{ template "cp-control-center.chart" . }}
8+
release: {{ .Release.Name }}
9+
heritage: {{ .Release.Service }}
10+
spec:
11+
ports:
12+
- name: cc-http
13+
port: {{ .Values.serviceHttpPort }}
14+
selector:
15+
app: {{ template "cp-control-center.name" . }}
16+
release: {{ .Release.Name }}

charts/cp-control-center/values.yaml

+103
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
# Default values for cp-control-center.
2+
# This is a YAML-formatted file.
3+
# Declare variables to be passed into your templates.
4+
5+
replicaCount: 1
6+
7+
## Image Info
8+
## ref: https://hub.docker.com/r/confluentinc/cp-kafka/
9+
image: confluentinc/cp-enterprise-control-center
10+
imageTag: 5.2.0
11+
12+
## Specify a imagePullPolicy
13+
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
14+
imagePullPolicy: IfNotPresent
15+
16+
## Specify an array of imagePullSecrets.
17+
## Secrets must be manually created in the namespace.
18+
## ref: https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod
19+
imagePullSecrets:
20+
21+
serviceHttpPort: 9021
22+
23+
## Control Center properties
24+
## ref:
25+
configurationOverrides:
26+
"replication.factor": "3"
27+
# "internal.topics.replication": "1"
28+
# "monitoring.interceptor.topic.replication": "1"
29+
# "metrics.topic.replication": "1"
30+
# "command.topic.replication": "1"
31+
# "streams.num.stream.threads": "2"
32+
# "streams.consumer.request.timeout.ms": "960032"
33+
# "rest.listeners": "http://0.0.0.0:9021"
34+
35+
## Kafka Connect JVM Heap Option
36+
heapOptions: "-Xms512M -Xmx512M"
37+
38+
## Additional env variables
39+
customEnv: {}
40+
41+
resources: {}
42+
# We usually recommend not to specify default resources and to leave this as a conscious
43+
# choice for the user. This also increases chances charts run on environments with little
44+
# resources, such as Minikube. If you do want to specify resources, uncomment the following
45+
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
46+
# limits:
47+
# cpu: 100m
48+
# memory: 128Mi
49+
# requests:
50+
# cpu: 100m
51+
# memory: 128Mi
52+
53+
## Custom pod annotations
54+
podAnnotations: {}
55+
56+
## Node labels for pod assignment
57+
## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
58+
nodeSelector: {}
59+
60+
## Taints to tolerate on node assignment:
61+
## Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
62+
tolerations: {}
63+
64+
## Monitoring
65+
## Kafka JMX Settings
66+
## ref: https://docs.confluent.io/current/kafka/monitoring.html
67+
jmx:
68+
port: 5555
69+
70+
## Prometheus Exporter Configuration
71+
## ref: https://prometheus.io/docs/instrumenting/exporters/
72+
prometheus:
73+
## JMX Exporter Configuration
74+
## ref: https://github.com/prometheus/jmx_exporter
75+
jmx:
76+
enabled: true
77+
image: solsson/kafka-prometheus-jmx-exporter@sha256
78+
imageTag: 6f82e2b0464f50da8104acd7363fb9b995001ddff77d248379f8788e78946143
79+
port: 5556
80+
81+
## Resources configuration for the JMX exporter container.
82+
## See the `resources` documentation above for details.
83+
resources: {}
84+
85+
## You can list load balanced service endpoint, or list of all brokers (which is hard in K8s). e.g.:
86+
## bootstrapServers: "PLAINTEXT://dozing-prawn-kafka-headless:9092"
87+
kafka:
88+
bootstrapServers: ""
89+
90+
## If the Kafka Chart is disabled a URL and port are required to connect
91+
## e.g. gnoble-panther-cp-schema-registry:8081
92+
cp-schema-registry:
93+
url: ""
94+
95+
cp-kafka-connect:
96+
url: ""
97+
98+
cp-ksql-server:
99+
url: ""
100+
101+
cp-zookeeper:
102+
## If the Zookeeper Chart is disabled a URL and port are required to connect
103+
url: ""

charts/cp-kafka/templates/_helpers.tpl

+9
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,15 @@ external advertised listeners if configurationOverrides.advertised.listeners is
6767
{{- end -}}
6868
{{- end -}}
6969

70+
{{/*
71+
Create a default fully qualified kafka headless name.
72+
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
73+
*/}}
74+
{{- define "cp-kafka.cp-kafka-headless.fullname" -}}
75+
{{- $name := "cp-kafka-headless" -}}
76+
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
77+
{{- end -}}
78+
7079
{{/*
7180
Create a variable containing all the datadirs created.
7281
*/}}

charts/cp-kafka/templates/statefulset.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,10 @@ spec:
110110
value: {{ include "cp-kafka.cp-zookeeper.service-name" . | quote }}
111111
- name: KAFKA_LOG_DIRS
112112
value: {{ include "cp-kafka.log.dirs" . | quote }}
113+
- name: KAFKA_METRIC_REPORTERS
114+
value: "io.confluent.metrics.reporter.ConfluentMetricsReporter"
115+
- name: CONFLUENT_METRICS_REPORTER_BOOTSTRAP_SERVERS
116+
value: {{ printf "PLAINTEXT://%s:9092" (include "cp-kafka.cp-kafka-headless.fullname" .) | quote }}
113117
{{- range $key, $value := .Values.configurationOverrides }}
114118
- name: {{ printf "KAFKA_%s" $key | replace "." "_" | upper | quote }}
115119
value: {{ $value | quote }}

0 commit comments

Comments
 (0)