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

[incubator-openwhisk-deploy-kube] branch master updated: enable cloudant provider package to use a different cloudant instance (#284)

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 a36bb7b  enable cloudant provider package to use a different cloudant instance (#284)
a36bb7b is described below

commit a36bb7b689faa4548a385362bc94be473b28a47f
Author: Ying Chun Guo <gu...@cn.ibm.com>
AuthorDate: Fri Aug 24 22:35:56 2018 +0800

    enable cloudant provider package to use a different cloudant instance (#284)
---
 helm/providers/charts/alarm/templates/NOTES.txt        |  2 +-
 helm/providers/charts/cloudant/README.md               | 18 +++++++++++++++++-
 helm/providers/charts/cloudant/templates/NOTES.txt     |  2 +-
 .../cloudant/templates/installPkgCloudantJob.yaml      | 18 ++++++++++++++++--
 .../charts/cloudant/templates/pkgCloudantProvider.yaml | 15 ++++++++++++++-
 helm/providers/charts/cloudant/values.yaml             | 10 +++++++++-
 6 files changed, 58 insertions(+), 7 deletions(-)

diff --git a/helm/providers/charts/alarm/templates/NOTES.txt b/helm/providers/charts/alarm/templates/NOTES.txt
index b01e731..c7328ed 100644
--- a/helm/providers/charts/alarm/templates/NOTES.txt
+++ b/helm/providers/charts/alarm/templates/NOTES.txt
@@ -1,6 +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. */}}
-Apache OpenWhisk Kafka Provider
+Apache OpenWhisk Alarm Provider
 Copyright 2016-2018 The Apache Software Foundation
 
 This product includes software developed at
diff --git a/helm/providers/charts/cloudant/README.md b/helm/providers/charts/cloudant/README.md
index 7f834f1..358a64e 100644
--- a/helm/providers/charts/cloudant/README.md
+++ b/helm/providers/charts/cloudant/README.md
@@ -23,7 +23,23 @@ This chart is to deploy Cloudant provider and package to OpenWhisk on a Kubernet
 
 ## Preconditions
 
-+ A database to save the event data is required by Cloudant provider and package. The current implementation is to use the same Cloudant instance that is being used by OpenWhisk itself. Later we will provide another choice to use a different database.
++ A CouchDB instance is required to save the event data. You can use the same CouchDB instance or you can use a different CouchDB instance. To use the same CouchDB instance as OpenWhisk, config `values.yaml` as:
+```
+db:
+  external: false
+  prefix: "cldt"
+```
+To use a different CouchDB instance, config the database parameters in `value.yaml` as:
+```
+db:
+  external: true
+  prefix: "cldt"
+  host: "0.0.0.0"
+  port: 5984
+  protocol: "http"
+  username: "admin"
+  password: "secret"
+```
 + persistentvolumes (aka 'pv') is required by this charter. You can verify by `kubectl get pv`.
 + Action containers use Kubernetes DNS. The easiest way to do this is to use the `KubernetesContainerFactory` as the [Invoker Container Factory](https://github.com/apache/incubator-openwhisk-deploy-kube/blob/master/docs/configurationChoices.md#invoker-container-factory) in the Kubernetes cluster by adding below configuration in the `mycluster.yaml` when you deploy OpenWhisk with Helm:
 ```
diff --git a/helm/providers/charts/cloudant/templates/NOTES.txt b/helm/providers/charts/cloudant/templates/NOTES.txt
index b01e731..690a6fa 100644
--- a/helm/providers/charts/cloudant/templates/NOTES.txt
+++ b/helm/providers/charts/cloudant/templates/NOTES.txt
@@ -1,6 +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. */}}
-Apache OpenWhisk Kafka Provider
+Apache OpenWhisk Cloudant Provider
 Copyright 2016-2018 The Apache Software Foundation
 
 This product includes software developed at
diff --git a/helm/providers/charts/cloudant/templates/installPkgCloudantJob.yaml b/helm/providers/charts/cloudant/templates/installPkgCloudantJob.yaml
index 99c09aa..2d2c729 100644
--- a/helm/providers/charts/cloudant/templates/installPkgCloudantJob.yaml
+++ b/helm/providers/charts/cloudant/templates/installPkgCloudantJob.yaml
@@ -36,7 +36,20 @@ spec:
               configMapKeyRef:
                 name: whisk.config
                 key: whisk_api_host_nameAndPort
-          # for the database used by cloudant package
+          {{- if .Values.cloudantprovider.db.external }}
+          # Config database using the external cloudant instance
+          - name: "DB_PROTOCOL"
+            value: {{ .Values.cloudantprovider.db.protocol | quote }}
+          - name: "DB_HOST"
+            value: {{ .Values.cloudantprovider.db.host | quote }}
+          - name: "DB_USERNAME"
+            value: {{ .Values.cloudantprovider.db.username | quote }}
+          - name: "DB_PASSWORD"
+            value: {{ .Values.cloudantprovider.db.password | quote }}
+          - name: "DB_PORT"
+            value: {{ .Values.cloudantprovider.db.port | quote }}
+          {{- else }}
+          # Config database using the same openwhisk cloudant instance
           - name: "DB_HOST"
             valueFrom:
               configMapKeyRef:
@@ -62,8 +75,9 @@ spec:
               secretKeyRef:
                 name: db.auth
                 key: db_password
+          {{ end }}
           - name: "DB_PREFIX"
-            value: "{{- .Values.cloudantprovider.dbPrefix -}}"
+            value: {{ .Values.cloudantprovider.db.prefix | default "cldt" | quote }}
 ---
 apiVersion: v1
 kind: ConfigMap
diff --git a/helm/providers/charts/cloudant/templates/pkgCloudantProvider.yaml b/helm/providers/charts/cloudant/templates/pkgCloudantProvider.yaml
index 691d18e..3424b9e 100644
--- a/helm/providers/charts/cloudant/templates/pkgCloudantProvider.yaml
+++ b/helm/providers/charts/cloudant/templates/pkgCloudantProvider.yaml
@@ -28,6 +28,18 @@ spec:
         - name: cludntprovider
           containerPort: {{ .Values.cloudantprovider.apiPort }}
         env:
+        {{- if .Values.cloudantprovider.db.external }}
+        # Config database using the external instance
+        - name: "DB_PROTOCOL"
+          value: {{ .Values.cloudantprovider.db.protocol | quote }}
+        - name: "DB_HOST"
+          value: "{{ .Values.cloudantprovider.db.host }}:{{ .Values.cloudantprovider.db.port }}"
+        - name: "DB_USERNAME"
+          value: {{ .Values.cloudantprovider.db.username | quote }}
+        - name: "DB_PASSWORD"
+          value: {{ .Values.cloudantprovider.db.password | quote }}
+        {{- else }}
+        # Config database using the same openwhisk cloudant instance
         - name: "DB_PROTOCOL"
           valueFrom:
             configMapKeyRef:
@@ -48,8 +60,9 @@ spec:
             secretKeyRef:
               name: db.auth
               key: db_password
+        {{- end }}
         - name: "DB_PREFIX"
-          value: "{{- .Values.cloudantprovider.dbPrefix -}}"
+          value: {{ .Values.cloudantprovider.db.prefix | default "cldt" | quote }}
         - name: "ROUTER_HOST"
           valueFrom:
             configMapKeyRef:
diff --git a/helm/providers/charts/cloudant/values.yaml b/helm/providers/charts/cloudant/values.yaml
index 479fd7c..35f7a1f 100644
--- a/helm/providers/charts/cloudant/values.yaml
+++ b/helm/providers/charts/cloudant/values.yaml
@@ -10,7 +10,15 @@ cloudantprovider:
   imagePullPolicy: "IfNotPresent"
   restartPolicy: "Always"
   apiPort: 8080
-  dbPrefix: "cldt"
+  db:
+    external: false
+    prefix: "cldt"
+    # Add below values if you are using external instance
+    # host: "10.10.10.10"
+    # port: 5984
+    # protocol: "http"
+    # username: "admin"
+    # password: "secret"
   persistence:
     pvcName: cludntprovider-pvc
     size: 1Gi