Skip to content

Commit

Permalink
Add some missing configuration
Browse files Browse the repository at this point in the history
- nginx worker processes
- containerPool akkaClient
- controller and invoker use its own Couchdb username and password
  • Loading branch information
ningyougang committed Jul 31, 2020
1 parent 59285fe commit 98ba056
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 15 deletions.
8 changes: 8 additions & 0 deletions helm/openwhisk/configMapFiles/initCouchDB/initdb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ pushd /openwhisk/ansible
-e db_host=$DB_HOST \
-e db_username=$COUCHDB_USER \
-e db_password=$COUCHDB_PASSWORD \
-e db_controller_user=$COUCHDB_CONTROLLER_USERNAME \
-e db_controller_pass=$COUCHDB_CONTROLLER_PASSWORD \
-e db_invoker_user=$COUCHDB_INVOKER_USERNAME \
-e db_invoker_pass=$COUCHDB_INVOKER_PASSWORD \
-e db_port=$DB_PORT \
-e openwhisk_home=/openwhisk

Expand All @@ -79,6 +83,10 @@ pushd /openwhisk/ansible
-e db_host=$DB_HOST \
-e db_username=$COUCHDB_USER \
-e db_password=$COUCHDB_PASSWORD \
-e db_controller_user=$COUCHDB_CONTROLLER_USERNAME \
-e db_controller_pass=$COUCHDB_CONTROLLER_PASSWORD \
-e db_invoker_user=$COUCHDB_INVOKER_USERNAME \
-e db_invoker_pass=$COUCHDB_INVOKER_PASSWORD \
-e db_port=$DB_PORT \
-e openwhisk_home=/openwhisk
popd
Expand Down
12 changes: 1 addition & 11 deletions helm/openwhisk/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ app: {{ template "openwhisk.fullname" . }}
{{- end -}}

{{- define "openwhisk.db_authentication" -}}
{{ .Values.db.auth.username }}:{{ .Values.db.auth.password }}
{{ .Values.db.auth.admin.username }}:{{ .Values.db.auth.admin.password }}
{{- end -}}

{{- define "openwhisk.elasticsearch_authentication" -}}
Expand Down Expand Up @@ -114,16 +114,6 @@ app: {{ template "openwhisk.fullname" . }}

{{/* Environment variables required for accessing CouchDB from a pod */}}
{{- define "openwhisk.dbEnvVars" -}}
- name: "CONFIG_whisk_couchdb_username"
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-db.auth
key: db_username
- name: "CONFIG_whisk_couchdb_password"
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-db.auth
key: db_password
- name: "CONFIG_whisk_couchdb_port"
valueFrom:
configMapKeyRef:
Expand Down
10 changes: 10 additions & 0 deletions helm/openwhisk/templates/controller-pod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,16 @@ spec:
value: "{{ include "openwhisk.kafka_connect" . }}"
{{ include "openwhisk.kafkaConfigEnvVars" . | indent 8 }}

- name: "CONFIG_whisk_couchdb_username"
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-db.auth
key: db_controller_username
- name: "CONFIG_whisk_couchdb_password"
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-db.auth
key: db_controller_password
# properties for DB connection
{{ include "openwhisk.dbEnvVars" . | indent 8 }}

Expand Down
20 changes: 20 additions & 0 deletions helm/openwhisk/templates/couchdb-init-job.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,26 @@ spec:
secretKeyRef:
name: {{ .Release.Name }}-db.auth
key: db_password
- name: "COUCHDB_CONTROLLER_USERNAME"
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-db.auth
key: db_controller_username
- name: "COUCHDB_CONTROLLER_PASSWORD"
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-db.auth
key: db_controller_password
- name: "COUCHDB_INVOKER_USERNAME"
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-db.auth
key: db_invoker_username
- name: "COUCHDB_INVOKER_PASSWORD"
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-db.auth
key: db_invoker_password
- name: "NODENAME"
value: "couchdb0"

Expand Down
13 changes: 13 additions & 0 deletions helm/openwhisk/templates/invoker-pod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,26 @@ spec:
- name: "WHISK_LOGS_DIR"
value: ""

- name: "CONFIG_whisk_containerPool_akkaClient"
value: "{{ .Values.whisk.containerPool.akkaClient }}"

# this version is the day it is deployed,
- name: "CONFIG_whisk_info_date"
valueFrom:
configMapKeyRef:
name: {{ .Release.Name }}-whisk.config
key: whisk_info_date

- name: "CONFIG_whisk_couchdb_username"
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-db.auth
key: db_invoker_username
- name: "CONFIG_whisk_couchdb_password"
valueFrom:
secretKeyRef:
name: {{ .Release.Name }}-db.auth
key: db_invoker_password
# properties for DB connection
{{ include "openwhisk.dbEnvVars" . | indent 10 }}

Expand Down
1 change: 1 addition & 0 deletions helm/openwhisk/templates/nginx-cm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ metadata:
{{ include "openwhisk.label_boilerplate" . | indent 4 }}
data:
nginx.conf: |
worker_processes {{ .Values.nginx.workerProcesses }};
worker_rlimit_nofile 4096;
events {
Expand Down
8 changes: 6 additions & 2 deletions helm/openwhisk/templates/ow-db-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,9 @@ metadata:
{{ include "openwhisk.label_boilerplate" . | indent 4 }}
type: Opaque
data:
db_username: {{ .Values.db.auth.username | b64enc }}
db_password: {{ .Values.db.auth.password | b64enc }}
db_username: {{ .Values.db.auth.admin.username | b64enc }}
db_password: {{ .Values.db.auth.admin.password | b64enc }}
db_controller_username: {{ .Values.db.auth.controller.username | b64enc }}
db_controller_password: {{ .Values.db.auth.controller.password | b64enc }}
db_invoker_username: {{ .Values.db.auth.invoker.username | b64enc }}
db_invoker_password: {{ .Values.db.auth.invoker.password | b64enc }}
13 changes: 11 additions & 2 deletions helm/openwhisk/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ whisk:
retentionMs: ""
containerPool:
userMemory: "2048m"
akkaClient: false
runtimes: "runtimes.json"
testing:
includeTests: true
Expand Down Expand Up @@ -220,8 +221,15 @@ db:
protocol: "http"
# Production deployments _MUST_ override the default user/password values
auth:
username: "whisk_admin"
password: "some_passw0rd"
admin:
username: "test_admin"
password: "some_passw0rd"
controller:
username: "test_controller0"
password: "some_controller_passw0rd"
invoker:
username: "test_invoker"
password: "some_invoker_passw0rd"
dbPrefix: "test_"
activationsTable: "test_activations"
actionsTable: "test_whisks"
Expand All @@ -239,6 +247,7 @@ nginx:
imagePullPolicy: "IfNotPresent"
replicaCount: 1
restartPolicy: "Always"
workerProcesses: 1
httpPort: 80
httpsPort: 443
httpsNodePort: 31001
Expand Down

0 comments on commit 98ba056

Please sign in to comment.