You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by ra...@apache.org on 2018/07/24 00:35:35 UTC

[incubator-openwhisk-deploy-kube] branch master updated: External zookeeper kafka (#257)

This is an automated email from the ASF dual-hosted git repository.

rabbah pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk-deploy-kube.git


The following commit(s) were added to refs/heads/master by this push:
     new 06fffe0  External zookeeper kafka (#257)
06fffe0 is described below

commit 06fffe003b9e6bd2c796e9fa5ee4526b0b0e9fad
Author: Chris <ch...@colorado.edu>
AuthorDate: Mon Jul 23 18:35:33 2018 -0600

    External zookeeper kafka (#257)
    
    * make kafka and zookeeper optional
    
    * document optional kafka and zookeeper
    
    * kafka.host to kafka.name, set zookeeper_connect and zookeeper_zero_host from zookeeper.name
    
    * update docs with external kafka and zookeeper configuration examples
---
 docs/configurationChoices.md            | 40 +++++++++++++++++++++++++++++++++
 helm/openwhisk/templates/_helpers.tpl   | 15 ++++++++++++-
 helm/openwhisk/templates/kafka.yaml     |  2 ++
 helm/openwhisk/templates/zookeeper.yaml |  2 ++
 4 files changed, 58 insertions(+), 1 deletion(-)

diff --git a/docs/configurationChoices.md b/docs/configurationChoices.md
index 441a1a1..bbe944a 100644
--- a/docs/configurationChoices.md
+++ b/docs/configurationChoices.md
@@ -71,6 +71,46 @@ db:
   wipeAndInit: false
 ```
 
+### 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 }}