Skip to content

Commit 554cbd1

Browse files
authored
Support external kafka zookeeper (#611)
* Support external kafka zookeeper * Use connect_string instead of single host Co-authored-by: ning.yougang <[email protected]>
1 parent 742bae9 commit 554cbd1

File tree

12 files changed

+26
-15
lines changed

12 files changed

+26
-15
lines changed

helm/openwhisk/templates/_helpers.tpl

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,30 +66,36 @@ app: {{ template "openwhisk.fullname" . }}
6666

6767
{{/* client connection string for zookeeper cluster (server1:port,server2:port, ... serverN:port)*/}}
6868
{{- define "openwhisk.zookeeper_connect" -}}
69+
{{- if .Values.zookeeper.external -}}
70+
{{ .Values.zookeeper.connect_string }}
71+
{{- else -}}
6972
{{- $zkname := printf "%s-zookeeper" .Release.Name }}
7073
{{- $zkport := .Values.zookeeper.port }}
7174
{{- $kubeDomain := .Values.k8s.domain }}
7275
{{- range $i, $e := until (int .Values.zookeeper.replicaCount) -}}{{ if ne $i 0 }},{{ end }}{{ $zkname }}-{{ . }}.{{ $zkname }}.{{ $.Release.Namespace }}.svc.{{ $kubeDomain }}:{{ $zkport }}{{ end }}
7376
{{- end -}}
77+
{{- end -}}
7478

7579
{{/* host name for server.0 in zookeeper cluster */}}
7680
{{- define "openwhisk.zookeeper_zero_host" -}}
81+
{{- if .Values.zookeeper.external -}}
82+
{{ .Values.zookeeper.host }}
83+
{{- else -}}
7784
{{- $zkname := printf "%s-zookeeper" .Release.Name }}
7885
{{ $zkname }}-0.{{ $zkname }}.{{ $.Release.Namespace }}.svc.{{ .Values.k8s.domain }}
7986
{{- end -}}
87+
{{- end -}}
8088

8189
{{/* client connection string for kafka cluster (server1:port,server2:port, ... serverN:port)*/}}
8290
{{- define "openwhisk.kafka_connect" -}}
91+
{{- if .Values.kafka.external -}}
92+
{{ .Values.kafka.connect_string }}
93+
{{- else -}}
8394
{{- $kname := printf "%s-kafka" .Release.Name }}
8495
{{- $kport := .Values.kafka.port }}
8596
{{- $kubeDomain := .Values.k8s.domain }}
8697
{{- range $i, $e := until (int .Values.kafka.replicaCount) -}}{{ if ne $i 0 }},{{ end }}{{ $kname }}-{{ . }}.{{ $kname }}.{{ $.Release.Namespace }}.svc.{{ $kubeDomain }}:{{ $kport }}{{ end }}
8798
{{- end -}}
88-
89-
{{/* host name for server.0 in kafka cluster */}}
90-
{{- define "openwhisk.kafka_zero_host" -}}
91-
{{- $kname := printf "%s-kafka" .Release.Name }}
92-
{{ $kname }}-0.{{ $kname }}.{{ $.Release.Namespace }}.svc.{{ .Values.k8s.domain }}
9399
{{- end -}}
94100

95101
{{/* Runtimes manifest */}}

helm/openwhisk/templates/kafka-pdb.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# limitations under the License.
1616
#
1717

18-
{{- if and .Values.pdb.enable (gt (int .Values.kafka.replicaCount) 1) }}
18+
{{- if and .Values.pdb.enable (gt (int .Values.kafka.replicaCount) 1) (not .Values.kafka.external) }}
1919
---
2020
apiVersion: policy/v1beta1
2121
kind: PodDisruptionBudget

helm/openwhisk/templates/kafka-pod.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# limitations under the License.
1616
#
1717

18-
{{- if not .Values.controller.lean }}
18+
{{- if and (not .Values.controller.lean) (not .Values.kafka.external) }}
1919
---
2020
apiVersion: apps/v1
2121
kind: StatefulSet

helm/openwhisk/templates/kafka-pvc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# limitations under the License.
1616
#
1717

18-
{{ if and .Values.k8s.persistence.enabled (eq (int .Values.kafka.replicaCount) 1 ) (not .Values.controller.lean) }}
18+
{{ if and .Values.k8s.persistence.enabled (eq (int .Values.kafka.replicaCount) 1 ) (not .Values.controller.lean) (not .Values.kafka.external) }}
1919
apiVersion: v1
2020
kind: PersistentVolumeClaim
2121
metadata:

helm/openwhisk/templates/kafka-svc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# limitations under the License.
1616
#
1717

18-
{{- if not .Values.controller.lean }}
18+
{{- if and (not .Values.controller.lean) (not .Values.kafka.external) }}
1919
---
2020
apiVersion: v1
2121
kind: Service

helm/openwhisk/templates/zookeeper-cm.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# limitations under the License.
1616
#
1717

18-
{{- if not .Values.controller.lean }}
18+
{{- if add (not .Values.controller.lean) (not .Values.zookeeper.external) }}
1919
---
2020
apiVersion: v1
2121
kind: ConfigMap

helm/openwhisk/templates/zookeeper-pdb.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# limitations under the License.
1616
#
1717

18-
{{- if and .Values.pdb.enable (gt (int .Values.zookeeper.replicaCount) 1) }}
18+
{{- if and .Values.pdb.enable (gt (int .Values.zookeeper.replicaCount) 1) (not .Values.zookeeper.external) }}
1919
---
2020
apiVersion: policy/v1beta1
2121
kind: PodDisruptionBudget

helm/openwhisk/templates/zookeeper-pod.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# limitations under the License.
1616
#
1717

18-
{{- if not .Values.controller.lean }}
18+
{{- if and (not .Values.controller.lean) (not .Values.zookeeper.external) }}
1919
---
2020
apiVersion: apps/v1
2121
kind: StatefulSet

helm/openwhisk/templates/zookeeper-pvc-data.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# limitations under the License.
1616
#
1717

18-
{{ if and .Values.k8s.persistence.enabled (eq (int .Values.zookeeper.replicaCount) 1 ) }}
18+
{{ if and .Values.k8s.persistence.enabled (eq (int .Values.zookeeper.replicaCount) 1 ) (not .Values.zookeeper.external) }}
1919
apiVersion: v1
2020
kind: PersistentVolumeClaim
2121
metadata:

helm/openwhisk/templates/zookeeper-pvc-datalog.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# limitations under the License.
1616
#
1717

18-
{{ if and .Values.k8s.persistence.enabled (eq (int .Values.zookeeper.replicaCount) 1 ) }}
18+
{{ if and .Values.k8s.persistence.enabled (eq (int .Values.zookeeper.replicaCount) 1 ) (not .Values.zookeeper.external) }}
1919
apiVersion: v1
2020
kind: PersistentVolumeClaim
2121
metadata:

0 commit comments

Comments
 (0)