| # |
| # 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. |
| # |
| |
| {{- if .Values.providers.cloudant.enabled }} |
| apiVersion: apps/v1 |
| kind: Deployment |
| metadata: |
| name: {{ .Release.Name }}-cloudantprovider |
| labels: |
| name: {{ .Release.Name }}-cloudantprovider |
| {{ include "openwhisk.label_boilerplate" . | indent 4 }} |
| spec: |
| replicas: {{ .Values.providers.cloudant.replicaCount }} |
| selector: |
| matchLabels: |
| name: {{ .Release.Name }}-cloudantprovider |
| template: |
| metadata: |
| labels: |
| name: {{ .Release.Name }}-cloudantprovider |
| {{ include "openwhisk.label_boilerplate" . | indent 8 }} |
| spec: |
| restartPolicy: {{ .Values.providers.cloudant.restartPolicy }} |
| volumes: |
| - name: cloudant-logs |
| {{- if .Values.k8s.persistence.enabled }} |
| persistentVolumeClaim: |
| claimName: {{ .Release.Name }}-cloudantprovider-pvc |
| {{- else }} |
| emptyDir: {} |
| {{- end }} |
| initContainers: |
| # Wait for a controller to be up (which implies couchdb is up as well). |
| {{ include "openwhisk.readiness.waitForController" . | indent 6 }} |
| {{ include "openwhisk.docker.imagePullSecrets" . | indent 6 }} |
| containers: |
| - name: cloudantprovider |
| image: "{{- .Values.docker.registry.name -}}{{- .Values.providers.cloudant.imageName -}}:{{- .Values.providers.cloudant.imageTag -}}" |
| imagePullPolicy: {{ .Values.providers.cloudant.imagePullPolicy | quote }} |
| ports: |
| - name: cludntprovider |
| containerPort: {{ .Values.providers.cloudant.apiPort }} |
| env: |
| {{- if .Values.providers.db.external }} |
| # Config database using the external instance |
| - name: "DB_PROTOCOL" |
| value: {{ .Values.providers.db.protocol | quote }} |
| - name: "DB_HOST" |
| value: "{{ .Values.providers.db.host }}:{{ .Values.providers.db.port }}" |
| - name: "DB_USERNAME" |
| value: {{ .Values.providers.db.username | quote }} |
| - name: "DB_PASSWORD" |
| value: {{ .Values.providers.db.password | quote }} |
| {{- else }} |
| # Config database using the same openwhisk cloudant instance |
| - name: "DB_PROTOCOL" |
| valueFrom: |
| configMapKeyRef: |
| name: {{ .Release.Name }}-db.config |
| key: db_protocol |
| - name: "DB_HOST" |
| valueFrom: |
| configMapKeyRef: |
| name: {{ .Release.Name }}-db.config |
| key: db_host_port |
| - name: "DB_USERNAME" |
| valueFrom: |
| secretKeyRef: |
| name: {{ .Release.Name }}-db.auth |
| key: db_username |
| - name: "DB_PASSWORD" |
| valueFrom: |
| secretKeyRef: |
| name: {{ .Release.Name }}-db.auth |
| key: db_password |
| {{- end }} |
| - name: "DB_PREFIX" |
| value: {{ .Values.providers.cloudant.dbPrefix | quote }} |
| - name: "ROUTER_HOST" |
| valueFrom: |
| configMapKeyRef: |
| name: {{ .Release.Name }}-whisk.config |
| key: whisk_api_host_nameAndPort |
| - name: "ENDPOINT_AUTH" |
| valueFrom: |
| configMapKeyRef: |
| name: {{ .Release.Name }}-whisk.config |
| key: whisk_api_host_nameAndPort |
| volumeMounts: |
| - name: cloudant-logs |
| mountPath: /logs |
| {{- end }} |