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

dgrove 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 08079e6  feat: add possibility to use external redis (#502)
08079e6 is described below

commit 08079e676734dc5ec5325321549004a4cc80cfc8
Author: Robert Kopaczewski <[email protected]>
AuthorDate: Wed Jul 31 23:39:39 2019 +0200

    feat: add possibility to use external redis (#502)
    
    * feat: add possibility to use external redis
---
 docs/configurationChoices.md            | 16 ++++++++++++++++
 helm/openwhisk/templates/_helpers.tpl   |  4 ++++
 helm/openwhisk/templates/redis-pod.yaml |  2 ++
 helm/openwhisk/templates/redis-pvc.yaml |  2 +-
 helm/openwhisk/templates/redis-svc.yaml |  2 ++
 helm/openwhisk/values-metadata.yaml     | 15 +++++++++++++--
 helm/openwhisk/values.yaml              |  2 ++
 7 files changed, 40 insertions(+), 3 deletions(-)

diff --git a/docs/configurationChoices.md b/docs/configurationChoices.md
index 0d4e00f..c37ea99 100644
--- a/docs/configurationChoices.md
+++ b/docs/configurationChoices.md
@@ -78,6 +78,22 @@ db:
   wipeAndInit: false
 ```
 
+### Using an external redis
+
+Similarly, you may want to use external Redis instance instead of using 
default single pod deployment.
+This is especially useful in production scenarios as a HA Redis deployment is 
recommended.
+
+To use an externally deployed Redis, add a stanza like the one
+below to your `mycluster.yaml`, substituting in the appropriate values
+for `<...>`
+
+```yaml
+redis:
+  external: true
+  host: <redis hostname or ip addr>
+  port: <redis port>
+```
+
 ### Persistence
 
 Several of the OpenWhisk components that are deployed by the Helm
diff --git a/helm/openwhisk/templates/_helpers.tpl 
b/helm/openwhisk/templates/_helpers.tpl
index 8224bae..96a192d 100644
--- a/helm/openwhisk/templates/_helpers.tpl
+++ b/helm/openwhisk/templates/_helpers.tpl
@@ -57,8 +57,12 @@ app: {{ template "openwhisk.fullname" . }}
 
 {{/* hostname for redis */}}
 {{- define "openwhisk.redis_host" -}}
+{{- if .Values.redis.external -}}
+{{ .Values.redis.host }}
+{{- else -}}
 {{ .Release.Name }}-redis.{{ .Release.Namespace }}.svc.{{ .Values.k8s.domain }}
 {{- end -}}
+{{- end -}}
 
 {{/* client connection string for zookeeper cluster 
(server1:port,server2:port, ... serverN:port)*/}}
 {{- define "openwhisk.zookeeper_connect" -}}
diff --git a/helm/openwhisk/templates/redis-pod.yaml 
b/helm/openwhisk/templates/redis-pod.yaml
index 53aeb4d..1bf7160 100644
--- a/helm/openwhisk/templates/redis-pod.yaml
+++ b/helm/openwhisk/templates/redis-pod.yaml
@@ -15,6 +15,7 @@
 # limitations under the License.
 #
 
+{{ if not .Values.redis.external }}
 apiVersion: apps/v1
 kind: Deployment
 metadata:
@@ -82,3 +83,4 @@ spec:
           ports:
           - name: redis
             containerPort: {{ .Values.redis.port }}
+{{ end }}
diff --git a/helm/openwhisk/templates/redis-pvc.yaml 
b/helm/openwhisk/templates/redis-pvc.yaml
index d161bd1..3feafc4 100644
--- a/helm/openwhisk/templates/redis-pvc.yaml
+++ b/helm/openwhisk/templates/redis-pvc.yaml
@@ -15,7 +15,7 @@
 # limitations under the License.
 #
 
-{{- if .Values.k8s.persistence.enabled }}
+{{- if and (not .Values.redis.external) .Values.k8s.persistence.enabled }}
 apiVersion: v1
 kind: PersistentVolumeClaim
 metadata:
diff --git a/helm/openwhisk/templates/redis-svc.yaml 
b/helm/openwhisk/templates/redis-svc.yaml
index 96472d7..ed03f78 100644
--- a/helm/openwhisk/templates/redis-svc.yaml
+++ b/helm/openwhisk/templates/redis-svc.yaml
@@ -15,6 +15,7 @@
 # limitations under the License.
 #
 
+{{ if not .Values.redis.external }}
 apiVersion: v1
 kind: Service
 metadata:
@@ -28,3 +29,4 @@ spec:
   ports:
     - port: {{ .Values.redis.port }}
       name: redis
+{{ end }}
diff --git a/helm/openwhisk/values-metadata.yaml 
b/helm/openwhisk/values-metadata.yaml
index 1add4a6..1e2eecf 100644
--- a/helm/openwhisk/values-metadata.yaml
+++ b/helm/openwhisk/values-metadata.yaml
@@ -1185,6 +1185,12 @@ redis:
   __metadata:
     label: "Redis configuration"
     description: "Update these default values to customize the Redis 
deployment"
+  external:
+    __metadata:
+      label: "External"
+      description: "If using an externally deployed Redis"
+      type: "boolean"
+      required: true
   imageName:
     __metadata:
       label: "Image name"
@@ -1222,6 +1228,12 @@ redis:
       description: "The restart policy for redis pods"
       type: "string"
       required: true
+  host:
+    __metadata:
+      label: "Host"
+      description: "If using an external Redis, the hostname or IP address to 
use to connect to the Redis"
+      type: "string"
+      required: true
   port:
     __metadata:
       label: "Port"
@@ -1243,7 +1255,7 @@ providers:
   db:
     external:
       __metadata:
-        label: "External Providers Databaae"
+        label: "External Providers Database"
         description: "If the event providers database is external"
         type: "boolean"
         required: true
@@ -1253,7 +1265,6 @@ providers:
         description: "The external event providers database host"
         type: "string"
         required: true
-        required: true
     port:
       __metadata:
         label: "Database port"
diff --git a/helm/openwhisk/values.yaml b/helm/openwhisk/values.yaml
index 07e7fde..7c14d7c 100644
--- a/helm/openwhisk/values.yaml
+++ b/helm/openwhisk/values.yaml
@@ -295,12 +295,14 @@ apigw:
 
 # Redis (used by apigateway)
 redis:
+  external: false
   imageName: "redis"
   imageTag: "4.0"
   imagePullPolicy: "IfNotPresent"
   # NOTE: setting replicaCount > 1 will not work; need to add redis cluster 
configuration
   replicaCount: 1
   restartPolicy: "Always"
+  host: nil
   port: 6379
   persistence:
     size: 256Mi

Reply via email to