rabbah closed pull request #257: External zookeeper kafka
URL: https://github.com/apache/incubator-openwhisk-deploy-kube/pull/257
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git a/docs/configurationChoices.md b/docs/configurationChoices.md
index db8bfe4..45baf88 100644
--- a/docs/configurationChoices.md
+++ b/docs/configurationChoices.md
@@ -68,6 +68,46 @@ will not attempt to create the necessary database tables or
otherwise
initialize/wipe the database. You will need to properly initialize
your external database before deploying the OpenWhisk chart.
+### Using external Kafka and Zookeeper services
+
+You may want to use an external Zookeeper or Kafka service. To disable the
kafka and/or zookeeper with this chart, add a stanza like the one below to your
`mycluster.yaml`.
+```yaml
+kafka:
+ external: true
+zookeeper:
+ external: true
+```
+
+To add the hostname of a pre-existing kafka and/or zookeeper, define it in
`mycluster.yml` like this
+
+```yaml
+kafka:
+ external: true
+ name: < existing kafka service >
+zookeeper:
+ external: true
+ name: < existing zookeeper service >
+
+```
+
+Optionally, if including this chart as a dependency of another chart where
kafka and zookeeper services are already defined, disable this chart's kafka
and zookeeper as shown above, and then define kafka_host, zookeeper_connect,
and zookeeper_zero_host in your parent chart _helpers.tpl. e.g.
+```
+{{/* hostname for kafka */}}
+{{- define "kafka_host" -}}
+{{ template "kafka.serviceName" . }}
+{{- end -}}
+
+{{/* hostname for zookeeper */}}
+{{- define "zookeeper_connect" -}}
+{{ template "zookeeper.serviceName" . }}
+{{- end -}}
+
+{{/* zookeeper_zero_host required by openwhisk readiness check */}}
+{{- define "zookeeper_zero_host" -}}
+{{ template "zookeeper.serviceName" . }}
+{{- end -}}
+```
+
### Persistence
The couchdb, zookeeper, kafka, and redis microservices can each be
diff --git a/helm/openwhisk/templates/_helpers.tpl
b/helm/openwhisk/templates/_helpers.tpl
index 49279a8..cabd9c1 100644
--- a/helm/openwhisk/templates/_helpers.tpl
+++ b/helm/openwhisk/templates/_helpers.tpl
@@ -22,8 +22,12 @@
{{/* hostname for kafka */}}
{{- define "kafka_host" -}}
+{{- if .Values.kafka.external -}}
+{{ .Values.kafka.name }}
+{{- else -}}
{{ .Values.kafka.name }}.{{ .Release.Namespace }}.svc.cluster.local
{{- end -}}
+{{- end -}}
{{/* hostname for redis */}}
{{- define "redis_host" -}}
@@ -32,15 +36,24 @@
{{/* client connection string for zookeeper cluster (server1:port server2:port
... serverN:port)*/}}
{{- define "zookeeper_connect" -}}
+{{- if .Values.zookeeper.external -}}
+{{ .Values.zookeeper.name }}
+{{- else -}}
{{- $zkname := .Values.zookeeper.name }}
{{- $zkport := .Values.zookeeper.port }}
{{- range $i, $e := until (int .Values.zookeeper.replicaCount) -}}{{ if ne $i
0 }},{{ end }}{{ $zkname }}-{{ . }}.{{ $zkname }}.{{ $.Release.Namespace
}}.svc.cluster.local:{{ $zkport }}{{ end }}
{{- end -}}
+{{- end -}}
{{/* host name for server.0 in zookeeper cluster */}}
{{- define "zookeeper_zero_host" -}}
+{{- if .Values.zookeeper.external -}}
+{{ .Values.zookeeper.name }}
+{{- else -}}
{{ .Values.zookeeper.name }}-0.{{ .Values.zookeeper.name }}.{{
$.Release.Namespace }}.svc.cluster.local
{{- end -}}
+{{- end -}}
+
{{/* Runtimes manifest */}}
{{- define "runtimes_manifest" -}}
@@ -97,4 +110,4 @@
{{/* tlssecretname for ingress */}}
{{- define "tls_secret_name" -}}
{{ .Values.whisk.ingress.tlssecretname | default "ow-ingress-tls-secret" |
quote }}
-{{- end -}}
\ No newline at end of file
+{{- end -}}
diff --git a/helm/openwhisk/templates/kafka.yaml
b/helm/openwhisk/templates/kafka.yaml
index aed0f92..a84f503 100644
--- a/helm/openwhisk/templates/kafka.yaml
+++ b/helm/openwhisk/templates/kafka.yaml
@@ -1,5 +1,6 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
contributor
# license agreements; and to You under the Apache License, Version 2.0.
+{{ if not .Values.kafka.external }}
apiVersion: v1
kind: Service
@@ -91,3 +92,4 @@ spec:
requests:
storage: {{ .Values.kafka.persistence.size }}
{{- end }}
+{{- end }}
diff --git a/helm/openwhisk/templates/zookeeper.yaml
b/helm/openwhisk/templates/zookeeper.yaml
index 24069eb..047da1e 100644
--- a/helm/openwhisk/templates/zookeeper.yaml
+++ b/helm/openwhisk/templates/zookeeper.yaml
@@ -1,5 +1,6 @@
# Licensed to the Apache Software Foundation (ASF) under one or more
contributor
# license agreements; and to You under the Apache License, Version 2.0.
+{{ if not .Values.zookeeper.external }}
apiVersion: v1
kind: Service
@@ -113,3 +114,4 @@ spec:
requests:
storage: {{ .Values.zookeeper.persistence.size }}
{{- end }}
+{{- end }}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services