You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/08/24 14:35:58 UTC

[GitHub] dgrove-oss closed pull request #284: Enable cloudant package provider to use a different couchdb instance

dgrove-oss closed pull request #284: Enable cloudant package provider to use a different couchdb instance
URL: https://github.com/apache/incubator-openwhisk-deploy-kube/pull/284
 
 
   

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/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


 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services