This is an automated email from the ASF dual-hosted git repository.
jiangpengcheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openwhisk-deploy-kube.git
The following commit(s) were added to refs/heads/master by this push:
new 554cbd1 Support external kafka zookeeper (#611)
554cbd1 is described below
commit 554cbd11e9d151ce06b01cf040d7bf9be67afc86
Author: ningyougang <[email protected]>
AuthorDate: Thu Jul 2 09:56:59 2020 +0800
Support external kafka zookeeper (#611)
* Support external kafka zookeeper
* Use connect_string instead of single host
Co-authored-by: ning.yougang <[email protected]>
---
helm/openwhisk/templates/_helpers.tpl | 16 +++++++++++-----
helm/openwhisk/templates/kafka-pdb.yaml | 2 +-
helm/openwhisk/templates/kafka-pod.yaml | 2 +-
helm/openwhisk/templates/kafka-pvc.yaml | 2 +-
helm/openwhisk/templates/kafka-svc.yaml | 2 +-
helm/openwhisk/templates/zookeeper-cm.yaml | 2 +-
helm/openwhisk/templates/zookeeper-pdb.yaml | 2 +-
helm/openwhisk/templates/zookeeper-pod.yaml | 2 +-
helm/openwhisk/templates/zookeeper-pvc-data.yaml | 2 +-
helm/openwhisk/templates/zookeeper-pvc-datalog.yaml | 2 +-
helm/openwhisk/templates/zookeeper-svc.yaml | 2 +-
helm/openwhisk/values.yaml | 5 +++++
12 files changed, 26 insertions(+), 15 deletions(-)
diff --git a/helm/openwhisk/templates/_helpers.tpl
b/helm/openwhisk/templates/_helpers.tpl
index 4c4cf42..8ac8618 100644
--- a/helm/openwhisk/templates/_helpers.tpl
+++ b/helm/openwhisk/templates/_helpers.tpl
@@ -66,30 +66,36 @@ app: {{ template "openwhisk.fullname" . }}
{{/* client connection string for zookeeper cluster
(server1:port,server2:port, ... serverN:port)*/}}
{{- define "openwhisk.zookeeper_connect" -}}
+{{- if .Values.zookeeper.external -}}
+{{ .Values.zookeeper.connect_string }}
+{{- else -}}
{{- $zkname := printf "%s-zookeeper" .Release.Name }}
{{- $zkport := .Values.zookeeper.port }}
{{- $kubeDomain := .Values.k8s.domain }}
{{- range $i, $e := until (int .Values.zookeeper.replicaCount) -}}{{ if ne $i
0 }},{{ end }}{{ $zkname }}-{{ . }}.{{ $zkname }}.{{ $.Release.Namespace
}}.svc.{{ $kubeDomain }}:{{ $zkport }}{{ end }}
{{- end -}}
+{{- end -}}
{{/* host name for server.0 in zookeeper cluster */}}
{{- define "openwhisk.zookeeper_zero_host" -}}
+{{- if .Values.zookeeper.external -}}
+{{ .Values.zookeeper.host }}
+{{- else -}}
{{- $zkname := printf "%s-zookeeper" .Release.Name }}
{{ $zkname }}-0.{{ $zkname }}.{{ $.Release.Namespace }}.svc.{{
.Values.k8s.domain }}
{{- end -}}
+{{- end -}}
{{/* client connection string for kafka cluster (server1:port,server2:port,
... serverN:port)*/}}
{{- define "openwhisk.kafka_connect" -}}
+{{- if .Values.kafka.external -}}
+{{ .Values.kafka.connect_string }}
+{{- else -}}
{{- $kname := printf "%s-kafka" .Release.Name }}
{{- $kport := .Values.kafka.port }}
{{- $kubeDomain := .Values.k8s.domain }}
{{- range $i, $e := until (int .Values.kafka.replicaCount) -}}{{ if ne $i 0
}},{{ end }}{{ $kname }}-{{ . }}.{{ $kname }}.{{ $.Release.Namespace }}.svc.{{
$kubeDomain }}:{{ $kport }}{{ end }}
{{- end -}}
-
-{{/* host name for server.0 in kafka cluster */}}
-{{- define "openwhisk.kafka_zero_host" -}}
-{{- $kname := printf "%s-kafka" .Release.Name }}
-{{ $kname }}-0.{{ $kname }}.{{ $.Release.Namespace }}.svc.{{
.Values.k8s.domain }}
{{- end -}}
{{/* Runtimes manifest */}}
diff --git a/helm/openwhisk/templates/kafka-pdb.yaml
b/helm/openwhisk/templates/kafka-pdb.yaml
index 12eab79..1dc8893 100644
--- a/helm/openwhisk/templates/kafka-pdb.yaml
+++ b/helm/openwhisk/templates/kafka-pdb.yaml
@@ -15,7 +15,7 @@
# limitations under the License.
#
-{{- if and .Values.pdb.enable (gt (int .Values.kafka.replicaCount) 1) }}
+{{- if and .Values.pdb.enable (gt (int .Values.kafka.replicaCount) 1) (not
.Values.kafka.external) }}
---
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
diff --git a/helm/openwhisk/templates/kafka-pod.yaml
b/helm/openwhisk/templates/kafka-pod.yaml
index 170b93e..f49d30f 100644
--- a/helm/openwhisk/templates/kafka-pod.yaml
+++ b/helm/openwhisk/templates/kafka-pod.yaml
@@ -15,7 +15,7 @@
# limitations under the License.
#
-{{- if not .Values.controller.lean }}
+{{- if and (not .Values.controller.lean) (not .Values.kafka.external) }}
---
apiVersion: apps/v1
kind: StatefulSet
diff --git a/helm/openwhisk/templates/kafka-pvc.yaml
b/helm/openwhisk/templates/kafka-pvc.yaml
index 5244d05..6254d2b 100644
--- a/helm/openwhisk/templates/kafka-pvc.yaml
+++ b/helm/openwhisk/templates/kafka-pvc.yaml
@@ -15,7 +15,7 @@
# limitations under the License.
#
-{{ if and .Values.k8s.persistence.enabled (eq (int .Values.kafka.replicaCount)
1 ) (not .Values.controller.lean) }}
+{{ if and .Values.k8s.persistence.enabled (eq (int .Values.kafka.replicaCount)
1 ) (not .Values.controller.lean) (not .Values.kafka.external) }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
diff --git a/helm/openwhisk/templates/kafka-svc.yaml
b/helm/openwhisk/templates/kafka-svc.yaml
index bef1e5b..f8f0b7d 100644
--- a/helm/openwhisk/templates/kafka-svc.yaml
+++ b/helm/openwhisk/templates/kafka-svc.yaml
@@ -15,7 +15,7 @@
# limitations under the License.
#
-{{- if not .Values.controller.lean }}
+{{- if and (not .Values.controller.lean) (not .Values.kafka.external) }}
---
apiVersion: v1
kind: Service
diff --git a/helm/openwhisk/templates/zookeeper-cm.yaml
b/helm/openwhisk/templates/zookeeper-cm.yaml
index 83dd02a..eff9199 100644
--- a/helm/openwhisk/templates/zookeeper-cm.yaml
+++ b/helm/openwhisk/templates/zookeeper-cm.yaml
@@ -15,7 +15,7 @@
# limitations under the License.
#
-{{- if not .Values.controller.lean }}
+{{- if add (not .Values.controller.lean) (not .Values.zookeeper.external) }}
---
apiVersion: v1
kind: ConfigMap
diff --git a/helm/openwhisk/templates/zookeeper-pdb.yaml
b/helm/openwhisk/templates/zookeeper-pdb.yaml
index 44943ea..42c8be0 100644
--- a/helm/openwhisk/templates/zookeeper-pdb.yaml
+++ b/helm/openwhisk/templates/zookeeper-pdb.yaml
@@ -15,7 +15,7 @@
# limitations under the License.
#
-{{- if and .Values.pdb.enable (gt (int .Values.zookeeper.replicaCount) 1) }}
+{{- if and .Values.pdb.enable (gt (int .Values.zookeeper.replicaCount) 1) (not
.Values.zookeeper.external) }}
---
apiVersion: policy/v1beta1
kind: PodDisruptionBudget
diff --git a/helm/openwhisk/templates/zookeeper-pod.yaml
b/helm/openwhisk/templates/zookeeper-pod.yaml
index 9d6d778..1f01d73 100644
--- a/helm/openwhisk/templates/zookeeper-pod.yaml
+++ b/helm/openwhisk/templates/zookeeper-pod.yaml
@@ -15,7 +15,7 @@
# limitations under the License.
#
-{{- if not .Values.controller.lean }}
+{{- if and (not .Values.controller.lean) (not .Values.zookeeper.external) }}
---
apiVersion: apps/v1
kind: StatefulSet
diff --git a/helm/openwhisk/templates/zookeeper-pvc-data.yaml
b/helm/openwhisk/templates/zookeeper-pvc-data.yaml
index 0a0b51e..b6b6ed2 100644
--- a/helm/openwhisk/templates/zookeeper-pvc-data.yaml
+++ b/helm/openwhisk/templates/zookeeper-pvc-data.yaml
@@ -15,7 +15,7 @@
# limitations under the License.
#
-{{ if and .Values.k8s.persistence.enabled (eq (int
.Values.zookeeper.replicaCount) 1 ) }}
+{{ if and .Values.k8s.persistence.enabled (eq (int
.Values.zookeeper.replicaCount) 1 ) (not .Values.zookeeper.external) }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
diff --git a/helm/openwhisk/templates/zookeeper-pvc-datalog.yaml
b/helm/openwhisk/templates/zookeeper-pvc-datalog.yaml
index f708339..629022f 100644
--- a/helm/openwhisk/templates/zookeeper-pvc-datalog.yaml
+++ b/helm/openwhisk/templates/zookeeper-pvc-datalog.yaml
@@ -15,7 +15,7 @@
# limitations under the License.
#
-{{ if and .Values.k8s.persistence.enabled (eq (int
.Values.zookeeper.replicaCount) 1 ) }}
+{{ if and .Values.k8s.persistence.enabled (eq (int
.Values.zookeeper.replicaCount) 1 ) (not .Values.zookeeper.external) }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
diff --git a/helm/openwhisk/templates/zookeeper-svc.yaml
b/helm/openwhisk/templates/zookeeper-svc.yaml
index 1a3e998..17a38e6 100644
--- a/helm/openwhisk/templates/zookeeper-svc.yaml
+++ b/helm/openwhisk/templates/zookeeper-svc.yaml
@@ -15,7 +15,7 @@
# limitations under the License.
#
-{{- if not .Values.controller.lean }}
+{{- if and (not .Values.controller.lean) (not .Values.zookeeper.external) }}
---
apiVersion: v1
kind: Service
diff --git a/helm/openwhisk/values.yaml b/helm/openwhisk/values.yaml
index 7f2b1bc..4584e3f 100644
--- a/helm/openwhisk/values.yaml
+++ b/helm/openwhisk/values.yaml
@@ -167,12 +167,15 @@ docker:
# zookeeper configurations
zookeeper:
+ external: false
imageName: "zookeeper"
imageTag: "3.4"
imagePullPolicy: "IfNotPresent"
# Note: Zookeeper's quorum protocol is designed to have an odd number of
replicas.
replicaCount: 1
restartPolicy: "Always"
+ connect_string: null
+ host: null
port: 2181
serverPort: 2888
leaderElectionPort: 3888
@@ -188,11 +191,13 @@ zookeeper:
# kafka configurations
kafka:
+ external: false
imageName: "wurstmeister/kafka"
imageTag: "2.12-2.3.1"
imagePullPolicy: "IfNotPresent"
replicaCount: 1
restartPolicy: "Always"
+ connect_string: null
port: 9092
persistence:
size: 512Mi