| # |
| # 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.db.wipeAndInit }} |
| apiVersion: batch/v1 |
| kind: Job |
| metadata: |
| name: {{ .Release.Name }}-init-couchdb |
| labels: |
| name: {{ .Release.Name }}-init-couchdb |
| {{ include "openwhisk.label_boilerplate" . | indent 4 }} |
| spec: |
| backoffLimit: 3 |
| template: |
| metadata: |
| name: {{ .Release.Name }}-init-couchdb |
| labels: |
| name: {{ .Release.Name }}-init-couchdb |
| {{ include "openwhisk.label_boilerplate" . | indent 8 }} |
| spec: |
| restartPolicy: Never |
| volumes: |
| - name: task-dir |
| configMap: |
| name: {{ .Release.Name }}-init-couchdb |
| - name: whisk-auth |
| secret: |
| secretName: {{ .Release.Name }}-whisk.auth |
| {{ include "openwhisk.docker.imagePullSecrets" . | indent 6 }} |
| containers: |
| - name: init-couchdb |
| image: "{{- .Values.docker.registry.name -}}{{- .Values.utility.imageName -}}:{{- .Values.utility.imageTag -}}" |
| imagePullPolicy: {{ .Values.utility.imagePullPolicy | quote }} |
| command: ["/bin/bash", "-c", "set -e; . /task/initdb.sh"] |
| volumeMounts: |
| - name: task-dir |
| mountPath: "/task/initdb.sh" |
| subPath: "initdb.sh" |
| - name: whisk-auth |
| mountPath: "/etc/whisk-auth" |
| env: |
| - 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 |
| - name: "DB_PORT" |
| valueFrom: |
| configMapKeyRef: |
| name: {{ .Release.Name }}-db.config |
| key: db_port |
| - name: "DB_PREFIX" |
| valueFrom: |
| configMapKeyRef: |
| name: {{ .Release.Name }}-db.config |
| key: db_prefix |
| - name: "COUCHDB_USER" |
| valueFrom: |
| secretKeyRef: |
| name: {{ .Release.Name }}-db.auth |
| key: db_username |
| - name: "COUCHDB_PASSWORD" |
| valueFrom: |
| secretKeyRef: |
| name: {{ .Release.Name }}-db.auth |
| key: db_password |
| - name: "NODENAME" |
| value: "couchdb0" |
| |
| # tag to use for git clone to get ansible files to initialize couchdb |
| - name: "OW_GIT_TAG_OPENWHISK" |
| value: {{ .Values.whisk.versions.openwhisk.gitTag | quote }} |
| {{ end }} |