Skip to content

Commit f9e64ae

Browse files
committed
add pulsarv2 chart
Signed-off-by: haorenfsa <haorenfsa@gmail.com>
1 parent d934ea8 commit f9e64ae

File tree

74 files changed

+6717
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+6717
-0
lines changed

charts/pulsarv2/.helmignore

Lines changed: 21 additions & 0 deletions
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/pulsarv2/Chart.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: v1
2+
appVersion: 2.7.4
3+
description: Apache Pulsar Helm chart for Kubernetes
4+
home: https://pulsar.apache.org
5+
icon: http://pulsar.apache.org/img/pulsar.svg
6+
maintainers:
7+
- name: contact
8+
email: contact@milvus.io
9+
name: pulsarv2
10+
sources:
11+
- https://github.com/apache/pulsar
12+
version: 2.7.8
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
{{/*
2+
Define the pulsar autorecovery service
3+
*/}}
4+
{{- define "pulsar.autorecovery.service" -}}
5+
{{ template "pulsar.fullname" . }}-{{ .Values.autorecovery.component }}
6+
{{- end }}
7+
8+
{{/*
9+
Define the autorecovery hostname
10+
*/}}
11+
{{- define "pulsar.autorecovery.hostname" -}}
12+
${HOSTNAME}.{{ template "pulsar.autorecovery.service" . }}.{{ template "pulsar.namespace" . }}.svc.{{ .Values.clusterDomain }}
13+
{{- end -}}
14+
15+
{{/*
16+
Define autorecovery zookeeper client tls settings
17+
*/}}
18+
{{- define "pulsar.autorecovery.zookeeper.tls.settings" -}}
19+
{{- if and .Values.tls.enabled .Values.tls.zookeeper.enabled }}
20+
/pulsar/keytool/keytool.sh autorecovery {{ template "pulsar.autorecovery.hostname" . }} true;
21+
{{- end }}
22+
{{- end }}
23+
24+
{{/*
25+
Define autorecovery tls certs mounts
26+
*/}}
27+
{{- define "pulsar.autorecovery.certs.volumeMounts" -}}
28+
{{- if and .Values.tls.enabled .Values.tls.zookeeper.enabled }}
29+
- name: autorecovery-certs
30+
mountPath: "/pulsar/certs/autorecovery"
31+
readOnly: true
32+
- name: ca
33+
mountPath: "/pulsar/certs/ca"
34+
readOnly: true
35+
{{- if .Values.tls.zookeeper.enabled }}
36+
- name: keytool
37+
mountPath: "/pulsar/keytool/keytool.sh"
38+
subPath: keytool.sh
39+
{{- end }}
40+
{{- end }}
41+
{{- end }}
42+
43+
{{/*
44+
Define autorecovery tls certs volumes
45+
*/}}
46+
{{- define "pulsar.autorecovery.certs.volumes" -}}
47+
{{- if and .Values.tls.enabled .Values.tls.zookeeper.enabled }}
48+
- name: autorecovery-certs
49+
secret:
50+
secretName: "{{ .Release.Name }}-{{ .Values.tls.autorecovery.cert_name }}"
51+
items:
52+
- key: tls.crt
53+
path: tls.crt
54+
- key: tls.key
55+
path: tls.key
56+
- name: ca
57+
secret:
58+
secretName: "{{ .Release.Name }}-{{ .Values.tls.ca_suffix }}"
59+
items:
60+
- key: ca.crt
61+
path: ca.crt
62+
{{- if .Values.tls.zookeeper.enabled }}
63+
- name: keytool
64+
configMap:
65+
name: "{{ template "pulsar.fullname" . }}-keytool-configmap"
66+
defaultMode: 0755
67+
{{- end }}
68+
{{- end }}
69+
{{- end }}
70+
71+
{{/*
72+
Define autorecovery init container : verify cluster id
73+
*/}}
74+
{{- define "pulsar.autorecovery.init.verify_cluster_id" -}}
75+
bin/apply-config-from-env.py conf/bookkeeper.conf;
76+
{{- include "pulsar.autorecovery.zookeeper.tls.settings" . -}}
77+
until bin/bookkeeper shell whatisinstanceid; do
78+
sleep 3;
79+
done;
80+
{{- end }}
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
{{/*
2+
Define the pulsar bookkeeper service
3+
*/}}
4+
{{- define "pulsar.bookkeeper.service" -}}
5+
{{ template "pulsar.fullname" . }}-{{ .Values.bookkeeper.component }}
6+
{{- end }}
7+
8+
{{/*
9+
Define the bookkeeper hostname
10+
*/}}
11+
{{- define "pulsar.bookkeeper.hostname" -}}
12+
${HOSTNAME}.{{ template "pulsar.bookkeeper.service" . }}.{{ template "pulsar.namespace" . }}.svc.{{ .Values.clusterDomain }}
13+
{{- end -}}
14+
15+
16+
{{/*
17+
Define bookie zookeeper client tls settings
18+
*/}}
19+
{{- define "pulsar.bookkeeper.zookeeper.tls.settings" -}}
20+
{{- if and .Values.tls.enabled .Values.tls.zookeeper.enabled }}
21+
/pulsar/keytool/keytool.sh bookie {{ template "pulsar.bookkeeper.hostname" . }} true;
22+
{{- end }}
23+
{{- end }}
24+
25+
{{/*
26+
Define bookie tls certs mounts
27+
*/}}
28+
{{- define "pulsar.bookkeeper.certs.volumeMounts" -}}
29+
{{- if and .Values.tls.enabled (or .Values.tls.bookie.enabled .Values.tls.zookeeper.enabled) }}
30+
- name: bookie-certs
31+
mountPath: "/pulsar/certs/bookie"
32+
readOnly: true
33+
- name: ca
34+
mountPath: "/pulsar/certs/ca"
35+
readOnly: true
36+
{{- if .Values.tls.zookeeper.enabled }}
37+
- name: keytool
38+
mountPath: "/pulsar/keytool/keytool.sh"
39+
subPath: keytool.sh
40+
{{- end }}
41+
{{- end }}
42+
{{- end }}
43+
44+
{{/*
45+
Define bookie tls certs volumes
46+
*/}}
47+
{{- define "pulsar.bookkeeper.certs.volumes" -}}
48+
{{- if and .Values.tls.enabled (or .Values.tls.bookie.enabled .Values.tls.zookeeper.enabled) }}
49+
- name: bookie-certs
50+
secret:
51+
secretName: "{{ .Release.Name }}-{{ .Values.tls.bookie.cert_name }}"
52+
items:
53+
- key: tls.crt
54+
path: tls.crt
55+
- key: tls.key
56+
path: tls.key
57+
- name: ca
58+
secret:
59+
secretName: "{{ .Release.Name }}-{{ .Values.tls.ca_suffix }}"
60+
items:
61+
- key: ca.crt
62+
path: ca.crt
63+
{{- if .Values.tls.zookeeper.enabled }}
64+
- name: keytool
65+
configMap:
66+
name: "{{ template "pulsar.fullname" . }}-keytool-configmap"
67+
defaultMode: 0755
68+
{{- end }}
69+
{{- end }}
70+
{{- end }}
71+
72+
{{/*
73+
Define bookie common config
74+
*/}}
75+
{{- define "pulsar.bookkeeper.config.common" -}}
76+
zkServers: "{{ template "pulsar.zookeeper.connect" . }}"
77+
zkLedgersRootPath: "{{ .Values.metadataPrefix }}/ledgers"
78+
# enable bookkeeper http server
79+
httpServerEnabled: "true"
80+
httpServerPort: "{{ .Values.bookkeeper.ports.http }}"
81+
# config the stats provider
82+
statsProviderClass: org.apache.bookkeeper.stats.prometheus.PrometheusMetricsProvider
83+
# use hostname as the bookie id
84+
useHostNameAsBookieID: "true"
85+
{{- end }}
86+
87+
{{/*
88+
Define bookie tls config
89+
*/}}
90+
{{- define "pulsar.bookkeeper.config.tls" -}}
91+
{{- if and .Values.tls.enabled .Values.tls.bookie.enabled }}
92+
PULSAR_PREFIX_tlsProviderFactoryClass: org.apache.bookkeeper.tls.TLSContextFactory
93+
PULSAR_PREFIX_tlsCertificatePath: /pulsar/certs/bookie/tls.crt
94+
PULSAR_PREFIX_tlsKeyStoreType: PEM
95+
PULSAR_PREFIX_tlsKeyStore: /pulsar/certs/bookie/tls.key
96+
PULSAR_PREFIX_tlsTrustStoreType: PEM
97+
PULSAR_PREFIX_tlsTrustStore: /pulsar/certs/ca/ca.crt
98+
{{- end }}
99+
{{- end }}
100+
101+
{{/*
102+
Define bookie init container : verify cluster id
103+
*/}}
104+
{{- define "pulsar.bookkeeper.init.verify_cluster_id" -}}
105+
{{- if not (and .Values.volumes.persistence .Values.bookkeeper.volumes.persistence) }}
106+
bin/apply-config-from-env.py conf/bookkeeper.conf;
107+
{{- include "pulsar.bookkeeper.zookeeper.tls.settings" . -}}
108+
until bin/bookkeeper shell whatisinstanceid; do
109+
sleep 3;
110+
done;
111+
bin/bookkeeper shell bookieformat -nonInteractive -force -deleteCookie || true
112+
{{- end }}
113+
{{- if and .Values.volumes.persistence .Values.bookkeeper.volumes.persistence }}
114+
set -e;
115+
bin/apply-config-from-env.py conf/bookkeeper.conf;
116+
{{- include "pulsar.bookkeeper.zookeeper.tls.settings" . -}}
117+
until bin/bookkeeper shell whatisinstanceid; do
118+
sleep 3;
119+
done;
120+
{{- end }}
121+
{{- end }}

charts/pulsarv2/templates/_broker.tpl

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
{{/*
2+
Define the pulsar brroker service
3+
*/}}
4+
{{- define "pulsar.broker.service" -}}
5+
{{ template "pulsar.fullname" . }}-{{ .Values.broker.component }}
6+
{{- end }}
7+
8+
{{/*
9+
Define the hostname
10+
*/}}
11+
{{- define "pulsar.broker.hostname" -}}
12+
${HOSTNAME}.{{ template "pulsar.broker.service" . }}.{{ template "pulsar.namespace" . }}.svc.{{ .Values.clusterDomain }}
13+
{{- end -}}
14+
15+
{{/*
16+
Define the broker znode
17+
*/}}
18+
{{- define "pulsar.broker.znode" -}}
19+
{{ .Values.metadataPrefix }}/loadbalance/brokers/{{ template "pulsar.broker.hostname" . }}:{{ .Values.broker.ports.http }}
20+
{{- end }}
21+
22+
{{/*
23+
Define broker zookeeper client tls settings
24+
*/}}
25+
{{- define "pulsar.broker.zookeeper.tls.settings" -}}
26+
{{- if and .Values.tls.enabled .Values.tls.zookeeper.enabled }}
27+
/pulsar/keytool/keytool.sh broker {{ template "pulsar.broker.hostname" . }} true;
28+
{{- end }}
29+
{{- end }}
30+
31+
{{/*
32+
Define broker tls certs mounts
33+
*/}}
34+
{{- define "pulsar.broker.certs.volumeMounts" -}}
35+
{{- if and .Values.tls.enabled (or .Values.tls.broker.enabled (or .Values.tls.bookie.enabled .Values.tls.zookeeper.enabled)) }}
36+
- name: broker-certs
37+
mountPath: "/pulsar/certs/broker"
38+
readOnly: true
39+
- name: ca
40+
mountPath: "/pulsar/certs/ca"
41+
readOnly: true
42+
{{- if .Values.tls.zookeeper.enabled }}
43+
- name: keytool
44+
mountPath: "/pulsar/keytool/keytool.sh"
45+
subPath: keytool.sh
46+
{{- end }}
47+
{{- end }}
48+
{{- end }}
49+
50+
{{/*
51+
Define broker tls certs volumes
52+
*/}}
53+
{{- define "pulsar.broker.certs.volumes" -}}
54+
{{- if and .Values.tls.enabled (or .Values.tls.broker.enabled (or .Values.tls.bookie.enabled .Values.tls.zookeeper.enabled)) }}
55+
- name: broker-certs
56+
secret:
57+
secretName: "{{ .Release.Name }}-{{ .Values.tls.broker.cert_name }}"
58+
items:
59+
- key: tls.crt
60+
path: tls.crt
61+
- key: tls.key
62+
path: tls.key
63+
- name: ca
64+
secret:
65+
secretName: "{{ .Release.Name }}-{{ .Values.tls.ca_suffix }}"
66+
items:
67+
- key: ca.crt
68+
path: ca.crt
69+
{{- if .Values.tls.zookeeper.enabled }}
70+
- name: keytool
71+
configMap:
72+
name: "{{ template "pulsar.fullname" . }}-keytool-configmap"
73+
defaultMode: 0755
74+
{{- end }}
75+
{{- end }}
76+
{{- end }}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{{/*
2+
Define configuration store endpoint
3+
*/}}
4+
{{- define "pulsar.configurationStore.service" -}}
5+
{{- if .Values.pulsar_metadata.configurationStore }}
6+
{{- .Values.pulsar_metadata.configurationStore }}
7+
{{- else -}}
8+
{{ template "pulsar.zookeeper.service" . }}
9+
{{- end -}}
10+
{{- end -}}
11+
12+
{{/*
13+
Define configuration store connection string
14+
*/}}
15+
{{- define "pulsar.configurationStore.connect" -}}
16+
{{- if .Values.pulsar_metadata.configurationStore }}
17+
{{- template "pulsar.configurationStore.service" . }}:{{ .Values.pulsar_metadata.configurationStorePort }}
18+
{{- end -}}
19+
{{- end -}}
20+

0 commit comments

Comments
 (0)