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/22 13:25:06 UTC
[incubator-openwhisk-deploy-kube] branch master updated: add
cloudant provider (#279)
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 3bf50ae add cloudant provider (#279)
3bf50ae is described below
commit 3bf50ae33da59e556868c9f9f166472fe3e590c6
Author: Ying Chun Guo <gu...@cn.ibm.com>
AuthorDate: Wed Aug 22 21:25:03 2018 +0800
add cloudant provider (#279)
---
.../charts/alarm/templates/installPkgAlarmJob.yaml | 2 +-
.../charts/alarm/templates/pkgAlarmProvider.yaml | 2 +-
helm/providers/charts/cloudant/Chart.yaml | 12 ++++++
helm/providers/charts/cloudant/README.md | 49 ++++++++++++++++++++++
.../charts/cloudant/configMapFiles/myTask.sh | 16 +++++++
helm/providers/charts/cloudant/templates/NOTES.txt | 14 +++++++
.../templates/installPkgCloudantJob.yaml} | 19 +++++----
.../templates/pkgCloudantProvider.yaml} | 36 ++++++++--------
helm/providers/charts/cloudant/values.yaml | 18 ++++++++
9 files changed, 141 insertions(+), 27 deletions(-)
diff --git a/helm/providers/charts/alarm/templates/installPkgAlarmJob.yaml b/helm/providers/charts/alarm/templates/installPkgAlarmJob.yaml
index 24dcf28..a17b0f5 100644
--- a/helm/providers/charts/alarm/templates/installPkgAlarmJob.yaml
+++ b/helm/providers/charts/alarm/templates/installPkgAlarmJob.yaml
@@ -36,7 +36,7 @@ spec:
configMapKeyRef:
name: whisk.config
key: whisk_api_host_nameAndPort
- # for the database used by kafka package
+ # for the database used by alarms package
- name: "DB_HOST"
valueFrom:
configMapKeyRef:
diff --git a/helm/providers/charts/alarm/templates/pkgAlarmProvider.yaml b/helm/providers/charts/alarm/templates/pkgAlarmProvider.yaml
index c543bd8..040d2b9 100644
--- a/helm/providers/charts/alarm/templates/pkgAlarmProvider.yaml
+++ b/helm/providers/charts/alarm/templates/pkgAlarmProvider.yaml
@@ -25,7 +25,7 @@ spec:
imagePullPolicy: {{ .Values.alarmprovider.imagePullPolicy | quote }}
image: {{ .Values.alarmprovider.image | quote }}
ports:
- - name: kafkaprovider
+ - name: alarmprovider
containerPort: {{ .Values.alarmprovider.apiPort }}
env:
- name: "DB_PROTOCOL"
diff --git a/helm/providers/charts/cloudant/Chart.yaml b/helm/providers/charts/cloudant/Chart.yaml
new file mode 100644
index 0000000..ea6c99c
--- /dev/null
+++ b/helm/providers/charts/cloudant/Chart.yaml
@@ -0,0 +1,12 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more contributor
+# license agreements; and to You under the Apache License, Version 2.0.
+
+apiVersion: v1
+description: A Helm chart to deploy the Apache OpenWhisk Cloudant Provider on Kubernetes
+name: Apache OpenWhisk Cloudant Provider
+version: 0.1.0
+keywords:
+ - Apache OpenWhisk
+maintainers:
+ - name: Apache OpenWhisk committers
+ email: dev@openwhisk.apache.org
diff --git a/helm/providers/charts/cloudant/README.md b/helm/providers/charts/cloudant/README.md
new file mode 100644
index 0000000..7f834f1
--- /dev/null
+++ b/helm/providers/charts/cloudant/README.md
@@ -0,0 +1,49 @@
+<!--
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+-->
+
+# Use Helm to deploy Cloudant provider and package
+
+This chart is to deploy Cloudant provider and package to OpenWhisk on a Kubernetes using Helm.
+
+## 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.
++ 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:
+```
+# Invoker configurations
+invoker:
+ containerFactory:
+ impl: "kubernetes"
+```
+If you want to use the `DockerContainerFactory` you can instead attempt to configure the invoker to use Kubernetes DNS. First you can get the IP address of Kubernetes DNS server by `echo $(kubectl get svc kube-dns -n kube-system -o 'jsonpath={.spec.clusterIP}')` and then add below configuration in the `mycluster.yaml`:
+```
+# Invoker configurations
+invoker:
+ kube_dns: "<IP_Address_Of_Kube_DNS>"
+```
+
+## Install
+
+You may install this chart with command like
+```
+helm install ./helm/providers/charts/cloudant --namespace=openwhisk --name owdev-cloudant-provider
+```
+
+You can use `helm status owdev-cloudant-provider` to check the status. When you see pod is running and job is completed, you can check cloudant package by `wsk package get /whisk.system/cloudant -i --summary`
diff --git a/helm/providers/charts/cloudant/configMapFiles/myTask.sh b/helm/providers/charts/cloudant/configMapFiles/myTask.sh
new file mode 100644
index 0000000..4a92c30
--- /dev/null
+++ b/helm/providers/charts/cloudant/configMapFiles/myTask.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+# Licensed to the Apache Software Foundation (ASF) under one or more contributor
+# license agreements; and to You under the Apache License, Version 2.0.
+
+# installCatalog.sh expects the wsk cli to be $OPENWHISK_HOME/bin/wsk
+
+export OPENWHISK_HOME=/usr/local
+
+git clone https://github.com/apache/incubator-openwhisk-package-cloudant.git
+
+export DB_URL=$DB_PROTOCOL://$DB_USERNAME:$DB_PASSWORD@$DB_HOST:$DB_PORT
+pushd /incubator-openwhisk-package-cloudant
+ ./installCatalog.sh $AUTH $APIHOST $DB_URL $DB_PREFIX $APIHOST
+popd
+
+echo "successfully setup cloudant package"
diff --git a/helm/providers/charts/cloudant/templates/NOTES.txt b/helm/providers/charts/cloudant/templates/NOTES.txt
new file mode 100644
index 0000000..b01e731
--- /dev/null
+++ b/helm/providers/charts/cloudant/templates/NOTES.txt
@@ -0,0 +1,14 @@
+{{/* 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
+Copyright 2016-2018 The Apache Software Foundation
+
+This product includes software developed at
+The Apache Software Foundation (http://www.apache.org/).
+
+Your release is named {{ .Release.Name }}.
+
+To learn more about the release, try:
+
+ $ helm status {{ .Release.Name }}
+ $ helm get {{ .Release.Name }}
diff --git a/helm/providers/charts/alarm/templates/installPkgAlarmJob.yaml b/helm/providers/charts/cloudant/templates/installPkgCloudantJob.yaml
similarity index 79%
copy from helm/providers/charts/alarm/templates/installPkgAlarmJob.yaml
copy to helm/providers/charts/cloudant/templates/installPkgCloudantJob.yaml
index 24dcf28..99c09aa 100644
--- a/helm/providers/charts/alarm/templates/installPkgAlarmJob.yaml
+++ b/helm/providers/charts/cloudant/templates/installPkgCloudantJob.yaml
@@ -4,21 +4,21 @@
apiVersion: batch/v1
kind: Job
metadata:
- name: install-package-alarm
+ name: install-package-cloudant
namespace: {{ .Release.Namespace | quote }}
spec:
activeDeadlineSeconds: 600
template:
metadata:
- name: install-package-alarm
+ name: install-package-cloudant
spec:
restartPolicy: Never
volumes:
- name: task-dir
configMap:
- name: install-package-alarms
+ name: install-package-cloudant
containers:
- - name: alarmpkginstaller
+ - name: cloudantpkginstaller
image: openwhisk/kube-whisk-script-runner
volumeMounts:
- name: task-dir
@@ -36,12 +36,17 @@ spec:
configMapKeyRef:
name: whisk.config
key: whisk_api_host_nameAndPort
- # for the database used by kafka package
+ # for the database used by cloudant package
- name: "DB_HOST"
valueFrom:
configMapKeyRef:
name: db.config
key: db_host
+ - name: "DB_PROTOCOL"
+ valueFrom:
+ configMapKeyRef:
+ name: db.config
+ key: db_protocol
- name: "DB_PORT"
valueFrom:
configMapKeyRef:
@@ -58,12 +63,12 @@ spec:
name: db.auth
key: db_password
- name: "DB_PREFIX"
- value: "{{- .Values.alarmprovider.dbPrefix -}}"
+ value: "{{- .Values.cloudantprovider.dbPrefix -}}"
---
apiVersion: v1
kind: ConfigMap
metadata:
- name: install-package-alarms
+ name: install-package-cloudant
namespace: {{ .Release.Namespace | quote }}
data:
{{ (.Files.Glob "configMapFiles/myTask.sh").AsConfig | indent 2 }}
diff --git a/helm/providers/charts/alarm/templates/pkgAlarmProvider.yaml b/helm/providers/charts/cloudant/templates/pkgCloudantProvider.yaml
similarity index 59%
copy from helm/providers/charts/alarm/templates/pkgAlarmProvider.yaml
copy to helm/providers/charts/cloudant/templates/pkgCloudantProvider.yaml
index c543bd8..691d18e 100644
--- a/helm/providers/charts/alarm/templates/pkgAlarmProvider.yaml
+++ b/helm/providers/charts/cloudant/templates/pkgCloudantProvider.yaml
@@ -4,29 +4,29 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
- name: {{ .Values.alarmprovider.name | quote }}
+ name: {{ .Values.cloudantprovider.name | quote }}
namespace: {{ .Release.Namespace | quote }}
labels:
- name: alarmprovider
+ name: cloudantprovider
spec:
- replicas: {{ .Values.alarmprovider.replicaCount }}
+ replicas: {{ .Values.cloudantprovider.replicaCount }}
template:
metadata:
labels:
- name: {{ .Values.alarmprovider.name | quote }}
+ name: {{ .Values.cloudantprovider.name | quote }}
spec:
- restartPolicy: {{ .Values.alarmprovider.restartPolicy }}
+ restartPolicy: {{ .Values.cloudantprovider.restartPolicy }}
volumes:
- - name: alarm-logs
+ - name: cloudant-logs
persistentVolumeClaim:
- claimName: {{ .Values.alarmprovider.persistence.pvcName | quote }}
+ claimName: {{ .Values.cloudantprovider.persistence.pvcName | quote }}
containers:
- - name: {{ .Values.alarmprovider.name | quote }}
- imagePullPolicy: {{ .Values.alarmprovider.imagePullPolicy | quote }}
- image: {{ .Values.alarmprovider.image | quote }}
+ - name: {{ .Values.cloudantprovider.name | quote }}
+ imagePullPolicy: {{ .Values.cloudantprovider.imagePullPolicy | quote }}
+ image: {{ .Values.cloudantprovider.image | quote }}
ports:
- - name: kafkaprovider
- containerPort: {{ .Values.alarmprovider.apiPort }}
+ - name: cludntprovider
+ containerPort: {{ .Values.cloudantprovider.apiPort }}
env:
- name: "DB_PROTOCOL"
valueFrom:
@@ -49,7 +49,7 @@ spec:
name: db.auth
key: db_password
- name: "DB_PREFIX"
- value: "{{- .Values.alarmprovider.dbPrefix -}}"
+ value: "{{- .Values.cloudantprovider.dbPrefix -}}"
- name: "ROUTER_HOST"
valueFrom:
configMapKeyRef:
@@ -61,19 +61,19 @@ spec:
name: whisk.config
key: whisk_api_host_nameAndPort
volumeMounts:
- - name: alarm-logs
+ - name: cloudant-logs
mountPath: /logs
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
- name: {{ .Values.alarmprovider.persistence.pvcName | quote }}
+ name: {{ .Values.cloudantprovider.persistence.pvcName | quote }}
namespace: {{ .Release.Namespace | quote }}
spec:
- storageClassName: {{ .Values.alarmprovider.persistence.storageClass }}
+ storageClassName: {{ .Values.cloudantprovider.persistence.storageClass }}
accessModes:
- - {{ .Values.alarmprovider.persistence.accessMode }}
+ - {{ .Values.cloudantprovider.persistence.accessMode }}
resources:
requests:
- storage: {{ .Values.alarmprovider.persistence.size }}
+ storage: {{ .Values.cloudantprovider.persistence.size }}
diff --git a/helm/providers/charts/cloudant/values.yaml b/helm/providers/charts/cloudant/values.yaml
new file mode 100644
index 0000000..479fd7c
--- /dev/null
+++ b/helm/providers/charts/cloudant/values.yaml
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more contributor
+# license agreements; and to You under the Apache License, Version 2.0.
+
+# Alarm provider configurations
+cloudantprovider:
+ name: "cloudantprovider"
+ image: "openwhisk/cloudantprovider:latest"
+ # NOTE: replicaCount > 1 doesn't work because of the PVC
+ replicaCount: 1
+ imagePullPolicy: "IfNotPresent"
+ restartPolicy: "Always"
+ apiPort: 8080
+ dbPrefix: "cldt"
+ persistence:
+ pvcName: cludntprovider-pvc
+ size: 1Gi
+ storageClass: default
+ accessMode: ReadWriteOnce