From 0bd63b0ef93efd2ce48d8f8ce68623b7fe0e0339 Mon Sep 17 00:00:00 2001 From: Paul Czarkowski Date: Tue, 17 Mar 2020 15:36:41 -0500 Subject: [PATCH 01/35] [WIP] discourse helm chart Signed-off-by: Paul Czarkowski --- bitnami/discourse/.gitignore | 1 + bitnami/discourse/.helmignore | 23 +++ bitnami/discourse/Chart.lock | 9 + bitnami/discourse/Chart.yaml | 22 +++ bitnami/discourse/LICENSE | 13 ++ bitnami/discourse/README.md | 44 +++++ bitnami/discourse/templates/NOTES.txt | 21 ++ bitnami/discourse/templates/_helpers.tpl | 63 ++++++ .../discourse/templates/configmap-envs.yaml | 22 +++ .../templates/deployment-sidekiq.yaml | 72 +++++++ bitnami/discourse/templates/deployment.yaml | 66 +++++++ bitnami/discourse/templates/ingress.yaml | 41 ++++ bitnami/discourse/templates/secret-envs.yaml | 14 ++ bitnami/discourse/templates/service.yaml | 15 ++ .../discourse/templates/serviceaccount.yaml | 12 ++ .../templates/tests/test-connection.yaml | 15 ++ bitnami/discourse/test.yaml | 183 ++++++++++++++++++ bitnami/discourse/values.yaml | 105 ++++++++++ 18 files changed, 741 insertions(+) create mode 100644 bitnami/discourse/.gitignore create mode 100644 bitnami/discourse/.helmignore create mode 100644 bitnami/discourse/Chart.lock create mode 100644 bitnami/discourse/Chart.yaml create mode 100644 bitnami/discourse/LICENSE create mode 100644 bitnami/discourse/README.md create mode 100644 bitnami/discourse/templates/NOTES.txt create mode 100644 bitnami/discourse/templates/_helpers.tpl create mode 100644 bitnami/discourse/templates/configmap-envs.yaml create mode 100644 bitnami/discourse/templates/deployment-sidekiq.yaml create mode 100644 bitnami/discourse/templates/deployment.yaml create mode 100644 bitnami/discourse/templates/ingress.yaml create mode 100644 bitnami/discourse/templates/secret-envs.yaml create mode 100644 bitnami/discourse/templates/service.yaml create mode 100644 bitnami/discourse/templates/serviceaccount.yaml create mode 100644 bitnami/discourse/templates/tests/test-connection.yaml create mode 100644 bitnami/discourse/test.yaml create mode 100644 bitnami/discourse/values.yaml diff --git a/bitnami/discourse/.gitignore b/bitnami/discourse/.gitignore new file mode 100644 index 00000000000000..ee3892e8794a08 --- /dev/null +++ b/bitnami/discourse/.gitignore @@ -0,0 +1 @@ +charts/ diff --git a/bitnami/discourse/.helmignore b/bitnami/discourse/.helmignore new file mode 100644 index 00000000000000..0e8a0eb36f4ca2 --- /dev/null +++ b/bitnami/discourse/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/bitnami/discourse/Chart.lock b/bitnami/discourse/Chart.lock new file mode 100644 index 00000000000000..895ccdd1b40531 --- /dev/null +++ b/bitnami/discourse/Chart.lock @@ -0,0 +1,9 @@ +dependencies: +- name: postgresql + repository: https://charts.bitnami.com/bitnami + version: 8.6.4 +- name: redis + repository: https://charts.bitnami.com/bitnami + version: 10.5.11 +digest: sha256:a8c674729c5c688f9e3799891d47e04606888c6ab54d2fc2159b03644c322bd0 +generated: "2020-03-14T10:12:55.307197087-05:00" diff --git a/bitnami/discourse/Chart.yaml b/bitnami/discourse/Chart.yaml new file mode 100644 index 00000000000000..6d20ea0cf6abd8 --- /dev/null +++ b/bitnami/discourse/Chart.yaml @@ -0,0 +1,22 @@ +apiVersion: v2 +name: discourse +description: A Helm chart for deploying Discourse to Kubernetes +type: application +version: 0.1.0 +appVersion: 2.4.1 +home: https://www.discourse.org/ +sources: +- https://github.com/spinnaker +maintainers: +- name: paulczar + email: username.taken@gmail.com + +dependencies: + - name: postgresql + repository: https://charts.bitnami.com/bitnami + version: 8.6.4 + condition: postgresql.enabled + - name: redis + repository: https://charts.bitnami.com/bitnami + version: 10.5.11 + condition: redis.enabled diff --git a/bitnami/discourse/LICENSE b/bitnami/discourse/LICENSE new file mode 100644 index 00000000000000..340e7270a1f5c1 --- /dev/null +++ b/bitnami/discourse/LICENSE @@ -0,0 +1,13 @@ +Copyright 2020 Paul Czarkowski + +Licensed 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. \ No newline at end of file diff --git a/bitnami/discourse/README.md b/bitnami/discourse/README.md new file mode 100644 index 00000000000000..2a872fc855bc5b --- /dev/null +++ b/bitnami/discourse/README.md @@ -0,0 +1,44 @@ +# Discourse Helm Chart + +> **Note**: This is a Helm 3 chart. Not using Helm 3? Time to upgrade. + +[Discourse](https://www.discourse.org/) is an opensource forum software. + +## Chart Details +This chart will provision a fully functional and fully featured Discourse installation +that can deploy and manage applications in the cluster that it is deployed to. + +Redis and Postgres are used. + +For more information on Discourse and its capabilities, see it's [documentation](https://docs.discourse.org/) as well as the [documentation](https://github.com/bitnami/bitnami-docker-discourse#configuration) for the Bitnami Discourse image. + +## Installing the Chart + +To install the chart with the release name `my-release`: + +```bash +$ helm install --name my-release . +``` + +Discourse is pretty insistent on accessing it via port 80 or 443. This is fine if you're hosting it on a public cluster, but if you want to test it locally with a port forward you need to fight it. + +The easiest [but horribly insecure] way to do it it is to simply allow kubectl to bind to privileged ports and then use a `port-forward`: + +```bash +sudo setcap CAP_NET_BIND_SERVICE=+eip $(which kubectl) +kubectl portforward svc/discourse 80:3000 +``` + +## Configuration + +Configurable values are documented in the `values.yaml`. + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. + +Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example, + +```bash +$ helm install --name my-release -f values.yaml . +``` + +> **Tip**: You can use the default [values.yaml](values.yaml) diff --git a/bitnami/discourse/templates/NOTES.txt b/bitnami/discourse/templates/NOTES.txt new file mode 100644 index 00000000000000..ea49b7d1a80854 --- /dev/null +++ b/bitnami/discourse/templates/NOTES.txt @@ -0,0 +1,21 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range .paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "discourse.fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "discourse.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "discourse.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "discourse.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:80 to use your application" + sudo kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 80:3000 +{{- end }} diff --git a/bitnami/discourse/templates/_helpers.tpl b/bitnami/discourse/templates/_helpers.tpl new file mode 100644 index 00000000000000..7bedcda8e73dcc --- /dev/null +++ b/bitnami/discourse/templates/_helpers.tpl @@ -0,0 +1,63 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "discourse.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "discourse.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "discourse.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Common labels +*/}} +{{- define "discourse.labels" -}} +helm.sh/chart: {{ include "discourse.chart" . }} +{{ include "discourse.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/* +Selector labels +*/}} +{{- define "discourse.selectorLabels" -}} +app.kubernetes.io/name: {{ include "discourse.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end -}} + +{{/* +Create the name of the service account to use +*/}} +{{- define "discourse.serviceAccountName" -}} +{{- if .Values.serviceAccount.create -}} + {{ default (include "discourse.fullname" .) .Values.serviceAccount.name }} +{{- else -}} + {{ default "default" .Values.serviceAccount.name }} +{{- end -}} +{{- end -}} diff --git a/bitnami/discourse/templates/configmap-envs.yaml b/bitnami/discourse/templates/configmap-envs.yaml new file mode 100644 index 00000000000000..1112e8387aff9e --- /dev/null +++ b/bitnami/discourse/templates/configmap-envs.yaml @@ -0,0 +1,22 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "discourse.fullname" . }}-envs + labels: + {{- include "discourse.labels" . | nindent 4 }} +data: + DISCOURSE_HOSTNAME: {{ .Values.hostname }} + DISCOURSE_USERNAME: {{ .Values.admin.username }} + DISCOURSE_EMAIL: {{ .Values.admin.email }} + DISCOURSE_SITENAME: {{ .Values.sitename }} + POSTGRESQL_HOST: {{ include "discourse.fullname" . }}-postgresql + DISCOURSE_POSTGRESQL_NAME: "{{ .Values.postgresql.postgresqlDatabase }}" + DISCOURSE_POSTGRESQL_USERNAME: "{{ .Values.postgresql.postgresqlUsername }}" + POSTGRESQL_ROOT_USER: "postgres" + POSTGRESQL_CLIENT_CREATE_DATABASE_NAME: "{{ .Values.postgresql.postgresqlDatabase }}" + POSTGRESQL_CLIENT_CREATE_DATABASE_USERNAME: "{{ .Values.postgresql.postgresqlUsername }}" + REDIS_HOST: {{ include "discourse.fullname" . }}-redis-master + REDIS_PORT_NUMBER: "6379" + {{- if .Release.IsUpgrade }} + DISCOURSE_SKIP_INSTALL: "yes" + {{- end }} diff --git a/bitnami/discourse/templates/deployment-sidekiq.yaml b/bitnami/discourse/templates/deployment-sidekiq.yaml new file mode 100644 index 00000000000000..498e4c9ff6dbd6 --- /dev/null +++ b/bitnami/discourse/templates/deployment-sidekiq.yaml @@ -0,0 +1,72 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "discourse.fullname" . }}-sidekiq + labels: + {{- include "discourse.labels" . | nindent 4 }} + component: sidekiq +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "discourse.selectorLabels" . | nindent 6 }} + component: sidekiq + template: + metadata: + labels: + {{- include "discourse.selectorLabels" . | nindent 8 }} + component: sidekiq + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "discourse.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default "latest" }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + command: ["/app-entrypoint.sh"] + args: + - nami + - start + - --foreground + - discourse-sidekiq + env: + - name: DISCOURSE_HOST + value: {{ include "discourse.fullname" . }} + - name: DISCOURSE_PORT + value: "3000" + envFrom: + - configMapRef: + name: {{ include "discourse.fullname" . }}-envs + - secretRef: + name: {{ include "discourse.fullname" . }}-envs + # {{ .Values.additionalEnvs | toYaml | indent 6 }} + # livenessProbe: + # httpGet: + # path: / + # port: http + readinessProbe: + exec: + command: [nami status discourse-sidekiqa] + initialDelaySeconds: 60 + periodSeconds: 60 + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/bitnami/discourse/templates/deployment.yaml b/bitnami/discourse/templates/deployment.yaml new file mode 100644 index 00000000000000..64108205ca2305 --- /dev/null +++ b/bitnami/discourse/templates/deployment.yaml @@ -0,0 +1,66 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "discourse.fullname" . }} + labels: + {{- include "discourse.labels" . | nindent 4 }} + component: discourse +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + {{- include "discourse.selectorLabels" . | nindent 6 }} + component: discourse + template: + metadata: + annotations: + checksum/config: {{ include (print $.Template.BasePath "/configmap-envs.yaml") . | sha256sum }} + checksum/secret: {{ include (print $.Template.BasePath "/secret-envs.yaml") . | sha256sum }} + labels: + {{- include "discourse.selectorLabels" . | nindent 8 }} + component: discourse + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "discourse.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default "latest" }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + envFrom: + - configMapRef: + name: {{ include "discourse.fullname" . }}-envs + - secretRef: + name: {{ include "discourse.fullname" . }}-envs + ports: + - name: http + containerPort: 3000 + protocol: TCP + # livenessProbe: + # httpGet: + # path: / + # port: http + readinessProbe: + httpGet: + path: / + port: http + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/bitnami/discourse/templates/ingress.yaml b/bitnami/discourse/templates/ingress.yaml new file mode 100644 index 00000000000000..3a01e236cbac79 --- /dev/null +++ b/bitnami/discourse/templates/ingress.yaml @@ -0,0 +1,41 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "discourse.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "discourse.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: +{{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} +{{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ . }} + backend: + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} +{{- end }} diff --git a/bitnami/discourse/templates/secret-envs.yaml b/bitnami/discourse/templates/secret-envs.yaml new file mode 100644 index 00000000000000..223e9ec605b373 --- /dev/null +++ b/bitnami/discourse/templates/secret-envs.yaml @@ -0,0 +1,14 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "discourse.fullname" . }}-envs + labels: + {{- include "discourse.labels" . | nindent 4 }} +data: + DISCOURSE_PASSWORD: "{{ .Values.admin.password | b64enc }}" + DISCOURSE_POSTGRESQL_PASSWORD: "{{ .Values.postgresql.postgresqlPassword | b64enc }}" + POSTGRESQL_ROOT_PASSWORD: "{{ .Values.postgresql.postgresqlPostgresPassword | b64enc }}" + POSTGRESQL_CLIENT_CREATE_DATABASE_PASSWORD: "{{ .Values.postgresql.postgresqlPassword | b64enc }}" + {{- if .Values.redis.usePassword }} + REDIS_PASSWORD: "{{ .Values.redis.password | b64enc }}" + {{- end }} diff --git a/bitnami/discourse/templates/service.yaml b/bitnami/discourse/templates/service.yaml new file mode 100644 index 00000000000000..7376293236d6bb --- /dev/null +++ b/bitnami/discourse/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "discourse.fullname" . }} + labels: + {{- include "discourse.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "discourse.selectorLabels" . | nindent 4 }} diff --git a/bitnami/discourse/templates/serviceaccount.yaml b/bitnami/discourse/templates/serviceaccount.yaml new file mode 100644 index 00000000000000..78f774ec6183a9 --- /dev/null +++ b/bitnami/discourse/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "discourse.serviceAccountName" . }} + labels: + {{- include "discourse.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end -}} diff --git a/bitnami/discourse/templates/tests/test-connection.yaml b/bitnami/discourse/templates/tests/test-connection.yaml new file mode 100644 index 00000000000000..6fcfe7a3843132 --- /dev/null +++ b/bitnami/discourse/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "discourse.fullname" . }}-test-connection" + labels: + {{- include "discourse.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test-success +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "discourse.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/bitnami/discourse/test.yaml b/bitnami/discourse/test.yaml new file mode 100644 index 00000000000000..755987ed2b3ac5 --- /dev/null +++ b/bitnami/discourse/test.yaml @@ -0,0 +1,183 @@ +## This is test deployment for Kubernetes platforms. +## This is not intended to be used in production. +## +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: test-postgresql + name: test-postgresql +spec: + replicas: 1 + selector: + matchLabels: + app: test-postgresql + template: + metadata: + labels: + app: test-postgresql + spec: + containers: + - image: bitnami/postgresql + name: test-postgresql + env: + - name: ALLOW_EMPTY_PASSWORD + value: "yes" +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: test-postgresql + name: test-postgresql +spec: + ports: + - port: 5432 + protocol: TCP + targetPort: 5432 + selector: + app: test-postgresql + sessionAffinity: None + type: ClusterIP +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: test-redis + name: test-redis +spec: + replicas: 1 + selector: + matchLabels: + app: test-redis + template: + metadata: + labels: + app: test-redis + spec: + containers: + - image: bitnami/redis + name: test-redis + env: + - name: ALLOW_EMPTY_PASSWORD + value: "yes" +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: test-redis + name: test-redis +spec: + ports: + - port: 6379 + protocol: TCP + targetPort: 6379 + selector: + app: test-redis + sessionAffinity: None + type: ClusterIP +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + app: test-discourse + name: test-discourse +spec: + replicas: 1 + selector: + matchLabels: + app: test-discourse + template: + metadata: + labels: + app: test-discourse + spec: + containers: + - image: bitnami/discourse + name: test-discourse + env: + - name: POSTGRESQL_HOST + value: test-postgresql + - name: POSTGRESQL_ROOT_USER + value: postgres + - name: POSTGRESQL_CLIENT_CREATE_DATABASE_NAME + value: bitnami_application + - name: POSTGRESQL_CLIENT_CREATE_DATABASE_USERNAME + value: bn_discourse + - name: POSTGRESQL_CLIENT_CREATE_DATABASE_PASSWORD + value: bitnami1 + - name: DISCOURSE_POSTGRESQL_NAME + value: bitnami_application + - name: DISCOURSE_POSTGRESQL_USERNAME + value: bn_discourse + - name: DISCOURSE_POSTGRESQL_PASSWORD + value: bitnami1 + - name: DISCOURSE_HOSTNAME + value: www.example.com + - name: REDIS_HOST + value: test-redis + - name: REDIS_PORT_NUMBER + value: "6379" +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: test-discourse + name: test-discourse +spec: + ports: + - port: 3000 + protocol: TCP + targetPort: 3000 + selector: + app: test-discourse + sessionAffinity: None + type: ClusterIP +--- +apiVersion: v1 +kind: Pod +metadata: + name: test-sidekiq + labels: + app: test-sidekiq +spec: + containers: + - name: sidekiq + image: bitnami/discourse + args: + - nami + - start + - --foreground + - discourse-sidekiq + env: + - name: POSTGRESQL_HOST + value: test-postgresql + - name: POSTGRESQL_ROOT_USER + value: postgres + - name: POSTGRESQL_CLIENT_CREATE_DATABASE_NAME + value: bitnami_application + - name: POSTGRESQL_CLIENT_CREATE_DATABASE_USERNAME + value: bn_discourse + - name: POSTGRESQL_CLIENT_CREATE_DATABASE_PASSWORD + value: bitnami1 + - name: DISCOURSE_POSTGRESQL_NAME + value: bitnami_application + - name: DISCOURSE_POSTGRESQL_USERNAME + value: bn_discourse + - name: DISCOURSE_POSTGRESQL_PASSWORD + value: bitnami1 + - name: DISCOURSE_HOST + value: test-discourse + - name: DISCOURSE_PORT + value: "3000" + - name: DISCOURSE_HOSTNAME + value: www.example.com + - name: REDIS_HOST + value: test-redis + - name: REDIS_PORT_NUMBER + value: "6379" + diff --git a/bitnami/discourse/values.yaml b/bitnami/discourse/values.yaml new file mode 100644 index 00000000000000..988b66d19f9feb --- /dev/null +++ b/bitnami/discourse/values.yaml @@ -0,0 +1,105 @@ +# Default values for discourse. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: bitnami/discourse + tag: latest + pullPolicy: Always + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +hostname: localhost +sitename: community chest +admin: + username: admin + password: this-is-a-bad-admin-password + email: user@example.com + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +service: + type: ClusterIP + port: 3000 + +ingress: + enabled: false + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: [] + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +nodeSelector: {} + +tolerations: [] + +affinity: {} + +postgresql: + enabled: true + postgresqlPostgresPassword: this-is-a-bad-default-root-password + postgresqlUsername: discourse + postgresqlPassword: this-is-a-bad-password + postgresqlDatabase: discourse + persistence: + enabled: false + +redis: + ## use redis helm chart dependency + enabled: true + ## If redis.enabled is false then provide a host name here + host: + usePassword: true + password: this-is-a-bad-password + # TODO: change from master/slave + # Sorry for the master/slave terminology, + # its an upstream chart. Will look for + # ways to change it. + cluster: + enabled: false + master: + persistence: + enabled: false + slave: + persistence: + enabled: false From 07b28bc8400a59ec81376df5331c9700544a758b Mon Sep 17 00:00:00 2001 From: Luca Prete Date: Mon, 30 Mar 2020 10:38:11 +0200 Subject: [PATCH 02/35] Udpate readme following bitnami best-practices --- bitnami/discourse/README.md | 109 +++++++++++++++++++++++++++++------- 1 file changed, 88 insertions(+), 21 deletions(-) diff --git a/bitnami/discourse/README.md b/bitnami/discourse/README.md index 2a872fc855bc5b..57dd097da9433f 100644 --- a/bitnami/discourse/README.md +++ b/bitnami/discourse/README.md @@ -1,44 +1,111 @@ -# Discourse Helm Chart +# Discourse -> **Note**: This is a Helm 3 chart. Not using Helm 3? Time to upgrade. +[Discourse](https://www.discourse.org/) is an open source discussion platform. It can be used as a mailing list, discussion forum, long-form chat room, and more. -[Discourse](https://www.discourse.org/) is an opensource forum software. +## TL;DR; -## Chart Details -This chart will provision a fully functional and fully featured Discourse installation -that can deploy and manage applications in the cluster that it is deployed to. +```console +$ helm repo add bitnami https://charts.bitnami.com/bitnami +$ helm install my-release bitnami/discourse +``` + +## Introduction + +This chart bootstraps a [Discourse](https://www.discourse.org/) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. + +It also packages [Bitnami Postgresql](https://github.com/bitnami/charts/tree/master/bitnami/postgresql) and [Bitnami Redis](https://github.com/bitnami/charts/tree/master/bitnami/redis) which are required as a database for the Discourse application. -Redis and Postgres are used. +Bitnami charts can be used with [Kubeapps](https://kubeapps.com/) for deployment and management of Helm Charts in clusters. This chart has been tested to work with NGINX Ingress, cert-manager, fluentd and Prometheus on top of the [BKPR](https://kubeprod.io/). -For more information on Discourse and its capabilities, see it's [documentation](https://docs.discourse.org/) as well as the [documentation](https://github.com/bitnami/bitnami-docker-discourse#configuration) for the Bitnami Discourse image. +## Prerequisites + +- Kubernetes 1.12+ +- Helm 2.11+ or Helm 3.0-beta3+ +- PV provisioner support in the underlying infrastructure +- ReadWriteMany volumes for deployment scaling ## Installing the Chart To install the chart with the release name `my-release`: -```bash -$ helm install --name my-release . +```console +$ helm install my-release bitnami/discourse ``` -Discourse is pretty insistent on accessing it via port 80 or 443. This is fine if you're hosting it on a public cluster, but if you want to test it locally with a port forward you need to fight it. +The command deploys Discourse on the Kubernetes cluster in the default configuration. The [Parameters](#parameters) section lists the parameters that can be configured during installation. -The easiest [but horribly insecure] way to do it it is to simply allow kubectl to bind to privileged ports and then use a `port-forward`: +> **Tip**: List all releases using `helm list` -```bash -sudo setcap CAP_NET_BIND_SERVICE=+eip $(which kubectl) -kubectl portforward svc/discourse 80:3000 +## Uninstalling the Chart + +To uninstall/delete the `my-release` deployment: + +```console +$ helm delete my-release ``` -## Configuration +The command removes all the Kubernetes components associated with the chart and deletes the release. + +## Parameters + +The following table lists the configurable parameters of the Discourse chart and their default values. + +| Parameter | Description | Default | +| ---------------------------------- | ----------------------------------------------------- | ------------------------------------------------------------ | +**TBD after other patches get merged** -Configurable values are documented in the `values.yaml`. +The above parameters map to the env variables defined in [bitnami/discourse](http://github.com/bitnami/bitnami-docker-discourse). For more information please refer to the [bitnami/discourse](http://github.com/bitnami/bitnami-docker-discourse) image documentation. -Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, -Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example, +```console +$ helm install my-release \ + --set discourseUsername=admin,discoursePassword=password,mariadb.mariadbRootPassword=secretpassword \ + bitnami/discourse +``` + +The above command sets the Discourse administrator account username and password to `admin` and `password` respectively. Additionally, it sets the MariaDB `root` user password to `secretpassword`. -```bash -$ helm install --name my-release -f values.yaml . +Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example, + +```console +$ helm install my-release -f values.yaml bitnami/discourse ``` > **Tip**: You can use the default [values.yaml](values.yaml) + +## Configuration and installation details + +### [Rolling VS Immutable tags](https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/) + +It is strongly recommended to use immutable tags in a production environment. This ensures your deployment does not change automatically if the same tag is updated with a different image. + +Bitnami will release a new chart updating its containers if a new version of the main container, significant changes, or critical vulnerabilities exist. + +### Local development and binding to port 80 + +Discourse is pretty insistent on giving access via port 80 or 443. +This is fine if you're hosting it on a public cluster, but it's not while testing the chart locally. +The easiest [but horribly insecure] way to do it is to simply allow kubectl to bind to privileged ports and then use a `port-forward`: + +```console +sudo setcap CAP_NET_BIND_SERVICE=+eip $(which kubectl) +kubectl portforward svc/discourse 80:3000 +``` + +### Image + +The `image` parameter allows specifying which image will be pulled for the chart. + +#### Private registry + +If you configure the `image` value to one in a private registry, you will need to [specify an image pull secret](https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod). + +1. Manually create image pull secret(s) in the namespace. See [this YAML example reference](https://kubernetes.io/docs/concepts/containers/images/#creating-a-secret-with-a-docker-config). Consult your image registry's documentation about getting the appropriate secret. +2. Note that the `imagePullSecrets` configuration value cannot currently be passed to helm using the `--set` parameter, so you must supply these using a `values.yaml` file, such as: + +```yaml +imagePullSecrets: + - name: SECRET_NAME +``` +3. Install the chart From 5096618527c7a053ab7251a18f113a110382a341 Mon Sep 17 00:00:00 2001 From: Luca Prete Date: Mon, 30 Mar 2020 11:18:31 +0200 Subject: [PATCH 03/35] Remove .gitignore --- bitnami/discourse/.gitignore | 1 - 1 file changed, 1 deletion(-) delete mode 100644 bitnami/discourse/.gitignore diff --git a/bitnami/discourse/.gitignore b/bitnami/discourse/.gitignore deleted file mode 100644 index ee3892e8794a08..00000000000000 --- a/bitnami/discourse/.gitignore +++ /dev/null @@ -1 +0,0 @@ -charts/ From 88cf5992cde34056e07cc00b25f9df3c9e81e977 Mon Sep 17 00:00:00 2001 From: Luca Prete Date: Mon, 6 Apr 2020 15:23:36 +0200 Subject: [PATCH 04/35] Use requirements.yaml to support helm2 --- bitnami/discourse/Chart.yaml | 10 ---------- bitnami/discourse/{Chart.lock => requirements.lock} | 0 bitnami/discourse/requirements.yaml | 9 +++++++++ 3 files changed, 9 insertions(+), 10 deletions(-) rename bitnami/discourse/{Chart.lock => requirements.lock} (100%) create mode 100644 bitnami/discourse/requirements.yaml diff --git a/bitnami/discourse/Chart.yaml b/bitnami/discourse/Chart.yaml index 6d20ea0cf6abd8..c473a9ea6299b4 100644 --- a/bitnami/discourse/Chart.yaml +++ b/bitnami/discourse/Chart.yaml @@ -10,13 +10,3 @@ sources: maintainers: - name: paulczar email: username.taken@gmail.com - -dependencies: - - name: postgresql - repository: https://charts.bitnami.com/bitnami - version: 8.6.4 - condition: postgresql.enabled - - name: redis - repository: https://charts.bitnami.com/bitnami - version: 10.5.11 - condition: redis.enabled diff --git a/bitnami/discourse/Chart.lock b/bitnami/discourse/requirements.lock similarity index 100% rename from bitnami/discourse/Chart.lock rename to bitnami/discourse/requirements.lock diff --git a/bitnami/discourse/requirements.yaml b/bitnami/discourse/requirements.yaml new file mode 100644 index 00000000000000..fc9af04d5c308d --- /dev/null +++ b/bitnami/discourse/requirements.yaml @@ -0,0 +1,9 @@ +dependencies: +- name: postgresql + repository: https://charts.bitnami.com/bitnami + version: 8.6.4 + condition: postgresql.enabled +- name: redis + repository: https://charts.bitnami.com/bitnami + version: 10.5.11 + condition: redis.enabled \ No newline at end of file From affa7a5bca16f389e7d3b1c3c2bdf5537f2190bd Mon Sep 17 00:00:00 2001 From: Paul Czarkowski Date: Mon, 6 Apr 2020 09:36:58 -0500 Subject: [PATCH 05/35] Update LICENSE Signed-off-by: Paul Czarkowski --- LICENSE | 1 + 1 file changed, 1 insertion(+) diff --git a/LICENSE b/LICENSE index 7dbac3a04f20a8..599c7e1cac2659 100644 --- a/LICENSE +++ b/LICENSE @@ -1,3 +1,4 @@ +Copyright (c) 2020 Paul Czarkowski Copyright (c) 2019 Bitnami Licensed under the Apache License, Version 2.0 (the "License"); From 566dbdc4c13b7e2e0908c8f07f24b1ca2940db0f Mon Sep 17 00:00:00 2001 From: Paul Czarkowski Date: Fri, 1 May 2020 10:38:19 -0500 Subject: [PATCH 06/35] Update bitnami/discourse/Chart.yaml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Javier J. Salmerón-García --- bitnami/discourse/Chart.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bitnami/discourse/Chart.yaml b/bitnami/discourse/Chart.yaml index c473a9ea6299b4..257b8398618002 100644 --- a/bitnami/discourse/Chart.yaml +++ b/bitnami/discourse/Chart.yaml @@ -6,7 +6,8 @@ version: 0.1.0 appVersion: 2.4.1 home: https://www.discourse.org/ sources: -- https://github.com/spinnaker + - https://github.com/bitnami/bitnami-docker-discourse + - https://github.com/spinnaker maintainers: - name: paulczar email: username.taken@gmail.com From b45ce01b902780e18e1a127ee97cd5df0a053e6f Mon Sep 17 00:00:00 2001 From: Paul Czarkowski Date: Fri, 1 May 2020 10:38:36 -0500 Subject: [PATCH 07/35] Update bitnami/discourse/Chart.yaml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Javier J. Salmerón-García --- bitnami/discourse/Chart.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/bitnami/discourse/Chart.yaml b/bitnami/discourse/Chart.yaml index 257b8398618002..def5fb0b07e2b2 100644 --- a/bitnami/discourse/Chart.yaml +++ b/bitnami/discourse/Chart.yaml @@ -5,6 +5,7 @@ type: application version: 0.1.0 appVersion: 2.4.1 home: https://www.discourse.org/ +icon: https://bitnami.com/assets/stacks/wordpress/img/discourse-stack-220x234.png sources: - https://github.com/bitnami/bitnami-docker-discourse - https://github.com/spinnaker From b8526ada74f0cec8bfe116b1b583ccca44801eed Mon Sep 17 00:00:00 2001 From: Paul Czarkowski Date: Fri, 1 May 2020 10:38:45 -0500 Subject: [PATCH 08/35] Update bitnami/discourse/Chart.yaml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Javier J. Salmerón-García --- bitnami/discourse/Chart.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bitnami/discourse/Chart.yaml b/bitnami/discourse/Chart.yaml index def5fb0b07e2b2..cf99342cd14f37 100644 --- a/bitnami/discourse/Chart.yaml +++ b/bitnami/discourse/Chart.yaml @@ -10,5 +10,7 @@ sources: - https://github.com/bitnami/bitnami-docker-discourse - https://github.com/spinnaker maintainers: -- name: paulczar + - name: Bitnami + email: containers@bitnami.com + - name: paulczar email: username.taken@gmail.com From 7a02b728ed260740fd25cdb827337977b717b37b Mon Sep 17 00:00:00 2001 From: Paul Czarkowski Date: Fri, 1 May 2020 10:38:56 -0500 Subject: [PATCH 09/35] Update bitnami/discourse/Chart.yaml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Javier J. Salmerón-García --- bitnami/discourse/Chart.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/bitnami/discourse/Chart.yaml b/bitnami/discourse/Chart.yaml index cf99342cd14f37..4a0af2f5f2b2eb 100644 --- a/bitnami/discourse/Chart.yaml +++ b/bitnami/discourse/Chart.yaml @@ -4,6 +4,7 @@ description: A Helm chart for deploying Discourse to Kubernetes type: application version: 0.1.0 appVersion: 2.4.1 +engine: gotpl home: https://www.discourse.org/ icon: https://bitnami.com/assets/stacks/wordpress/img/discourse-stack-220x234.png sources: From 8e69d2ea3d5529de1b7b041a65ebab78ab0d7df8 Mon Sep 17 00:00:00 2001 From: Paul Czarkowski Date: Fri, 1 May 2020 10:39:15 -0500 Subject: [PATCH 10/35] Update bitnami/discourse/values.yaml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Javier J. Salmerón-García --- bitnami/discourse/values.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bitnami/discourse/values.yaml b/bitnami/discourse/values.yaml index 988b66d19f9feb..91e3343c0d76fd 100644 --- a/bitnami/discourse/values.yaml +++ b/bitnami/discourse/values.yaml @@ -1,3 +1,13 @@ +## Global Docker image parameters +## Please, note that this will override the image parameters, including dependencies, configured to use the global value +## Current available global Docker image parameters: imageRegistry and imagePullSecrets +## +# global: +# imageRegistry: myRegistryName +# imagePullSecrets: +# - myRegistryKeySecretName +# storageClass: myStorageClass + # Default values for discourse. # This is a YAML-formatted file. # Declare variables to be passed into your templates. From eff7d00379be3d7256b3c54c732faf39f5cd4af1 Mon Sep 17 00:00:00 2001 From: Paul Czarkowski Date: Fri, 1 May 2020 10:39:40 -0500 Subject: [PATCH 11/35] Update bitnami/discourse/templates/deployment-sidekiq.yaml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Javier J. Salmerón-García --- bitnami/discourse/templates/deployment-sidekiq.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitnami/discourse/templates/deployment-sidekiq.yaml b/bitnami/discourse/templates/deployment-sidekiq.yaml index 498e4c9ff6dbd6..3b0b24e8dc22cc 100644 --- a/bitnami/discourse/templates/deployment-sidekiq.yaml +++ b/bitnami/discourse/templates/deployment-sidekiq.yaml @@ -4,7 +4,7 @@ metadata: name: {{ include "discourse.fullname" . }}-sidekiq labels: {{- include "discourse.labels" . | nindent 4 }} - component: sidekiq + app.kubernetes.io/component: sidekiq spec: replicas: {{ .Values.replicaCount }} selector: From 41add92d81c568c85b967041f48eca11947da1ac Mon Sep 17 00:00:00 2001 From: Luca Prete Date: Sun, 3 May 2020 17:21:02 +0200 Subject: [PATCH 12/35] Work on latest bitnami change requests Signed-off-by: Luca Prete --- bitnami/discourse/templates/_helpers.tpl | 78 ++++- .../{configmap-envs.yaml => configmaps.yaml} | 7 +- .../templates/deployment-sidekiq.yaml | 58 +++- bitnami/discourse/templates/deployment.yaml | 87 ++++-- bitnami/discourse/templates/ingress.yaml | 3 +- bitnami/discourse/templates/secret-envs.yaml | 14 - bitnami/discourse/templates/secrets.yaml | 36 +++ bitnami/discourse/templates/service.yaml | 28 +- .../discourse/templates/serviceaccount.yaml | 3 +- .../templates/tests/test-connection.yaml | 3 +- bitnami/discourse/values.yaml | 275 ++++++++++++++---- bitnami/wordpress/templates/deployment.yaml | 2 +- bitnami/wordpress/values.yaml | 20 +- 13 files changed, 468 insertions(+), 146 deletions(-) rename bitnami/discourse/templates/{configmap-envs.yaml => configmaps.yaml} (83%) delete mode 100644 bitnami/discourse/templates/secret-envs.yaml create mode 100644 bitnami/discourse/templates/secrets.yaml diff --git a/bitnami/discourse/templates/_helpers.tpl b/bitnami/discourse/templates/_helpers.tpl index 7bedcda8e73dcc..e8f47e534156bf 100644 --- a/bitnami/discourse/templates/_helpers.tpl +++ b/bitnami/discourse/templates/_helpers.tpl @@ -36,7 +36,7 @@ Common labels */}} {{- define "discourse.labels" -}} helm.sh/chart: {{ include "discourse.chart" . }} -{{ include "discourse.selectorLabels" . }} +{{ include "discourse.matchLabels" . }} {{- if .Chart.AppVersion }} app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} {{- end }} @@ -46,7 +46,7 @@ app.kubernetes.io/managed-by: {{ .Release.Service }} {{/* Selector labels */}} -{{- define "discourse.selectorLabels" -}} +{{- define "discourse.matchLabels" -}} app.kubernetes.io/name: {{ include "discourse.name" . }} app.kubernetes.io/instance: {{ .Release.Name }} {{- end -}} @@ -61,3 +61,77 @@ Create the name of the service account to use {{ default "default" .Values.serviceAccount.name }} {{- end -}} {{- end -}} + +{{/* +Renders a value that contains template. +Usage: +{{ include "discourse.tplValue" ( dict "value" .Values.path.to.the.Value "context" $) }} +*/}} +{{- define "discourse.tplValue" -}} + {{- if typeIs "string" .value }} + {{- tpl .value .context }} + {{- else }} + {{- tpl (.value | toYaml) .context }} + {{- end }} +{{- end -}} + +{{/* +Return the proper Docker Image Registry Secret Names +*/}} +{{- define "discourse.imagePullSecrets" -}} +{{/* +Helm 2.11 supports the assignment of a value to a variable defined in a different scope, +but Helm 2.9 and 2.10 does not support it, so we need to implement this if-else logic. +Also, we can not use a single if because lazy evaluation is not an option +*/}} +{{- if .Values.global }} +{{- if .Values.global.imagePullSecrets }} +imagePullSecrets: +{{- range .Values.global.imagePullSecrets }} + - name: {{ . }} +{{- end }} +{{- else if .Values.image.pullSecrets }} +imagePullSecrets: +{{- range .Values.image.pullSecrets }} + - name: {{ . }} +{{- end }} +{{- end -}} +{{- else if .Values.image.pullSecrets }} +imagePullSecrets: +{{- range .Values.image.pullSecrets }} + - name: {{ . }} +{{- end }} +{{- end -}} +{{- end -}} + +{{/* +Gets the host to be used for this application. +If not using ClusterIP, or if a host or LoadBalancerIP is not defined, the value will be empty. +*/}} +{{- define "discourse.host" -}} +{{- $host := index .Values (printf "%sHost" .Chart.Name) | default "" -}} +{{- default (include "discourse.serviceIP" .) $host -}} +{{- end -}} + +{{/* +Return the proper Discourse image name +*/}} +{{- define "discourse.image" -}} +{{- $registryName := .Values.image.registry -}} +{{- $repositoryName := .Values.image.repository -}} +{{- $tag := .Values.image.tag | toString -}} +{{/* +Helm 2.11 supports the assignment of a value to a variable defined in a different scope, +but Helm 2.9 and 2.10 doesn't support it, so we need to implement this if-else logic. +Also, we can't use a single if because lazy evaluation is not an option +*/}} +{{- if .Values.global }} + {{- if .Values.global.imageRegistry }} + {{- printf "%s/%s:%s" .Values.global.imageRegistry $repositoryName $tag -}} + {{- else -}} + {{- printf "%s/%s:%s" $registryName $repositoryName $tag -}} + {{- end -}} +{{- else -}} + {{- printf "%s/%s:%s" $registryName $repositoryName $tag -}} +{{- end -}} +{{- end -}} diff --git a/bitnami/discourse/templates/configmap-envs.yaml b/bitnami/discourse/templates/configmaps.yaml similarity index 83% rename from bitnami/discourse/templates/configmap-envs.yaml rename to bitnami/discourse/templates/configmaps.yaml index 1112e8387aff9e..f055d3476cc203 100644 --- a/bitnami/discourse/templates/configmap-envs.yaml +++ b/bitnami/discourse/templates/configmaps.yaml @@ -1,11 +1,10 @@ apiVersion: v1 kind: ConfigMap metadata: - name: {{ include "discourse.fullname" . }}-envs - labels: - {{- include "discourse.labels" . | nindent 4 }} + name: {{ template "discourse.fullname" . }} + labels: {{- include "discourse.labels" . | nindent 4 }} data: - DISCOURSE_HOSTNAME: {{ .Values.hostname }} + DISCOURSE_HOSTNAME: {{ .Values.discourseHost }} DISCOURSE_USERNAME: {{ .Values.admin.username }} DISCOURSE_EMAIL: {{ .Values.admin.email }} DISCOURSE_SITENAME: {{ .Values.sitename }} diff --git a/bitnami/discourse/templates/deployment-sidekiq.yaml b/bitnami/discourse/templates/deployment-sidekiq.yaml index 3b0b24e8dc22cc..41de109b312826 100644 --- a/bitnami/discourse/templates/deployment-sidekiq.yaml +++ b/bitnami/discourse/templates/deployment-sidekiq.yaml @@ -1,3 +1,4 @@ +{{- if and (include "discourse.host" .) (.Values.postgresql.enabled) -}} apiVersion: apps/v1 kind: Deployment metadata: @@ -6,7 +7,7 @@ metadata: {{- include "discourse.labels" . | nindent 4 }} app.kubernetes.io/component: sidekiq spec: - replicas: {{ .Values.replicaCount }} + replicas: {{ .Values.replicaCount.sidekiq }} selector: matchLabels: {{- include "discourse.selectorLabels" . | nindent 6 }} @@ -17,19 +18,16 @@ spec: {{- include "discourse.selectorLabels" . | nindent 8 }} component: sidekiq spec: - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} + {{- include "discourse.imagePullSecrets" . | nindent 6 }} serviceAccountName: {{ include "discourse.serviceAccountName" . }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: - - name: {{ .Chart.Name }} + - name: sidekiq securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default "latest" }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- toYaml .Values.containerSecurityContext | nindent 12 }} + image: {{ template "discourse.image" . }} + imagePullPolicy: {{ .Values.image.pullPolicy | quote }} command: ["/app-entrypoint.sh"] args: - nami @@ -41,12 +39,42 @@ spec: value: {{ include "discourse.fullname" . }} - name: DISCOURSE_PORT value: "3000" - envFrom: + - name: DISCOURSE_PASSWORD + valueFrom: + secretKeyRef: + name: {{ include "discourse.fullname" . }} + key: discourse-password + - name: DISCOURSE_POSTGRESQL_PASSWORD + valueFrom: + secretKeyRef: + name: {{ include "discourse.fullname" . }} + key: discourse-postgresql-password + - name: POSTGRESQL_CLIENT_CREATE_DATABASE_PASSWORD + valueFrom: + secretKeyRef: + name: {{ include "discourse.fullname" . }} + key: postgresql-client-create-database-password + - name: REDIS_PASSWORD + valueFrom: + secretKeyRef: + name: {{ include "discourse.fullname" . }} + key: redis-password + - configMapRef: + name: {{ include "discourse.fullname" . }} + {{- if .Values.extraEnvVars.discourse }} + {{- tpl (toYaml .Values.extraEnvVars.discourse) $ | nindent 12 }} + {{- end }} + {{- if or .Values.extraEnvVarsCM.discourse .Values.extraEnvVarsSecret.discourse }} + envFrom: + {{- if .Values.extraEnvVarsCM.discourse }} - configMapRef: - name: {{ include "discourse.fullname" . }}-envs + name: {{ .Values.extraEnvVarsCM.discourse }} + {{- end }} + {{- if .Values.extraEnvVarsSecret.discourse }} - secretRef: - name: {{ include "discourse.fullname" . }}-envs - # {{ .Values.additionalEnvs | toYaml | indent 6 }} + name: {{ .Values.extraEnvVarsSecret.discourse }} + {{- end }} + {{- end }} # livenessProbe: # httpGet: # path: / @@ -56,8 +84,7 @@ spec: command: [nami status discourse-sidekiqa] initialDelaySeconds: 60 periodSeconds: 60 - resources: - {{- toYaml .Values.resources | nindent 12 }} + resources: {{- toYaml .Values.resources | nindent 12 }} {{- with .Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} @@ -70,3 +97,4 @@ spec: tolerations: {{- toYaml . | nindent 8 }} {{- end }} +{{- end -}} diff --git a/bitnami/discourse/templates/deployment.yaml b/bitnami/discourse/templates/deployment.yaml index 64108205ca2305..bc5b793af69fc9 100644 --- a/bitnami/discourse/templates/deployment.yaml +++ b/bitnami/discourse/templates/deployment.yaml @@ -1,12 +1,13 @@ +{{- if and (include "discourse.host" .) (.Values.postgresql.enabled) -}} apiVersion: apps/v1 kind: Deployment metadata: - name: {{ include "discourse.fullname" . }} + name: {{ template "discourse.fullname" . }} labels: {{- include "discourse.labels" . | nindent 4 }} component: discourse spec: - replicas: {{ .Values.replicaCount }} + replicas: {{ .Values.replicaCount.discourse }} selector: matchLabels: {{- include "discourse.selectorLabels" . | nindent 6 }} @@ -20,24 +21,57 @@ spec: {{- include "discourse.selectorLabels" . | nindent 8 }} component: discourse spec: - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} + {{- include "discourse.imagePullSecrets" . | nindent 6 }} serviceAccountName: {{ include "discourse.serviceAccountName" . }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- if .Values.initContainers }} + initContainers: + {{- tpl (toYaml .Values.initContainers) $ | nindent 8 }} + {{- end }} containers: - - name: {{ .Chart.Name }} + - name: discourse securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} - image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default "latest" }}" - imagePullPolicy: {{ .Values.image.pullPolicy }} - envFrom: + {{- toYaml .Values.containerSecurityContext | nindent 12 }} + image: {{ template "discourse.image" . }} + imagePullPolicy: {{ .Values.image.pullPolicy | quote }} + env: + - name: DISCOURSE_PASSWORD + valueFrom: + secretKeyRef: + name: {{ include "discourse.fullname" . }} + key: discourse-password + - name: DISCOURSE_POSTGRESQL_PASSWORD + valueFrom: + secretKeyRef: + name: {{ include "discourse.fullname" . }} + key: discourse-postgresql-password + - name: POSTGRESQL_CLIENT_CREATE_DATABASE_PASSWORD + valueFrom: + secretKeyRef: + name: {{ include "discourse.fullname" . }} + key: postgresql-client-create-database-password + - name: REDIS_PASSWORD + valueFrom: + secretKeyRef: + name: {{ include "discourse.fullname" . }} + key: redis-password + - configMapRef: + name: {{ include "discourse.fullname" . }} + {{- if .Values.extraEnvVars.discourse }} + {{- tpl (toYaml .Values.extraEnvVars.discourse) $ | nindent 12 }} + {{- end }} + {{- if or .Values.extraEnvVarsCM.discourse .Values.extraEnvVarsSecret.discourse }} + envFrom: + {{- if .Values.extraEnvVarsCM.discourse }} - configMapRef: - name: {{ include "discourse.fullname" . }}-envs + name: {{ .Values.extraEnvVarsCM.discourse }} + {{- end }} + {{- if .Values.extraEnvVarsSecret.discourse }} - secretRef: - name: {{ include "discourse.fullname" . }}-envs + name: {{ .Values.extraEnvVarsSecret.discourse }} + {{- end }} + {{- end }} ports: - name: http containerPort: 3000 @@ -50,17 +84,18 @@ spec: httpGet: path: / port: http - resources: - {{- toYaml .Values.resources | nindent 12 }} - {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} + resources: {{- toYaml .Values.resources | nindent 12 }} + {{- if .Values.sidecars }} + {{- tpl (toYaml .Values.sidecars) $ | nindent 8 }} + {{- end }} + {{- if .Values.affinity }} + affinity: {{- include "discourse.tplValue" (dict "value" .Values.affinity "context" $) | nindent 8 }} {{- end }} - {{- with .Values.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} + {{- if .Values.nodeSelector }} + nodeSelector: {{- include "discourse.tplValue" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: {{- include "discourse.tplValue" (dict "value" .Values.tolerations "context" $) | nindent 8 }} + {{- end }} + {{- with .Values.nodeSelector }} +{{- end -}} diff --git a/bitnami/discourse/templates/ingress.yaml b/bitnami/discourse/templates/ingress.yaml index 3a01e236cbac79..cbec3f294febd5 100644 --- a/bitnami/discourse/templates/ingress.yaml +++ b/bitnami/discourse/templates/ingress.yaml @@ -9,8 +9,7 @@ apiVersion: extensions/v1beta1 kind: Ingress metadata: name: {{ $fullName }} - labels: - {{- include "discourse.labels" . | nindent 4 }} + labels: {{- include "discourse.labels" . | nindent 4 }} {{- with .Values.ingress.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/bitnami/discourse/templates/secret-envs.yaml b/bitnami/discourse/templates/secret-envs.yaml deleted file mode 100644 index 223e9ec605b373..00000000000000 --- a/bitnami/discourse/templates/secret-envs.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: v1 -kind: Secret -metadata: - name: {{ include "discourse.fullname" . }}-envs - labels: - {{- include "discourse.labels" . | nindent 4 }} -data: - DISCOURSE_PASSWORD: "{{ .Values.admin.password | b64enc }}" - DISCOURSE_POSTGRESQL_PASSWORD: "{{ .Values.postgresql.postgresqlPassword | b64enc }}" - POSTGRESQL_ROOT_PASSWORD: "{{ .Values.postgresql.postgresqlPostgresPassword | b64enc }}" - POSTGRESQL_CLIENT_CREATE_DATABASE_PASSWORD: "{{ .Values.postgresql.postgresqlPassword | b64enc }}" - {{- if .Values.redis.usePassword }} - REDIS_PASSWORD: "{{ .Values.redis.password | b64enc }}" - {{- end }} diff --git a/bitnami/discourse/templates/secrets.yaml b/bitnami/discourse/templates/secrets.yaml new file mode 100644 index 00000000000000..13b60bd866d6b7 --- /dev/null +++ b/bitnami/discourse/templates/secrets.yaml @@ -0,0 +1,36 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ template "discourse.fullname" . }} + labels: {{- include "discourse.labels" . | nindent 4 }} +type: Opaque +data: + {{- if .Values.discoursePassword }} + discourse-password: {{ .Values.discoursePassword | b64enc | quote }} + {{- else }} + discourse-password: {{ randAlphaNum 10 | b64enc | quote }} + {{- end }} + + {{- if .Values.postgresql.postgresqlPassword }} + discourse-postgresql-password: {{ .Values.postgresql.postgresqlPassword | b64enc | quote }} + {{- else }} + discourse-postgresql-password: {{ randAlphaNum 10 | b64enc | quote }} + {{- end }} + + {{- if .Values.postgresql.postgresqlPostgresPassword }} + postgresql-root-password: {{ .Values.postgresql.postgresqlPostgresPassword | b64enc | quote }} + {{- else }} + postgresql-root-password: {{ randAlphaNum 10 | b64enc | quote }} + {{- end }} + + {{- if .Values.postgresql.postgresqlPassword }} + postgresql-client-create-database-password: {{ .Values.postgresql.postgresqlPassword | b64enc | quote }} + {{- else }} + postgresql-client-create-database-password: {{ randAlphaNum 10 | b64enc | quote }} + {{- end }} + + {{- if .Values.redis.password }} + redis-password: {{ .Values.redis.password | b64enc | quote }} + {{- else }} + redis-password: {{ randAlphaNum 10 | b64enc | quote }} + {{- end }} diff --git a/bitnami/discourse/templates/service.yaml b/bitnami/discourse/templates/service.yaml index 7376293236d6bb..7a91590781ad1f 100644 --- a/bitnami/discourse/templates/service.yaml +++ b/bitnami/discourse/templates/service.yaml @@ -2,14 +2,28 @@ apiVersion: v1 kind: Service metadata: name: {{ include "discourse.fullname" . }} - labels: - {{- include "discourse.labels" . | nindent 4 }} + labels: {{- include "discourse.labels" . | nindent 4 }} spec: type: {{ .Values.service.type }} + {{- if (or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort")) }} + externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | quote }} + {{- end }} + {{- if (and (eq .Values.service.type "LoadBalancer") .Values.service.loadBalancerSourceRanges) }} + loadBalancerSourceRanges: + {{- with .Values.service.loadBalancerSourceRanges }} +{{ toYaml . | indent 4 }} + {{- end }} + {{- end }} ports: - - port: {{ .Values.service.port }} + - name: http + port: {{ .Values.service.port }} targetPort: http - protocol: TCP - name: http - selector: - {{- include "discourse.selectorLabels" . | nindent 4 }} + {{- if (and (or (eq .Values.service.type "NodePort") (eq .Values.service.type "LoadBalancer")) (not (empty .Values.service.nodePorts.http))) }} + nodePort: {{ .Values.service.nodePorts.http }} + {{- else if eq .Values.service.type "ClusterIP" }} + nodePort: null + {{- end }} + {{- if .Values.service.extraPorts }} + {{- include "discourse.tplValue" (dict "value" .Values.service.extraPorts "context" $) | nindent 4 }} + {{- end }} + selector: {{- include "discourse.matchLabels" . | nindent 4 }} diff --git a/bitnami/discourse/templates/serviceaccount.yaml b/bitnami/discourse/templates/serviceaccount.yaml index 78f774ec6183a9..5966260e920620 100644 --- a/bitnami/discourse/templates/serviceaccount.yaml +++ b/bitnami/discourse/templates/serviceaccount.yaml @@ -3,8 +3,7 @@ apiVersion: v1 kind: ServiceAccount metadata: name: {{ include "discourse.serviceAccountName" . }} - labels: - {{- include "discourse.labels" . | nindent 4 }} + labels: {{- include "discourse.labels" . | nindent 4 }} {{- with .Values.serviceAccount.annotations }} annotations: {{- toYaml . | nindent 4 }} diff --git a/bitnami/discourse/templates/tests/test-connection.yaml b/bitnami/discourse/templates/tests/test-connection.yaml index 6fcfe7a3843132..8181247646fd7e 100644 --- a/bitnami/discourse/templates/tests/test-connection.yaml +++ b/bitnami/discourse/templates/tests/test-connection.yaml @@ -2,8 +2,7 @@ apiVersion: v1 kind: Pod metadata: name: "{{ include "discourse.fullname" . }}-test-connection" - labels: - {{- include "discourse.labels" . | nindent 4 }} + labels: {{- include "discourse.labels" . | nindent 4 }} annotations: "helm.sh/hook": test-success spec: diff --git a/bitnami/discourse/values.yaml b/bitnami/discourse/values.yaml index 91e3343c0d76fd..262337a59b43f9 100644 --- a/bitnami/discourse/values.yaml +++ b/bitnami/discourse/values.yaml @@ -8,103 +8,264 @@ # - myRegistryKeySecretName # storageClass: myStorageClass -# Default values for discourse. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. - -replicaCount: 1 +## Number of Discourse replicas +## (Note that you will need ReadWriteMany PVCs for this to work properly) +## +replicaCount: + discourse: 1 + sidekiq: 1 +## Bitnami Discourse image version +## ref: https://hub.docker.com/r/bitnami/discourse/tags/ +## image: repository: bitnami/discourse tag: latest pullPolicy: Always imagePullSecrets: [] + +## String to partially override discourse.fullname template (will maintain the release name) +## nameOverride: "" + +## String to fully override discourse.fullname template +## fullnameOverride: "" -hostname: localhost -sitename: community chest -admin: - username: admin - password: this-is-a-bad-admin-password - email: user@example.com +## Discourse host to create application URLs +## ref: https://github.com/bitnami/bitnami-docker-discourse#configuration +## +# discourseHost: + +## Discourse site name +## ref: https://github.com/bitnami/bitnami-docker-discourse#environment-variables +## +discourseSitename: "My Site!" + +## User of the application +## ref: https://github.com/bitnami/bitnami-docker-discourse#environment-variables +## +discourseUsername: user + +## Application password +## Defaults to a random 10-character alphanumeric string if not set +## ref: https://github.com/bitnami/bitnami-docker-discourse#environment-variables +## +# discoursePassword: + +## Admin email +## ref: https://github.com/bitnami/bitnami-docker-discourse#environment-variables +## +discourseEmail: user@example.com + +## Add sidecars to the pod. +## Example: +## sidecars: +## - name: your-image-name +## image: your-image +## imagePullPolicy: Always +## ports: +## - name: portname +## containerPort: 1234 +## +sidecars: [] +## Add init containers to the pod +## +## e.g. +## initContainers: +## - name: your-image-name +## image: your-image +## imagePullPolicy: Always +## ports: +## - name: portname +## containerPort: 1234 +initContainers: [] serviceAccount: - # Specifies whether a service account should be created - create: true - # Annotations to add to the service account + ## Specifies whether a service account should be created + create: false + ## Annotations to add to the service account annotations: {} - # The name of the service account to use. - # If not set and create is true, a name is generated using the fullname template + ## The name of the service account to use. + ## If not set and create is true, a name is generated using the fullname template name: podSecurityContext: {} - # fsGroup: 2000 + ## fsGroup: 2000 -securityContext: {} - # capabilities: - # drop: - # - ALL - # readOnlyRootFilesystem: true - # runAsNonRoot: true - # runAsUser: 1000 +containerSecurityContext: {} + ## capabilities: + ## drop: + ## - ALL + ## readOnlyRootFilesystem: true + ## runAsNonRoot: true + ## runAsUser: 1000 +## Kubernetes configuration +## For minikube, set this to NodePort, elsewhere use LoadBalancer or ClusterIP +## service: - type: ClusterIP - port: 3000 + type: LoadBalancer + ## HTTP Port + ## + port: 80 + ## Node Ports to expose + # nodePort: + ## Enable client source IP preservation + ## ref http://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip + ## + externalTrafficPolicy: Cluster + annotations: {} + ## Limits which cidr blocks can connect to service's load balancer + ## Only valid if service.type: LoadBalancer + loadBalancerSourceRanges: [] + ## Extra ports to expose (normally used with the `sidecar` value) + # extraPorts: +## Ingress paramaters +## ingress: + ## Set to true to enable ingress record generation + ## enabled: false + ## Set this to true in order to add the corresponding annotations for cert-manager + ## + certManager: false + ## When the ingress is enabled, a host pointing to this will be created + ## + hostname: discourse.local + ## Ingress annotations done as key:value pairs + ## For a full list of possible ingress annotations, please see + ## ref: https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/nginx-configuration/annotations.md + ## + ## If certManager is set to true, annotation kubernetes.io/tls-acme: "true" will automatically be set + ## annotations: {} - # kubernetes.io/ingress.class: nginx - # kubernetes.io/tls-acme: "true" - hosts: - - host: chart-example.local - paths: [] - tls: [] - # - secretName: chart-example-tls - # hosts: - # - chart-example.local + ## The list of additional hostnames to be covered with this ingress record. + ## Most likely the hostname above will be enough, but in the event more hosts are needed, this is an array + ## extraHosts: + ## - name: discourse.local + ## path: / + ## The tls configuration for additional hostnames to be covered with this ingress record. + ## see: https://kubernetes.io/docs/concepts/services-networking/ingress/#tls + ## extraTls: + ## - hosts: + ## - discourse.local + ## secretName: discourse.local-tls + ## If you're providing your own certificates, please use this to add the certificates as secrets + ## key and certificate should start with -----BEGIN CERTIFICATE----- or + ## -----BEGIN RSA PRIVATE KEY----- + ## + ## name should line up with a tlsSecret set further up + ## If you're using cert-manager, this is unneeded, as it will create the secret for you if it is not set + ## + ## It is also possible to create and manage the certificates outside of this helm chart + ## Please see README.md for more information + ## + secrets: [] + ## - name: discourse.local-tls + ## key: + ## certificate: +## Discourse containers' resource requests and limits +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## resources: {} - # We usually recommend not to specify default resources and to leave this as a conscious - # choice for the user. This also increases chances charts run on environments with little - # resources, such as Minikube. If you do want to specify resources, uncomment the following - # lines, adjust them as necessary, and remove the curly braces after 'resources:'. - # limits: - # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + ## limits: + ## cpu: 100m + ## memory: 128Mi + ## requests: + ## cpu: 100m + ## memory: 128Mi +## Node labels for pod assignment. Evaluated as a template. +## ref: https://kubernetes.io/docs/user-guide/node-selection/ +## nodeSelector: {} +## Tolerations for pod assignment. Evaluated as a template. +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## tolerations: [] +## Affinity for pod assignment +## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity +## affinity: {} +## Discourse pod extra options for liveness and readiness probes +## ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes +livenessProbe: + enabled: true + initialDelaySeconds: 120 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 +readinessProbe: + enabled: true + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 + +## An array to add extra env vars +## For example: +## extraEnvVars: +## discourse: +## - name: DISCOURSE_ELASTICSEARCH_URL +## value: test +## sidekiq: [] +## +extraEnvVars: + discourse: [] + sidekiq: [] + +## Array to add extra configmaps: +## +extraEnvVarsCM: + discourse: [] + sidekiq: [] + +## Array to add extra environment +## variables from a secret: +## +extraEnvVarsSecret: + discourse: "" + sidekiq: "" + +## +## PostgreSQL chart configuration +## +## https://github.com/bitnami/charts/blob/master/bitnami/postgresql/values.yaml +## postgresql: enabled: true - postgresqlPostgresPassword: this-is-a-bad-default-root-password - postgresqlUsername: discourse - postgresqlPassword: this-is-a-bad-password - postgresqlDatabase: discourse + postgresqlUsername: bn_discourse + postgresqlPostgresPassword: + postgresqlPassword: + postgresqlDatabase: bitnami_discourse persistence: enabled: false +## Redis chart configuration +## +## https://github.com/bitnami/charts/blob/master/bitnami/redis/values.yaml +## redis: ## use redis helm chart dependency enabled: true - ## If redis.enabled is false then provide a host name here - host: - usePassword: true - password: this-is-a-bad-password - # TODO: change from master/slave - # Sorry for the master/slave terminology, - # its an upstream chart. Will look for - # ways to change it. + password: + ## TODO: change from master/slave + ## Sorry for the master/slave terminology, + ## its an upstream chart. Will look for + ## ways to change it. cluster: enabled: false master: diff --git a/bitnami/wordpress/templates/deployment.yaml b/bitnami/wordpress/templates/deployment.yaml index bec87a53089e78..7ae23fec013b17 100644 --- a/bitnami/wordpress/templates/deployment.yaml +++ b/bitnami/wordpress/templates/deployment.yaml @@ -23,7 +23,7 @@ spec: {{- end }} {{- end }} spec: -{{- include "wordpress.imagePullSecrets" . | indent 6 }} + {{- include "wordpress.imagePullSecrets" . | nindent 6 }} {{- if .Values.schedulerName }} schedulerName: {{ .Values.schedulerName | quote }} {{- end }} diff --git a/bitnami/wordpress/values.yaml b/bitnami/wordpress/values.yaml index 09d7e7f9a639bc..c65bef6426fb25 100644 --- a/bitnami/wordpress/values.yaml +++ b/bitnami/wordpress/values.yaml @@ -262,23 +262,18 @@ service: ## Extra ports to expose (normally used with the `sidecar` value) # extraPorts: -## Configure the ingress resource that allows you to access the -## WordPress installation. Set up the URL -## ref: http://kubernetes.io/docs/user-guide/ingress/ +## Ingress paramaters ## ingress: ## Set to true to enable ingress record generation ## enabled: false - ## Set this to true in order to add the corresponding annotations for cert-manager ## certManager: false - ## When the ingress is enabled, a host pointing to this will be created ## - hostname: wordpress.local - + hostname: discourse.local ## Ingress annotations done as key:value pairs ## For a full list of possible ingress annotations, please see ## ref: https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/nginx-configuration/annotations.md @@ -286,20 +281,17 @@ ingress: ## If certManager is set to true, annotation kubernetes.io/tls-acme: "true" will automatically be set ## annotations: {} - ## The list of additional hostnames to be covered with this ingress record. ## Most likely the hostname above will be enough, but in the event more hosts are needed, this is an array ## extraHosts: - ## - name: wordpress.local + ## - name: discourse.local ## path: / - ## The tls configuration for additional hostnames to be covered with this ingress record. ## see: https://kubernetes.io/docs/concepts/services-networking/ingress/#tls ## extraTls: ## - hosts: - ## - wordpress.local - ## secretName: wordpress.local-tls - + ## - discourse.local + ## secretName: discourse.local-tls ## If you're providing your own certificates, please use this to add the certificates as secrets ## key and certificate should start with -----BEGIN CERTIFICATE----- or ## -----BEGIN RSA PRIVATE KEY----- @@ -311,7 +303,7 @@ ingress: ## Please see README.md for more information ## secrets: [] - ## - name: wordpress.local-tls + ## - name: discourse.local-tls ## key: ## certificate: From dbf38319f366c143edfa45c011098505144fa30a Mon Sep 17 00:00:00 2001 From: Luca Prete Date: Sat, 16 May 2020 13:00:42 +0200 Subject: [PATCH 13/35] Fix email indent and add Luca as maintainer --- bitnami/discourse/Chart.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bitnami/discourse/Chart.yaml b/bitnami/discourse/Chart.yaml index 4a0af2f5f2b2eb..08ff676a89b121 100644 --- a/bitnami/discourse/Chart.yaml +++ b/bitnami/discourse/Chart.yaml @@ -14,4 +14,6 @@ maintainers: - name: Bitnami email: containers@bitnami.com - name: paulczar - email: username.taken@gmail.com + email: username.taken@gmail.com + - name: lucaprete + email: preteluca@gmail.com From fb13e17a3490b6738b2623f7dc9d1ee6ec71d56e Mon Sep 17 00:00:00 2001 From: Luca Prete Date: Mon, 25 May 2020 11:12:15 +0200 Subject: [PATCH 14/35] Fix: put back original wordpress chart content --- bitnami/wordpress/templates/deployment.yaml | 15 ++++- bitnami/wordpress/values.yaml | 73 ++++++++++++++++++--- 2 files changed, 76 insertions(+), 12 deletions(-) diff --git a/bitnami/wordpress/templates/deployment.yaml b/bitnami/wordpress/templates/deployment.yaml index 7ae23fec013b17..6610066f0805ed 100644 --- a/bitnami/wordpress/templates/deployment.yaml +++ b/bitnami/wordpress/templates/deployment.yaml @@ -23,7 +23,7 @@ spec: {{- end }} {{- end }} spec: - {{- include "wordpress.imagePullSecrets" . | nindent 6 }} +{{- include "wordpress.imagePullSecrets" . | indent 6 }} {{- if .Values.schedulerName }} schedulerName: {{ .Values.schedulerName | quote }} {{- end }} @@ -45,6 +45,9 @@ spec: runAsUser: {{ .Values.securityContext.runAsUser }} fsGroup: {{ .Values.securityContext.fsGroup }} {{- end }} + {{- if .Values.initContainers }} + initContainers: {{- include "wordpress.tplValue" (dict "value" .Values.initContainers "context" $) | nindent 8 }} + {{- end }} containers: - name: wordpress image: {{ template "wordpress.image" . }} @@ -84,6 +87,8 @@ spec: value: {{ .Values.wordpressLastName | quote }} - name: WORDPRESS_HTACCESS_OVERRIDE_NONE value: {{ ternary "yes" "no" .Values.allowOverrideNone | quote }} + - name: WORDPRESS_HTACCESS_PERSISTENCE_ENABLED + value: {{ ternary "yes" "no" .Values.htaccessPersistenceEnabled | quote }} - name: WORDPRESS_BLOG_NAME value: {{ .Values.wordpressBlogName | quote }} - name: WORDPRESS_SKIP_INSTALL @@ -143,6 +148,8 @@ spec: {{- if .Values.livenessProbeHeaders }} httpHeaders: {{- toYaml .Values.livenessProbeHeaders | nindent 16 }} {{- end }} + {{- else if .Values.customLivenessProbe }} + livenessProbe: {{- include "wordpress.tplValue" (dict "value" .Values.customLivenessProbe "context" $) | nindent 12 }} {{- end }} {{- if .Values.readinessProbe.enabled }} readinessProbe: @@ -160,6 +167,8 @@ spec: {{- if .Values.readinessProbeHeaders }} httpHeaders: {{- toYaml .Values.readinessProbeHeaders | nindent 16 }} {{- end }} + {{- else if .Values.customReadinessProbe }} + readinessProbe: {{- include "wordpress.tplValue" (dict "value" .Values.customReadinessProbe "context" $) | nindent 12 }} {{- end }} volumeMounts: - mountPath: /bitnami/wordpress @@ -181,7 +190,7 @@ spec: imagePullPolicy: {{ .Values.metrics.image.pullPolicy | quote }} command: - /bin/apache_exporter - - -scrape_uri + - --scrape_uri - http://status.localhost:8080/server-status/?auto ports: - name: metrics @@ -223,4 +232,4 @@ spec: {{ end }} {{- if .Values.extraVolumes }} {{- include "wordpress.tplValue" (dict "value" .Values.extraVolumes "context" $) | nindent 8 }} - {{- end }} + {{- end }} \ No newline at end of file diff --git a/bitnami/wordpress/values.yaml b/bitnami/wordpress/values.yaml index c65bef6426fb25..13d378a427fe0e 100644 --- a/bitnami/wordpress/values.yaml +++ b/bitnami/wordpress/values.yaml @@ -14,7 +14,7 @@ image: registry: docker.io repository: bitnami/wordpress - tag: 5.3.2-debian-10-r43 + tag: 5.4.1-debian-10-r20 ## Specify a imagePullPolicy ## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent' ## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images @@ -92,6 +92,7 @@ wordpressSkipInstall: false ## rollingUpdate: ## maxSurge: 25% ## maxUnavailable: 25% +## updateStrategy: type: RollingUpdate @@ -105,7 +106,14 @@ allowEmptyPassword: true ## allowOverrideNone: false -# ConfigMap with custom wordpress-htaccess.conf file (requires allowOverrideNone to true) +## Persist the custom changes of the htaccess. It depends on the value of +## `.Values.allowOverrideNone`, when `yes` it will persist `/opt/bitnami/wordpress/wordpress-htaccess.conf` +## if `no` it will persist `/opt/bitnami/wordpress/.htaccess` +## +htaccessPersistenceEnabled: false + +## ConfigMap with custom wordpress-htaccess.conf file (requires allowOverrideNone to true) +## customHTAccessCM: ## Use an alternate scheduler, e.g. "stork". @@ -139,6 +147,7 @@ extraEnv: [] ## - name: ca-cert ## subPath: ca_cert ## mountPath: /path/to/ca_cert +## extraVolumeMounts: [] ## Additional volumes @@ -150,6 +159,7 @@ extraVolumeMounts: [] ## items: ## - key: ca-cert ## path: ca_cert +## extraVolumes: [] ## WordPress containers' resource requests and limits @@ -190,10 +200,12 @@ securityContext: runAsUser: 1001 ## Allow health checks to be pointed at the https port +## healthcheckHttps: false ## WordPress pod extra options for liveness and readiness probes ## ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes +## livenessProbe: enabled: true initialDelaySeconds: 120 @@ -209,6 +221,11 @@ readinessProbe: failureThreshold: 6 successThreshold: 1 +## Custom liveness and readiness probes, it overrides the default one (evaluated as a template) +## +customLivenessProbe: {} +customReadinessProbe: {} + ## If using an HTTPS-terminating load-balancer, the probes may need to behave ## like the balancer to prevent HTTP 302 responses. According to the Kubernetes ## docs, 302 should be considered "successful", but this issue on GitHub @@ -247,6 +264,7 @@ service: ## http: ## https: ## metrics: + ## nodePorts: http: "" https: "" @@ -258,22 +276,28 @@ service: annotations: {} ## Limits which cidr blocks can connect to service's load balancer ## Only valid if service.type: LoadBalancer + ## loadBalancerSourceRanges: [] ## Extra ports to expose (normally used with the `sidecar` value) # extraPorts: -## Ingress paramaters +## Configure the ingress resource that allows you to access the +## WordPress installation. Set up the URL +## ref: http://kubernetes.io/docs/user-guide/ingress/ ## ingress: ## Set to true to enable ingress record generation ## enabled: false + ## Set this to true in order to add the corresponding annotations for cert-manager ## certManager: false + ## When the ingress is enabled, a host pointing to this will be created ## - hostname: discourse.local + hostname: wordpress.local + ## Ingress annotations done as key:value pairs ## For a full list of possible ingress annotations, please see ## ref: https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/nginx-configuration/annotations.md @@ -281,17 +305,28 @@ ingress: ## If certManager is set to true, annotation kubernetes.io/tls-acme: "true" will automatically be set ## annotations: {} + + ## Enable TLS configuration for the hostname defined at ingress.hostname parameter + ## TLS certificates will be retrieved from a TLS secret with name: {{- printf "%s-tls" .Values.ingress.hostname }} + ## You can use the ingress.secrets parameter to create this TLS secret or relay on cert-manager to create it + ## + tls: false + ## The list of additional hostnames to be covered with this ingress record. ## Most likely the hostname above will be enough, but in the event more hosts are needed, this is an array ## extraHosts: - ## - name: discourse.local + ## - name: wordpress.local ## path: / + ## + ## The tls configuration for additional hostnames to be covered with this ingress record. ## see: https://kubernetes.io/docs/concepts/services-networking/ingress/#tls ## extraTls: ## - hosts: - ## - discourse.local - ## secretName: discourse.local-tls + ## - wordpress.local + ## secretName: wordpress.local-tls + ## + ## If you're providing your own certificates, please use this to add the certificates as secrets ## key and certificate should start with -----BEGIN CERTIFICATE----- or ## -----BEGIN RSA PRIVATE KEY----- @@ -303,9 +338,10 @@ ingress: ## Please see README.md for more information ## secrets: [] - ## - name: discourse.local-tls + ## - name: wordpress.local-tls ## key: ## certificate: + ## ## Enable persistence using Persistent Volume Claims ## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ @@ -334,8 +370,10 @@ persistence: ## mariadb: ## Whether to deploy a mariadb server to satisfy the applications database requirements. To use an external database set this to false and configure the externalDatabase parameters + ## enabled: true ## Disable MariaDB replication + ## replication: enabled: false @@ -406,7 +444,7 @@ metrics: image: registry: docker.io repository: bitnami/apache-exporter - tag: 0.7.0-debian-10-r44 + tag: 0.8.0-debian-10-r50 pullPolicy: IfNotPresent ## Optionally specify an array of imagePullSecrets. ## Secrets must be manually created in the namespace. @@ -415,6 +453,7 @@ metrics: # pullSecrets: # - myRegistryKeySecretName ## Metrics exporter pod Annotation and Labels + ## podAnnotations: prometheus.io/scrape: "true" prometheus.io/port: "9117" @@ -429,21 +468,26 @@ metrics: ## Prometheus Service Monitor ## ref: https://github.com/coreos/prometheus-operator ## https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#endpoint + ## serviceMonitor: ## If the operator is installed in your cluster, set to true to create a Service Monitor Entry + ## enabled: false ## Specify the namespace in which the serviceMonitor resource will be created # namespace: "" ## Specify the interval at which metrics should be scraped + ## interval: 30s ## Specify the timeout after which the scrape is ended # scrapeTimeout: 30s ## Specify Metric Relabellings to add to the scrape endpoint # relabellings: ## Specify honorLabels parameter to add the scrape endpoint + ## honorLabels: false ## Used to pass Labels that are used by the Prometheus installed in your cluster to select Service Monitors to work with ## ref: https://github.com/coreos/prometheus-operator/blob/master/Documentation/api.md#prometheusspec + ## additionalLabels: {} ## Add sidecars to the pod. @@ -457,3 +501,14 @@ metrics: ## containerPort: 1234 ## sidecars: {} + +## Add init containers to the pod. +## ref: https://kubernetes.io/docs/concepts/workloads/pods/init-containers/ +## Example: +## initContainers: +## - name: your-image-name +## image: your-image +## imagePullPolicy: Always +## command: ['sh', '-c', 'copy themes and plugins from git and push to /bitnami/wordpress/wp-conntent. Should work with extraVolumeMounts and extraVolumes'] +## +initContainers: {} \ No newline at end of file From c73365883687213209d4e50882e1ae49ab1f240b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20J=2E=20Salmer=C3=B3n-Garc=C3=ADa?= Date: Mon, 1 Jun 2020 09:55:13 +0200 Subject: [PATCH 15/35] Update bitnami/discourse/Chart.yaml --- bitnami/discourse/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitnami/discourse/Chart.yaml b/bitnami/discourse/Chart.yaml index 08ff676a89b121..676aed87e4a389 100644 --- a/bitnami/discourse/Chart.yaml +++ b/bitnami/discourse/Chart.yaml @@ -6,7 +6,7 @@ version: 0.1.0 appVersion: 2.4.1 engine: gotpl home: https://www.discourse.org/ -icon: https://bitnami.com/assets/stacks/wordpress/img/discourse-stack-220x234.png +icon: https://bitnami.com/assets/stacks/discourse/img/discourse-stack-220x234.png sources: - https://github.com/bitnami/bitnami-docker-discourse - https://github.com/spinnaker From 08494e5526a873a9932a5e720a5a8741790e4f0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20J=2E=20Salmer=C3=B3n-Garc=C3=ADa?= Date: Mon, 1 Jun 2020 09:59:33 +0200 Subject: [PATCH 16/35] Update bitnami/discourse/values.yaml --- bitnami/discourse/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bitnami/discourse/values.yaml b/bitnami/discourse/values.yaml index 262337a59b43f9..bb79f288227cf2 100644 --- a/bitnami/discourse/values.yaml +++ b/bitnami/discourse/values.yaml @@ -249,7 +249,7 @@ postgresql: enabled: true postgresqlUsername: bn_discourse postgresqlPostgresPassword: - postgresqlPassword: + postgresqlPassword: "" postgresqlDatabase: bitnami_discourse persistence: enabled: false From 550b6dc01e601da69625646bd536109026a68389 Mon Sep 17 00:00:00 2001 From: Luca Prete Date: Wed, 3 Jun 2020 18:25:09 +0200 Subject: [PATCH 17/35] Major lint fixes and intro of external DB and notes --- bitnami/discourse/templates/NOTES.txt | 115 +++++++++++++++--- bitnami/discourse/templates/_helpers.tpl | 20 +++ bitnami/discourse/templates/configmaps.yaml | 20 +-- .../templates/deployment-sidekiq.yaml | 37 +++--- bitnami/discourse/templates/deployment.yaml | 32 ++--- bitnami/discourse/templates/service.yaml | 4 +- .../discourse/templates/serviceaccount.yaml | 3 +- bitnami/discourse/values.yaml | 21 +++- 8 files changed, 183 insertions(+), 69 deletions(-) diff --git a/bitnami/discourse/templates/NOTES.txt b/bitnami/discourse/templates/NOTES.txt index ea49b7d1a80854..6d6f36e47c6f22 100644 --- a/bitnami/discourse/templates/NOTES.txt +++ b/bitnami/discourse/templates/NOTES.txt @@ -1,21 +1,102 @@ -1. Get the application URL by running these commands: -{{- if .Values.ingress.enabled }} -{{- range $host := .Values.ingress.hosts }} - {{- range .paths }} - http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }} +{{- if and (include "discourse.host" .) (.Values.postgresql.enabled) -}} + +{{- if empty (include "discourse.host" .) -}} +############################################################################### +### ERROR: You did not provide an external host in your 'helm install' call ### +############################################################################### + +This deployment will be incomplete until you configure Discourse with a resolvable host. To configure Discourse with the URL of your service: + +1. Get the discourse URL by running: + + {{- if contains "NodePort" .Values.service.type }} + + export APP_PORT=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "discourse.fullname" . }} -o jsonpath="{.spec.ports[0].nodePort}") + export APP_HOST=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + + {{- else if contains "LoadBalancer" .Values.service.type }} + + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + Watch the status with: 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "discourse.fullname" . }}' + + export APP_HOST=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "discourse.fullname" . }} --template "{{ "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}" }}") + export APP_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "discourse.fullname" . }} -o jsonpath="{.data.discourse-password}" | base64 --decode) + {{- if .Values.postgresql.postgresqlPostgresPassword }} + export DATABASE_ROOT_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "discourse.postgresql.fullname" . }} -o jsonpath="{.data.postgresql-postgresql-postgres-password}" | base64 --decode) {{- end }} + {{- end }} + export APP_DATABASE_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "discourse.postgresql.fullname" . }} -o jsonpath="{.data.postgresql-postgresql-password}" | base64 --decode) + +2. Complete your Discourse deployment by running: + +{{- if .Values.postgresql.enabled }} + + helm upgrade {{ .Release.Name }} bitnami/{{ .Chart.Name }} \ + --set discourseHost=$APP_HOST,discoursePassword=$APP_PASSWORD{{ if .Values.postgresql.postgresqlPostgresPassword }},postgresql.postgresqlPostgresPassword=$DATABASE_ROOT_PASSWORD{{ end }},postgresql.postgresqlPassword=$APP_DATABASE_PASSWORD{{- if .Values.global }}{{- if .Values.global.imagePullSecrets }},global.imagePullSecrets={{ .Values.global.imagePullSecrets }}{{- end }}{{- end }} +{{- else }} + + ## PLEASE UPDATE THE EXTERNAL DATABASE CONNECTION PARAMETERS IN THE FOLLOWING COMMAND AS NEEDED ## + + helm upgrade {{ .Release.Name }} bitnami/{{ .Chart.Name }} \ + --set discoursePassword=$APP_PASSWORD,discourseHost=$APP_HOST,service.type={{ .Values.service.type }},postgresql.enabled=false{{- if not (empty .Values.externalDatabase.host) }},externalDatabase.host={{ .Values.externalDatabase.host }}{{- end }}{{- if not (empty .Values.externalDatabase.user) }},externalDatabase.user={{ .Values.externalDatabase.user }}{{- end }}{{- if not (empty .Values.externalDatabase.password) }},externalDatabase.password={{ .Values.externalDatabase.password }}{{- end }}{{- if not (empty .Values.externalDatabase.database) }},externalDatabase.database={{ .Values.externalDatabase.database }}{{- end }}{{- if .Values.global }}{{- if .Values.global.imagePullSecrets }},global.imagePullSecrets={{ .Values.global.imagePullSecrets }}{{- end }}{{- end }} +{{- end }} + +{{- else -}} +1. Get the Discourse URL by running: + +{{- if eq .Values.service.type "ClusterIP" }} + + echo "Store URL: http://127.0.0.1:8080/" + echo "Admin URL: http://127.0.0.1:8080/{{ .Values.discourseAdminUri }}" + kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ template "discourse.fullname" . }} 8080:{{ .Values.service.port }} + +{{- else }} + +{{- $port:=.Values.service.port | toString }} + echo Store URL : http://{{ include "discourse.host" . }}{{- if ne $port "80" }}:{{ .Values.service.port }}{{ end }}/ + echo Admin URL : http://{{ include "discourse.host" . }}{{- if ne $port "80" }}:{{ .Values.service.port }}{{ end }}/{{ .Values.discourseAdminUri }} + +{{- end }} + +2. Get your Discourse login credentials by running: + + echo Username: {{ .Values.discourseUsername }} + echo Password: $(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "discourse.fullname" . }} -o jsonpath="{.data.discourse-password}" | base64 --decode) {{- end }} -{{- else if contains "NodePort" .Values.service.type }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "discourse.fullname" . }}) - export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") - echo http://$NODE_IP:$NODE_PORT + +{{- else -}} + +######################################################################################## +### ERROR: You did not provide an external database host in your 'helm install' call ### +######################################################################################## + +This deployment will be incomplete until you configure Discourse with a resolvable database host. To configure Discourse to use and external database host: + +1. Complete your Discourse deployment by running: + +{{- if contains "NodePort" .Values.service.type }} + export APP_HOST=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") {{- else if contains "LoadBalancer" .Values.service.type }} - NOTE: It may take a few minutes for the LoadBalancer IP to be available. - You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "discourse.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "discourse.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") - echo http://$SERVICE_IP:{{ .Values.service.port }} -{{- else if contains "ClusterIP" .Values.service.type }} - export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "discourse.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") - echo "Visit http://127.0.0.1:80 to use your application" - sudo kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 80:3000 + + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + Watch the status with: 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "discourse.fullname" . }}' + + export APP_HOST=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "discourse.fullname" . }} --template "{{ "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}" }}") +{{- else }} + + export APP_HOST=127.0.0.1 +{{- end }} + export APP_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "discourse.fullname" . }} -o jsonpath="{.data.discourse-password}" | base64 --decode) + + ## PLEASE UPDATE THE EXTERNAL DATABASE CONNECTION PARAMETERS IN THE FOLLOWING COMMAND AS NEEDED ## + + helm upgrade {{ .Release.Name }} bitnami/{{ .Chart.Name }} \ + --set discoursePassword=$APP_PASSWORD,discourseHost=$APP_HOST,service.type={{ .Values.service.type }},postgresql.enabled=false{{- if not (empty .Values.externalDatabase.user) }},externalDatabase.user={{ .Values.externalDatabase.user }}{{- end }}{{- if not (empty .Values.externalDatabase.password) }},externalDatabase.password={{ .Values.externalDatabase.password }}{{- end }}{{- if not (empty .Values.externalDatabase.database) }},externalDatabase.database={{ .Values.externalDatabase.database }}{{- end }},externalDatabase.host=YOUR_EXTERNAL_DATABASE_HOST{{- if .Values.global }}{{- if .Values.global.imagePullSecrets }},global.imagePullSecrets={{ .Values.global.imagePullSecrets }}{{- end }}{{- end }} +{{- end }} + +{{- if and (contains "bitnami/" .Values.image.repository) (not (.Values.image.tag | regexFind "-r\\d+$")) }} + +WARNING: Rolling tag detected ({{ .Values.image.repository }}:{{ .Values.image.tag }}), please note that it is strongly recommended to avoid using rolling tags in a production environment. ++info https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/ + {{- end }} diff --git a/bitnami/discourse/templates/_helpers.tpl b/bitnami/discourse/templates/_helpers.tpl index e8f47e534156bf..438b46e6be27ce 100644 --- a/bitnami/discourse/templates/_helpers.tpl +++ b/bitnami/discourse/templates/_helpers.tpl @@ -6,6 +6,14 @@ Expand the name of the chart. {{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} {{- end -}} +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "discourse.postgresql.fullname" -}} +{{- printf "%s-%s" .Release.Name "postgresql" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + {{/* Create a default fully qualified app name. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). @@ -104,6 +112,18 @@ imagePullSecrets: {{- end -}} {{- end -}} +{{/* +Get the user defined LoadBalancerIP for this release. +Note, returns 127.0.0.1 if using ClusterIP. +*/}} +{{- define "discourse.serviceIP" -}} +{{- if eq .Values.service.type "ClusterIP" -}} +127.0.0.1 +{{- else -}} +{{- .Values.service.loadBalancerIP | default "" -}} +{{- end -}} +{{- end -}} + {{/* Gets the host to be used for this application. If not using ClusterIP, or if a host or LoadBalancerIP is not defined, the value will be empty. diff --git a/bitnami/discourse/templates/configmaps.yaml b/bitnami/discourse/templates/configmaps.yaml index f055d3476cc203..050d778e89d83a 100644 --- a/bitnami/discourse/templates/configmaps.yaml +++ b/bitnami/discourse/templates/configmaps.yaml @@ -5,15 +5,21 @@ metadata: labels: {{- include "discourse.labels" . | nindent 4 }} data: DISCOURSE_HOSTNAME: {{ .Values.discourseHost }} - DISCOURSE_USERNAME: {{ .Values.admin.username }} - DISCOURSE_EMAIL: {{ .Values.admin.email }} + DISCOURSE_USERNAME: {{ .Values.discourseUsername }} + DISCOURSE_EMAIL: {{ .Values.discourseEmail }} DISCOURSE_SITENAME: {{ .Values.sitename }} - POSTGRESQL_HOST: {{ include "discourse.fullname" . }}-postgresql - DISCOURSE_POSTGRESQL_NAME: "{{ .Values.postgresql.postgresqlDatabase }}" - DISCOURSE_POSTGRESQL_USERNAME: "{{ .Values.postgresql.postgresqlUsername }}" + {{- if .Values.postgresql.enabled }} + POSTGRESQL_HOST: {{ template "discourse.postgresql.fullname" . }} POSTGRESQL_ROOT_USER: "postgres" - POSTGRESQL_CLIENT_CREATE_DATABASE_NAME: "{{ .Values.postgresql.postgresqlDatabase }}" - POSTGRESQL_CLIENT_CREATE_DATABASE_USERNAME: "{{ .Values.postgresql.postgresqlUsername }}" + POSTGRESQL_CLIENT_CREATE_DATABASE_NAME: {{ .Values.postgresql.postgresqlDatabase }} + POSTGRESQL_CLIENT_CREATE_DATABASE_USERNAME: {{ .Values.postgresql.postgresqlUsername }} + DISCOURSE_POSTGRESQL_NAME: {{ .Values.postgresql.postgresqlDatabase }} + DISCOURSE_POSTGRESQL_USERNAME: {{ .Values.postgresql.postgresqlUsername }} + {{- else }} + POSTGRESQL_HOST: {{ .Values.externalDatabase.host | quote }} + DISCOURSE_POSTGRESQL_NAME: {{ .Values.externalDatabase.database }} + DISCOURSE_POSTGRESQL_USERNAME: {{ .Values.externalDatabase.user }} + {{- end }} REDIS_HOST: {{ include "discourse.fullname" . }}-redis-master REDIS_PORT_NUMBER: "6379" {{- if .Release.IsUpgrade }} diff --git a/bitnami/discourse/templates/deployment-sidekiq.yaml b/bitnami/discourse/templates/deployment-sidekiq.yaml index 41de109b312826..2a5992be2cd100 100644 --- a/bitnami/discourse/templates/deployment-sidekiq.yaml +++ b/bitnami/discourse/templates/deployment-sidekiq.yaml @@ -1,4 +1,4 @@ -{{- if and (include "discourse.host" .) (.Values.postgresql.enabled) -}} +{{- if and (include "discourse.host" .) (or .Values.postgresql.enabled .Values.externalDatabase.host) -}} apiVersion: apps/v1 kind: Deployment metadata: @@ -9,23 +9,19 @@ metadata: spec: replicas: {{ .Values.replicaCount.sidekiq }} selector: - matchLabels: - {{- include "discourse.selectorLabels" . | nindent 6 }} + matchLabels: {{- include "discourse.selectorLabels" . | nindent 6 }} component: sidekiq template: metadata: - labels: - {{- include "discourse.selectorLabels" . | nindent 8 }} + labels: {{- include "discourse.selectorLabels" . | nindent 8 }} component: sidekiq spec: - {{- include "discourse.imagePullSecrets" . | nindent 6 }} + {{- include "discourse.imagePullSecrets" . | indent 6 }} serviceAccountName: {{ include "discourse.serviceAccountName" . }} - securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} + securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} containers: - name: sidekiq - securityContext: - {{- toYaml .Values.containerSecurityContext | nindent 12 }} + securityContext: {{- toYaml .Values.containerSecurityContext | nindent 12 }} image: {{ template "discourse.image" . }} imagePullPolicy: {{ .Values.image.pullPolicy | quote }} command: ["/app-entrypoint.sh"] @@ -49,11 +45,13 @@ spec: secretKeyRef: name: {{ include "discourse.fullname" . }} key: discourse-postgresql-password + {{- if .Values.postgresql.enabled }} - name: POSTGRESQL_CLIENT_CREATE_DATABASE_PASSWORD valueFrom: secretKeyRef: name: {{ include "discourse.fullname" . }} key: postgresql-client-create-database-password + {{- end }} - name: REDIS_PASSWORD valueFrom: secretKeyRef: @@ -62,7 +60,7 @@ spec: - configMapRef: name: {{ include "discourse.fullname" . }} {{- if .Values.extraEnvVars.discourse }} - {{- tpl (toYaml .Values.extraEnvVars.discourse) $ | nindent 12 }} + {{- tpl (toYaml .Values.extraEnvVars.discourse) $ | indent 12 }} {{- end }} {{- if or .Values.extraEnvVarsCM.discourse .Values.extraEnvVarsSecret.discourse }} envFrom: @@ -86,15 +84,12 @@ spec: periodSeconds: 60 resources: {{- toYaml .Values.resources | nindent 12 }} {{- with .Values.nodeSelector }} - nodeSelector: - {{- toYaml . | nindent 8 }} + nodeSelector: {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: {{- toYaml . | nindent 8 }} {{- end }} - {{- with .Values.affinity }} - affinity: - {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: - {{- toYaml . | nindent 8 }} - {{- end }} {{- end -}} diff --git a/bitnami/discourse/templates/deployment.yaml b/bitnami/discourse/templates/deployment.yaml index bc5b793af69fc9..7391bfadd1f850 100644 --- a/bitnami/discourse/templates/deployment.yaml +++ b/bitnami/discourse/templates/deployment.yaml @@ -1,38 +1,31 @@ -{{- if and (include "discourse.host" .) (.Values.postgresql.enabled) -}} +{{- if and (include "discourse.host" .) (or .Values.postgresql.enabled .Values.externalDatabase.host) -}} apiVersion: apps/v1 kind: Deployment metadata: name: {{ template "discourse.fullname" . }} - labels: - {{- include "discourse.labels" . | nindent 4 }} + labels: {{- include "discourse.labels" . | nindent 4 }} component: discourse spec: replicas: {{ .Values.replicaCount.discourse }} selector: - matchLabels: - {{- include "discourse.selectorLabels" . | nindent 6 }} + matchLabels: {{- include "discourse.selectorLabels" . | nindent 6 }} component: discourse template: metadata: annotations: checksum/config: {{ include (print $.Template.BasePath "/configmap-envs.yaml") . | sha256sum }} checksum/secret: {{ include (print $.Template.BasePath "/secret-envs.yaml") . | sha256sum }} - labels: - {{- include "discourse.selectorLabels" . | nindent 8 }} + labels: {{- include "discourse.selectorLabels" . | nindent 8 }} component: discourse - spec: - {{- include "discourse.imagePullSecrets" . | nindent 6 }} + spec: {{- include "discourse.imagePullSecrets" . | nindent 6 }} serviceAccountName: {{ include "discourse.serviceAccountName" . }} - securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} + securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} {{- if .Values.initContainers }} - initContainers: - {{- tpl (toYaml .Values.initContainers) $ | nindent 8 }} + initContainers: {{- tpl (toYaml .Values.initContainers) $ | nindent 8 }} {{- end }} containers: - name: discourse - securityContext: - {{- toYaml .Values.containerSecurityContext | nindent 12 }} + securityContext: {{- toYaml .Values.containerSecurityContext | nindent 12 }} image: {{ template "discourse.image" . }} imagePullPolicy: {{ .Values.image.pullPolicy | quote }} env: @@ -46,11 +39,13 @@ spec: secretKeyRef: name: {{ include "discourse.fullname" . }} key: discourse-postgresql-password + {{- if .Values.postgresql.enabled }} - name: POSTGRESQL_CLIENT_CREATE_DATABASE_PASSWORD valueFrom: secretKeyRef: name: {{ include "discourse.fullname" . }} key: postgresql-client-create-database-password + {{- end }} - name: REDIS_PASSWORD valueFrom: secretKeyRef: @@ -59,7 +54,7 @@ spec: - configMapRef: name: {{ include "discourse.fullname" . }} {{- if .Values.extraEnvVars.discourse }} - {{- tpl (toYaml .Values.extraEnvVars.discourse) $ | nindent 12 }} + {{- tpl (toYaml .Values.extraEnvVars.discourse) $ | indent 12 }} {{- end }} {{- if or .Values.extraEnvVarsCM.discourse .Values.extraEnvVarsSecret.discourse }} envFrom: @@ -86,7 +81,7 @@ spec: port: http resources: {{- toYaml .Values.resources | nindent 12 }} {{- if .Values.sidecars }} - {{- tpl (toYaml .Values.sidecars) $ | nindent 8 }} + {{- tpl (toYaml .Values.sidecars) $ | indent 8 }} {{- end }} {{- if .Values.affinity }} affinity: {{- include "discourse.tplValue" (dict "value" .Values.affinity "context" $) | nindent 8 }} @@ -97,5 +92,4 @@ spec: {{- if .Values.tolerations }} tolerations: {{- include "discourse.tplValue" (dict "value" .Values.tolerations "context" $) | nindent 8 }} {{- end }} - {{- with .Values.nodeSelector }} -{{- end -}} +{{- end }} diff --git a/bitnami/discourse/templates/service.yaml b/bitnami/discourse/templates/service.yaml index 7a91590781ad1f..d871736336bc03 100644 --- a/bitnami/discourse/templates/service.yaml +++ b/bitnami/discourse/templates/service.yaml @@ -11,7 +11,7 @@ spec: {{- if (and (eq .Values.service.type "LoadBalancer") .Values.service.loadBalancerSourceRanges) }} loadBalancerSourceRanges: {{- with .Values.service.loadBalancerSourceRanges }} -{{ toYaml . | indent 4 }} + {{ toYaml . | indent 4 }} {{- end }} {{- end }} ports: @@ -24,6 +24,6 @@ spec: nodePort: null {{- end }} {{- if .Values.service.extraPorts }} - {{- include "discourse.tplValue" (dict "value" .Values.service.extraPorts "context" $) | nindent 4 }} + {{- include "discourse.tplValue" (dict "value" .Values.service.extraPorts "context" $) | indent 4 }} {{- end }} selector: {{- include "discourse.matchLabels" . | nindent 4 }} diff --git a/bitnami/discourse/templates/serviceaccount.yaml b/bitnami/discourse/templates/serviceaccount.yaml index 5966260e920620..cd4a26635b54bc 100644 --- a/bitnami/discourse/templates/serviceaccount.yaml +++ b/bitnami/discourse/templates/serviceaccount.yaml @@ -5,7 +5,6 @@ metadata: name: {{ include "discourse.serviceAccountName" . }} labels: {{- include "discourse.labels" . | nindent 4 }} {{- with .Values.serviceAccount.annotations }} - annotations: - {{- toYaml . | nindent 4 }} + annotations: {{- toYaml . | nindent 4 }} {{- end }} {{- end -}} diff --git a/bitnami/discourse/values.yaml b/bitnami/discourse/values.yaml index bb79f288227cf2..74862c24c45ebd 100644 --- a/bitnami/discourse/values.yaml +++ b/bitnami/discourse/values.yaml @@ -122,6 +122,10 @@ service: loadBalancerSourceRanges: [] ## Extra ports to expose (normally used with the `sidecar` value) # extraPorts: + nodePorts: + http: "" + https: "" + metrics: "" ## Ingress paramaters ## @@ -248,12 +252,27 @@ extraEnvVarsSecret: postgresql: enabled: true postgresqlUsername: bn_discourse - postgresqlPostgresPassword: + postgresqlPostgresPassword: "" postgresqlPassword: "" postgresqlDatabase: bitnami_discourse persistence: enabled: false +## +## External database configuration +## +externalDatabase: + ## Database host + host: "" + ## Database port + port: 3306 + ## Database user + user: bn_discourse + ## Database password + password: + ## Database name + database: bitnami_discourse + ## Redis chart configuration ## ## https://github.com/bitnami/charts/blob/master/bitnami/redis/values.yaml From 5168653292fad4c61d04465c79b71642d2213d90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Rodr=C3=ADguez=20Hern=C3=A1ndez?= Date: Fri, 5 Jun 2020 10:32:43 +0200 Subject: [PATCH 18/35] Delete wordpress file --- bitnami/wordpress/templates/deployment.yaml | 235 -------------------- 1 file changed, 235 deletions(-) delete mode 100644 bitnami/wordpress/templates/deployment.yaml diff --git a/bitnami/wordpress/templates/deployment.yaml b/bitnami/wordpress/templates/deployment.yaml deleted file mode 100644 index 6610066f0805ed..00000000000000 --- a/bitnami/wordpress/templates/deployment.yaml +++ /dev/null @@ -1,235 +0,0 @@ -apiVersion: {{ template "wordpress.deployment.apiVersion" . }} -kind: Deployment -metadata: - name: {{ template "wordpress.fullname" . }} - labels: {{- include "wordpress.labels" . | nindent 4 }} -spec: - selector: - matchLabels: {{- include "wordpress.matchLabels" . | nindent 6 }} - {{- if .Values.updateStrategy }} - strategy: {{ toYaml .Values.updateStrategy | nindent 4 }} - {{- end }} - replicas: {{ .Values.replicaCount }} - template: - metadata: - labels: {{- include "wordpress.labels" . | nindent 8 }} - {{- if or .Values.podAnnotations .Values.metrics.enabled }} - annotations: - {{- if .Values.podAnnotations }} - {{- include "wordpress.tplValue" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }} - {{- end }} - {{- if .Values.metrics.podAnnotations }} - {{- include "wordpress.tplValue" (dict "value" .Values.metrics.podAnnotations "context" $) | nindent 8 }} - {{- end }} - {{- end }} - spec: -{{- include "wordpress.imagePullSecrets" . | indent 6 }} - {{- if .Values.schedulerName }} - schedulerName: {{ .Values.schedulerName | quote }} - {{- end }} - hostAliases: - - ip: "127.0.0.1" - hostnames: - - "status.localhost" - {{- if .Values.affinity }} - affinity: {{- include "wordpress.tplValue" (dict "value" .Values.affinity "context" $) | nindent 8 }} - {{- end }} - {{- if .Values.nodeSelector }} - nodeSelector: {{- include "wordpress.tplValue" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }} - {{- end }} - {{- if .Values.tolerations }} - tolerations: {{- include "wordpress.tplValue" (dict "value" .Values.tolerations "context" $) | nindent 8 }} - {{- end }} - {{- if .Values.securityContext.enabled }} - securityContext: - runAsUser: {{ .Values.securityContext.runAsUser }} - fsGroup: {{ .Values.securityContext.fsGroup }} - {{- end }} - {{- if .Values.initContainers }} - initContainers: {{- include "wordpress.tplValue" (dict "value" .Values.initContainers "context" $) | nindent 8 }} - {{- end }} - containers: - - name: wordpress - image: {{ template "wordpress.image" . }} - imagePullPolicy: {{ .Values.image.pullPolicy | quote }} - env: - {{- if .Values.image.debug }} - - name: NAMI_DEBUG - value: "--log-level trace" - {{- end }} - - name: ALLOW_EMPTY_PASSWORD - value: {{ ternary "yes" "no" .Values.allowEmptyPassword | quote }} - - name: MARIADB_HOST - value: {{ include "wordpress.databaseHost" . | quote }} - - name: MARIADB_PORT_NUMBER - value: {{ include "wordpress.databasePort" . | quote }} - - name: WORDPRESS_DATABASE_NAME - value: {{ include "wordpress.databaseName" . | quote }} - - name: WORDPRESS_DATABASE_USER - value: {{ include "wordpress.databaseUser" . | quote }} - - name: WORDPRESS_DATABASE_PASSWORD - valueFrom: - secretKeyRef: - name: {{ include "wordpress.databaseSecretName" . }} - key: mariadb-password - - name: WORDPRESS_USERNAME - value: {{ .Values.wordpressUsername | quote }} - - name: WORDPRESS_PASSWORD - valueFrom: - secretKeyRef: - name: {{ include "wordpress.fullname" . }} - key: wordpress-password - - name: WORDPRESS_EMAIL - value: {{ .Values.wordpressEmail | quote }} - - name: WORDPRESS_FIRST_NAME - value: {{ .Values.wordpressFirstName | quote }} - - name: WORDPRESS_LAST_NAME - value: {{ .Values.wordpressLastName | quote }} - - name: WORDPRESS_HTACCESS_OVERRIDE_NONE - value: {{ ternary "yes" "no" .Values.allowOverrideNone | quote }} - - name: WORDPRESS_HTACCESS_PERSISTENCE_ENABLED - value: {{ ternary "yes" "no" .Values.htaccessPersistenceEnabled | quote }} - - name: WORDPRESS_BLOG_NAME - value: {{ .Values.wordpressBlogName | quote }} - - name: WORDPRESS_SKIP_INSTALL - value: {{ ternary "yes" "no" .Values.wordpressSkipInstall | quote }} - - name: WORDPRESS_TABLE_PREFIX - value: {{ .Values.wordpressTablePrefix | quote }} - - name: WORDPRESS_SCHEME - value: {{ .Values.wordpressScheme | quote }} - {{- if .Values.smtpHost }} - - name: SMTP_HOST - value: {{ .Values.smtpHost | quote }} - {{- end }} - {{- if .Values.smtpPort }} - - name: SMTP_PORT - value: {{ .Values.smtpPort | quote }} - {{- end }} - {{- if .Values.smtpUser }} - - name: SMTP_USER - value: {{ .Values.smtpUser | quote }} - {{- end }} - {{- if .Values.smtpPassword }} - - name: SMTP_PASSWORD - valueFrom: - secretKeyRef: - name: {{ template "wordpress.fullname" . }} - key: smtp-password - {{- end }} - {{- if .Values.smtpUsername }} - - name: SMTP_USERNAME - value: {{ .Values.smtpUsername | quote }} - {{- end }} - {{- if .Values.smtpProtocol }} - - name: SMTP_PROTOCOL - value: {{ .Values.smtpProtocol | quote }} - {{- end }} - {{- if .Values.extraEnv }} - {{- include "wordpress.tplValue" (dict "value" .Values.extraEnv "context" $) | nindent 12 }} - {{- end }} - ports: - - name: http - containerPort: 8080 - - name: https - containerPort: 8443 - {{- if .Values.livenessProbe.enabled }} - livenessProbe: - initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} - periodSeconds: {{ .Values.livenessProbe.periodSeconds }} - timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} - successThreshold: {{ .Values.livenessProbe.successThreshold }} - failureThreshold: {{ .Values.livenessProbe.failureThreshold }} - httpGet: - path: /wp-login.php - port: {{ ternary "https" "http" .Values.healthcheckHttps }} - {{- if .Values.healthcheckHttps }} - scheme: HTTPS - {{- end }} - {{- if .Values.livenessProbeHeaders }} - httpHeaders: {{- toYaml .Values.livenessProbeHeaders | nindent 16 }} - {{- end }} - {{- else if .Values.customLivenessProbe }} - livenessProbe: {{- include "wordpress.tplValue" (dict "value" .Values.customLivenessProbe "context" $) | nindent 12 }} - {{- end }} - {{- if .Values.readinessProbe.enabled }} - readinessProbe: - initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} - periodSeconds: {{ .Values.readinessProbe.periodSeconds }} - timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} - successThreshold: {{ .Values.readinessProbe.successThreshold }} - failureThreshold: {{ .Values.readinessProbe.failureThreshold }} - httpGet: - path: /wp-login.php - port: {{ ternary "https" "http" .Values.healthcheckHttps }} - {{- if .Values.healthcheckHttps }} - scheme: HTTPS - {{- end }} - {{- if .Values.readinessProbeHeaders }} - httpHeaders: {{- toYaml .Values.readinessProbeHeaders | nindent 16 }} - {{- end }} - {{- else if .Values.customReadinessProbe }} - readinessProbe: {{- include "wordpress.tplValue" (dict "value" .Values.customReadinessProbe "context" $) | nindent 12 }} - {{- end }} - volumeMounts: - - mountPath: /bitnami/wordpress - name: wordpress-data - subPath: wordpress - {{- if and .Values.allowOverrideNone .Values.customHTAccessCM }} - - mountPath: /htaccess - name: custom-htaccess - {{- end }} - {{- if .Values.extraVolumeMounts }} - {{- include "wordpress.tplValue" (dict "value" .Values.extraVolumeMounts "context" $) | nindent 12 }} - {{- end }} - {{- if .Values.resources }} - resources: {{- toYaml .Values.resources | nindent 12 }} - {{- end }} - {{- if .Values.metrics.enabled }} - - name: metrics - image: {{ template "wordpress.metrics.image" . }} - imagePullPolicy: {{ .Values.metrics.image.pullPolicy | quote }} - command: - - /bin/apache_exporter - - --scrape_uri - - http://status.localhost:8080/server-status/?auto - ports: - - name: metrics - containerPort: 9117 - livenessProbe: - httpGet: - path: /metrics - port: metrics - initialDelaySeconds: 15 - timeoutSeconds: 5 - readinessProbe: - httpGet: - path: /metrics - port: metrics - initialDelaySeconds: 5 - timeoutSeconds: 1 - {{- if .Values.metrics.resources }} - resources: {{- toYaml .Values.metrics.resources | nindent 12 }} - {{- end }} - {{- end }} - {{- if .Values.sidecars }} - {{- include "wordpress.tplValue" (dict "value" .Values.sidecars "context" $) | nindent 8 }} - {{- end }} - volumes: - {{- if and .Values.allowOverrideNone .Values.customHTAccessCM }} - - name: custom-htaccess - configMap: - name: {{ template "wordpress.customHTAccessCM" . }} - items: - - key: wordpress-htaccess.conf - path: wordpress-htaccess.conf - {{- end }} - - name: wordpress-data - {{- if .Values.persistence.enabled }} - persistentVolumeClaim: - claimName: {{ .Values.persistence.existingClaim | default (include "wordpress.fullname" .) }} - {{- else }} - emptyDir: {} - {{ end }} - {{- if .Values.extraVolumes }} - {{- include "wordpress.tplValue" (dict "value" .Values.extraVolumes "context" $) | nindent 8 }} - {{- end }} \ No newline at end of file From 289a88fdcb2882dfc4a5a9eb94c36f6d1487786f Mon Sep 17 00:00:00 2001 From: joancafom Date: Fri, 5 Jun 2020 14:21:40 +0200 Subject: [PATCH 19/35] Restore original wordpress deployment file Found unreleated file in the commit, restoring the original --- bitnami/wordpress/templates/deployment.yaml | 235 ++++++++++++++++++++ 1 file changed, 235 insertions(+) create mode 100644 bitnami/wordpress/templates/deployment.yaml diff --git a/bitnami/wordpress/templates/deployment.yaml b/bitnami/wordpress/templates/deployment.yaml new file mode 100644 index 00000000000000..ef605cc9e871b9 --- /dev/null +++ b/bitnami/wordpress/templates/deployment.yaml @@ -0,0 +1,235 @@ +apiVersion: {{ template "wordpress.deployment.apiVersion" . }} +kind: Deployment +metadata: + name: {{ template "wordpress.fullname" . }} + labels: {{- include "wordpress.labels" . | nindent 4 }} +spec: + selector: + matchLabels: {{- include "wordpress.matchLabels" . | nindent 6 }} + {{- if .Values.updateStrategy }} + strategy: {{ toYaml .Values.updateStrategy | nindent 4 }} + {{- end }} + replicas: {{ .Values.replicaCount }} + template: + metadata: + labels: {{- include "wordpress.labels" . | nindent 8 }} + {{- if or .Values.podAnnotations .Values.metrics.enabled }} + annotations: + {{- if .Values.podAnnotations }} + {{- include "wordpress.tplValue" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.metrics.podAnnotations }} + {{- include "wordpress.tplValue" (dict "value" .Values.metrics.podAnnotations "context" $) | nindent 8 }} + {{- end }} + {{- end }} + spec: +{{- include "wordpress.imagePullSecrets" . | indent 6 }} + {{- if .Values.schedulerName }} + schedulerName: {{ .Values.schedulerName | quote }} + {{- end }} + hostAliases: + - ip: "127.0.0.1" + hostnames: + - "status.localhost" + {{- if .Values.affinity }} + affinity: {{- include "wordpress.tplValue" (dict "value" .Values.affinity "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.nodeSelector }} + nodeSelector: {{- include "wordpress.tplValue" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.tolerations }} + tolerations: {{- include "wordpress.tplValue" (dict "value" .Values.tolerations "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.securityContext.enabled }} + securityContext: + runAsUser: {{ .Values.securityContext.runAsUser }} + fsGroup: {{ .Values.securityContext.fsGroup }} + {{- end }} + {{- if .Values.initContainers }} + initContainers: {{- include "wordpress.tplValue" (dict "value" .Values.initContainers "context" $) | nindent 8 }} + {{- end }} + containers: + - name: wordpress + image: {{ template "wordpress.image" . }} + imagePullPolicy: {{ .Values.image.pullPolicy | quote }} + env: + {{- if .Values.image.debug }} + - name: NAMI_DEBUG + value: "--log-level trace" + {{- end }} + - name: ALLOW_EMPTY_PASSWORD + value: {{ ternary "yes" "no" .Values.allowEmptyPassword | quote }} + - name: MARIADB_HOST + value: {{ include "wordpress.databaseHost" . | quote }} + - name: MARIADB_PORT_NUMBER + value: {{ include "wordpress.databasePort" . | quote }} + - name: WORDPRESS_DATABASE_NAME + value: {{ include "wordpress.databaseName" . | quote }} + - name: WORDPRESS_DATABASE_USER + value: {{ include "wordpress.databaseUser" . | quote }} + - name: WORDPRESS_DATABASE_PASSWORD + valueFrom: + secretKeyRef: + name: {{ include "wordpress.databaseSecretName" . }} + key: mariadb-password + - name: WORDPRESS_USERNAME + value: {{ .Values.wordpressUsername | quote }} + - name: WORDPRESS_PASSWORD + valueFrom: + secretKeyRef: + name: {{ include "wordpress.fullname" . }} + key: wordpress-password + - name: WORDPRESS_EMAIL + value: {{ .Values.wordpressEmail | quote }} + - name: WORDPRESS_FIRST_NAME + value: {{ .Values.wordpressFirstName | quote }} + - name: WORDPRESS_LAST_NAME + value: {{ .Values.wordpressLastName | quote }} + - name: WORDPRESS_HTACCESS_OVERRIDE_NONE + value: {{ ternary "yes" "no" .Values.allowOverrideNone | quote }} + - name: WORDPRESS_HTACCESS_PERSISTENCE_ENABLED + value: {{ ternary "yes" "no" .Values.htaccessPersistenceEnabled | quote }} + - name: WORDPRESS_BLOG_NAME + value: {{ .Values.wordpressBlogName | quote }} + - name: WORDPRESS_SKIP_INSTALL + value: {{ ternary "yes" "no" .Values.wordpressSkipInstall | quote }} + - name: WORDPRESS_TABLE_PREFIX + value: {{ .Values.wordpressTablePrefix | quote }} + - name: WORDPRESS_SCHEME + value: {{ .Values.wordpressScheme | quote }} + {{- if .Values.smtpHost }} + - name: SMTP_HOST + value: {{ .Values.smtpHost | quote }} + {{- end }} + {{- if .Values.smtpPort }} + - name: SMTP_PORT + value: {{ .Values.smtpPort | quote }} + {{- end }} + {{- if .Values.smtpUser }} + - name: SMTP_USER + value: {{ .Values.smtpUser | quote }} + {{- end }} + {{- if .Values.smtpPassword }} + - name: SMTP_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "wordpress.fullname" . }} + key: smtp-password + {{- end }} + {{- if .Values.smtpUsername }} + - name: SMTP_USERNAME + value: {{ .Values.smtpUsername | quote }} + {{- end }} + {{- if .Values.smtpProtocol }} + - name: SMTP_PROTOCOL + value: {{ .Values.smtpProtocol | quote }} + {{- end }} + {{- if .Values.extraEnv }} + {{- include "wordpress.tplValue" (dict "value" .Values.extraEnv "context" $) | nindent 12 }} + {{- end }} + ports: + - name: http + containerPort: 8080 + - name: https + containerPort: 8443 + {{- if .Values.livenessProbe.enabled }} + livenessProbe: + initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.livenessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} + successThreshold: {{ .Values.livenessProbe.successThreshold }} + failureThreshold: {{ .Values.livenessProbe.failureThreshold }} + httpGet: + path: /wp-login.php + port: {{ ternary "https" "http" .Values.healthcheckHttps }} + {{- if .Values.healthcheckHttps }} + scheme: HTTPS + {{- end }} + {{- if .Values.livenessProbeHeaders }} + httpHeaders: {{- toYaml .Values.livenessProbeHeaders | nindent 16 }} + {{- end }} + {{- else if .Values.customLivenessProbe }} + livenessProbe: {{- include "wordpress.tplValue" (dict "value" .Values.customLivenessProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.readinessProbe.enabled }} + readinessProbe: + initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.readinessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} + successThreshold: {{ .Values.readinessProbe.successThreshold }} + failureThreshold: {{ .Values.readinessProbe.failureThreshold }} + httpGet: + path: /wp-login.php + port: {{ ternary "https" "http" .Values.healthcheckHttps }} + {{- if .Values.healthcheckHttps }} + scheme: HTTPS + {{- end }} + {{- if .Values.readinessProbeHeaders }} + httpHeaders: {{- toYaml .Values.readinessProbeHeaders | nindent 16 }} + {{- end }} + {{- else if .Values.customReadinessProbe }} + readinessProbe: {{- include "wordpress.tplValue" (dict "value" .Values.customReadinessProbe "context" $) | nindent 12 }} + {{- end }} + volumeMounts: + - mountPath: /bitnami/wordpress + name: wordpress-data + subPath: wordpress + {{- if and .Values.allowOverrideNone .Values.customHTAccessCM }} + - mountPath: /htaccess + name: custom-htaccess + {{- end }} + {{- if .Values.extraVolumeMounts }} + {{- include "wordpress.tplValue" (dict "value" .Values.extraVolumeMounts "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.resources }} + resources: {{- toYaml .Values.resources | nindent 12 }} + {{- end }} + {{- if .Values.metrics.enabled }} + - name: metrics + image: {{ template "wordpress.metrics.image" . }} + imagePullPolicy: {{ .Values.metrics.image.pullPolicy | quote }} + command: + - /bin/apache_exporter + - --scrape_uri + - http://status.localhost:8080/server-status/?auto + ports: + - name: metrics + containerPort: 9117 + livenessProbe: + httpGet: + path: /metrics + port: metrics + initialDelaySeconds: 15 + timeoutSeconds: 5 + readinessProbe: + httpGet: + path: /metrics + port: metrics + initialDelaySeconds: 5 + timeoutSeconds: 1 + {{- if .Values.metrics.resources }} + resources: {{- toYaml .Values.metrics.resources | nindent 12 }} + {{- end }} + {{- end }} + {{- if .Values.sidecars }} + {{- include "wordpress.tplValue" (dict "value" .Values.sidecars "context" $) | nindent 8 }} + {{- end }} + volumes: + {{- if and .Values.allowOverrideNone .Values.customHTAccessCM }} + - name: custom-htaccess + configMap: + name: {{ template "wordpress.customHTAccessCM" . }} + items: + - key: wordpress-htaccess.conf + path: wordpress-htaccess.conf + {{- end }} + - name: wordpress-data + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ .Values.persistence.existingClaim | default (include "wordpress.fullname" .) }} + {{- else }} + emptyDir: {} + {{ end }} + {{- if .Values.extraVolumes }} + {{- include "wordpress.tplValue" (dict "value" .Values.extraVolumes "context" $) | nindent 8 }} + {{- end }} From d1f4bfd9b8831f34b37631a5a1c72899d75240a4 Mon Sep 17 00:00:00 2001 From: joancafom Date: Fri, 5 Jun 2020 14:23:48 +0200 Subject: [PATCH 20/35] Fix linter identation issues in requirements --- bitnami/discourse/requirements.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/bitnami/discourse/requirements.yaml b/bitnami/discourse/requirements.yaml index fc9af04d5c308d..c975c181ad4506 100644 --- a/bitnami/discourse/requirements.yaml +++ b/bitnami/discourse/requirements.yaml @@ -1,9 +1,9 @@ dependencies: -- name: postgresql - repository: https://charts.bitnami.com/bitnami - version: 8.6.4 - condition: postgresql.enabled -- name: redis - repository: https://charts.bitnami.com/bitnami - version: 10.5.11 - condition: redis.enabled \ No newline at end of file + - name: postgresql + repository: https://charts.bitnami.com/bitnami + version: 8.6.4 + condition: postgresql.enabled + - name: redis + repository: https://charts.bitnami.com/bitnami + version: 10.5.11 + condition: redis.enabled From 55e92241ccb3bc0636d107f1c28d3e7462e9b61d Mon Sep 17 00:00:00 2001 From: joancafom Date: Wed, 17 Jun 2020 00:09:24 +0200 Subject: [PATCH 21/35] Integration of Sidekiq as sidecar This commit includes a lot of new features and refactoring: - Improved helper template functions to retrieve values of variables - Env. variables had been reduced to the actual used ones (i.e. PostgreSQL creation related env vars are not necessary due to the existance of the subchart) - Integration of both Discourse and Sidekiq containers into the same pod - Inclusion of PVC to persist values - Configurable liveness and readiness probes - Identation issues were fixed - NOTES.txt improved - NodeIP as the standard Service type and LoadBalancer for production - README with detailed explanation - Secrets purged to only use needed values - Values-production added - Other more general improvements --- bitnami/discourse/README.md | 289 +++++++++++- bitnami/discourse/requirements.yaml | 4 +- bitnami/discourse/templates/NOTES.txt | 103 +++-- bitnami/discourse/templates/_helpers.tpl | 138 +++++- bitnami/discourse/templates/configmaps.yaml | 29 +- .../templates/deployment-sidekiq.yaml | 95 ---- bitnami/discourse/templates/deployment.yaml | 168 +++++-- bitnami/discourse/templates/pvc.yaml | 14 + bitnami/discourse/templates/secrets.yaml | 29 +- .../templates/tests/test-connection.yaml | 14 - bitnami/discourse/test.yaml | 183 -------- bitnami/discourse/values-production.yaml | 432 ++++++++++++++++++ bitnami/discourse/values.yaml | 362 ++++++++++----- 13 files changed, 1336 insertions(+), 524 deletions(-) delete mode 100644 bitnami/discourse/templates/deployment-sidekiq.yaml create mode 100644 bitnami/discourse/templates/pvc.yaml delete mode 100644 bitnami/discourse/templates/tests/test-connection.yaml delete mode 100644 bitnami/discourse/test.yaml create mode 100644 bitnami/discourse/values-production.yaml diff --git a/bitnami/discourse/README.md b/bitnami/discourse/README.md index 57dd097da9433f..817bbf1cfb42c5 100644 --- a/bitnami/discourse/README.md +++ b/bitnami/discourse/README.md @@ -50,9 +50,142 @@ The command removes all the Kubernetes components associated with the chart and The following table lists the configurable parameters of the Discourse chart and their default values. -| Parameter | Description | Default | -| ---------------------------------- | ----------------------------------------------------- | ------------------------------------------------------------ | -**TBD after other patches get merged** + Parameter | Description | Default | +|-------------------------------------------|---------------------------------------------------------------------------------------|--------------------------------------------------------------| +| `global.imageRegistry` | Global Docker image registry | `nil` | +| `global.imagePullSecrets` | Global Docker registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) | +| `global.storageClass` | Global storage class for dynamic provisioning | `nil` | + +### Common parameters + +| Parameter | Description | Default | +|-------------------------------------------|---------------------------------------------------------------------------------------|--------------------------------------------------------------| +| `replicaCount` | Number of Discourse & Sidekiq replicas | `1` | +| `image.registry` | Discourse image registry | `docker.io` | +| `image.repository` | Discourse image name | `bitnami/discouse` | +| `image.tag` | Discourse image tag | `{TAG_NAME}` | +| `image.pullPolicy` | Discourse image pull policy | `IfNotPresent` | +| `imagePullSecrets` | Specify docker-registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) | +| `image.debug` | Specify if debug logs should be enabled | `false` | +| `nameOverride` | String to partially override discourse.fullname | `nil` | +| `fullnameOverride` | String to fully override discourse.fullname | `nil` | +| `sidecars` | Attach additional sidecar containers to the pod | `[]` (evaluated as a template) | +| `initContainers` | Additional init containers to add to the pods | `[]` (evaluated as a template) | +| `serviceAccount.create` | Whether the service account should be created | `false` | +| `serviceAccount.annotations` | Annotations to add to the service account | `false` | +| `serviceAccount.name` | Name to be used for the service account | `false` | +| `podSecurityContext` | Pod security context specification | `{}` | +| `persistence.enabled` | Whether to enable persistence based on Persistent Volume Claims | `true` | +| `persistence.storageClass` | PVC Storage Class | `nil` | +| `persistence.existingClaim` | Name of an existing PVC to reuse | `nil` | +| `persistence.accessMode` | PVC Access Mode (RWO, ROX, RWX) | `ReadWriteOnce` | +| `persistence.size` | Size of the PVC to request | `10Gi` | +| `nodeSelector` | Node labels for pod assignment. | `{}` (evaluated as a template) | +| `tolerations` | Tolerations for pod assignment. | `[]` (evaluated as a template) | +| `affinity` | Affinity for pod assignment | `{}` (evaluated as a template) | + +### Service parameters + +| Parameter | Description | Default | +|-------------------------------------------|---------------------------------------------------------------------------------------|--------------------------------------------------------------| +| `service.type` | Kubernetes Service type | `NodePort` | +| `service.port` | Service HTTP port | `80` | +| `service.externalTrafficPolicy` | Enable client source IP preservation | `Cluster` | +| `service.annotations` | Service annotations | `{}` (evaluated as a template) | +| `service.loadBalancerSourceRanges` | Restricts access for LoadBalancer (only with `service.type: LoadBalancer`) | `[]` | +| `service.extraPorts` | Extra ports to expose in the service (normally used with the `sidecar` value) | `nil` | +| `service.nodePorts.http` | Kubernetes http node port | `30000` | + +### Discourse parameters + +| Parameter | Description | Default | +|-------------------------------------------|---------------------------------------------------------------------------------------|--------------------------------------------------------------| +| `host` | Discourse host to create application URLs (include the port if =/= 80) | `""` | +| `siteName` | Discourse site name | `My Site!` | +| `username` | Admin user of the application | `user` | +| `email ` | Admin user email of the application | `user@example.com` | +| `password` | Application password (min length of 10 chars) | _random 10 character long alphanumeric string_ | +| `securityContext` | Container security context specification | `{}` | +| `resources` | Discourse container's resource requests and limits | `{}` | +| `livenessProbe.enabled` | Enable/disable livenessProbe | `true` | +| `livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | `500` | +| `livenessProbe.periodSeconds` | How often to perform the probe | `10` | +| `livenessProbe.timeoutSeconds` | When the probe times out | `5` | +| `livenessProbe.failureThreshold` | Minimum consecutive failures for the probe | `6` | +| `livenessProbe.successThreshold` | Minimum consecutive successes for the probe | `1` | +| `readinessProbe.enabled` | Enable/disable readinessProbe | `true` | +| `readinessProbe.initialDelaySeconds` | Delay before readiness probe is initiated | `30` | +| `readinessProbe.periodSeconds` | How often to perform the probe | `10` | +| `readinessProbe.timeoutSeconds` | When the probe times out | `5` | +| `readinessProbe.failureThreshold` | Minimum consecutive failures for the probe | `6` | +| `readinessProbe.successThreshold` | Minimum consecutive successes for the probe | `1` | +| `extraEnvVars` | An array to add extra env vars | `[]` | +| `extraEnvVarsCM` | Array to add extra configmaps | `[]` | +| `extraEnvVarsSecret` | Array to add extra environment from a Secret | `nil` | +| `skipInstall` | Do not run the Discourse installation wizard | `false` | + +### Sidekiq parameters + +| Parameter | Description | Default | +|-------------------------------------------|---------------------------------------------------------------------------------------|--------------------------------------------------------------| +| `securityContext` | Container security context specification | `{}` | +| `resources` | Discourse container's resource requests and limits | `{}` | +| `livenessProbe.enabled` | Enable/disable livenessProbe | `true` | +| `livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | `500` | +| `livenessProbe.periodSeconds` | How often to perform the probe | `10` | +| `livenessProbe.timeoutSeconds` | When the probe times out | `5` | +| `livenessProbe.failureThreshold` | Minimum consecutive failures for the probe | `6` | +| `livenessProbe.successThreshold` | Minimum consecutive successes for the probe | `1` | +| `readinessProbe.enabled` | Enable/disable readinessProbe | `true` | +| `readinessProbe.initialDelaySeconds` | Delay before readiness probe is initiated | `30` | +| `readinessProbe.periodSeconds` | How often to perform the probe | `10` | +| `readinessProbe.timeoutSeconds` | When the probe times out | `5` | +| `readinessProbe.failureThreshold` | Minimum consecutive failures for the probe | `6` | +| `readinessProbe.successThreshold` | Minimum consecutive successes for the probe | `1` | +| `extraEnvVars` | An array to add extra env vars | `[]` | +| `extraEnvVarsCM` | Array to add extra configmaps | `[]` | +| `extraEnvVarsSecret` | Array to add extra environment from a Secret | `nil` | + +### Ingress parameters + +| Parameter | Description | Default | +|-------------------------------------------|---------------------------------------------------------------------------------------|--------------------------------------------------------------| +| `ingress.enabled` | Enable ingress controller resource | `false` | +| `ingress.certManager` | Add annotations for cert-manager | `false` | +| `ingress.hostname` | Default host for the ingress resource | `discourse.local` | +| `ingress.annotations` | Ingress annotations | `[]` (evaluated as a template) | +| `ingress.extraHosts[0].name` | Additional hostnames to be covered | `nil` | +| `ingress.extraHosts[0].path` | Additional hostnames to be covered | `nil` | + +### Database parameters + +| Parameter | Description | Default | +|-------------------------------------------|---------------------------------------------------------------------------------------|--------------------------------------------------------------| +| `postgresql.enabled` | Deploy PostgreSQL container(s) | `true` | +| `postgresql.postgresqlUsername` | PostgreSQL user to create (used by Discourse) | `bn_discourse` | +| `postgresql.postgresqlPassword` | Password for the Dicourse user | _random 10 character long alphanumeric string_ | +| `postgresql.postgresqlPostgresPassword` | Password for the admin user ("postgres") | `bitnami` | +| `postgresql.postgresqlDatabase` | Name of the database to create | `bitnami_application` | +| `postgresql.persistence.enabled` | Enable database persistence using PVC | `true` | +| `externalDatabase.host` | Host of the external database | `""` | +| `externalDatabase.port` | Database port number | `5432` | +| `externalDatabase.user` | Existing username in the external db | `bn_discourse` | +| `externalDatabase.password` | Password for the above username | `nil` | +| `externalDatabase.postgresqlPostgresPassword`| Password for the root "postgres" user | `nil` | +| `externalDatabase.database` | Name of the existing database | `bitnami_application` | + +### Redis parameters + +| Parameter | Description | Default | +|-------------------------------------------|---------------------------------------------------------------------------------------|--------------------------------------------------------------| +| `redis.enabled` | Deploy Redis container(s) | `true` | +| `redis.usePassword` | Use password authentication | `false` | +| `redis.password` | Password for Redis authentication | `nil` | +| `redis.cluster.enabled` | Whether to use cluster replication | `false` | +| `redis.master.persistence.enabled` | Enable database persistence using PVC | `true` | +| `externalRedis.host` | Host of the external database | `""` | +| `externalRedis.port` | Database port number | `6379` | +| `externalRedis.password` | Password for the above username | `nil` | The above parameters map to the env variables defined in [bitnami/discourse](http://github.com/bitnami/bitnami-docker-discourse). For more information please refer to the [bitnami/discourse](http://github.com/bitnami/bitnami-docker-discourse) image documentation. @@ -60,11 +193,11 @@ Specify each parameter using the `--set key=value[,key=value]` argument to `helm ```console $ helm install my-release \ - --set discourseUsername=admin,discoursePassword=password,mariadb.mariadbRootPassword=secretpassword \ + --set discourse.username=admin,discourse.password=password,postgresql.postgresqlPassword=secretpassword \ bitnami/discourse ``` -The above command sets the Discourse administrator account username and password to `admin` and `password` respectively. Additionally, it sets the MariaDB `root` user password to `secretpassword`. +The above command sets the Discourse administrator account username and password to `admin` and `password` respectively. Additionally, it sets the Postgresql `bn_discourse` user password to `secretpassword`. Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example, @@ -82,17 +215,151 @@ It is strongly recommended to use immutable tags in a production environment. Th Bitnami will release a new chart updating its containers if a new version of the main container, significant changes, or critical vulnerabilities exist. -### Local development and binding to port 80 +### Setting up replication -Discourse is pretty insistent on giving access via port 80 or 443. -This is fine if you're hosting it on a public cluster, but it's not while testing the chart locally. -The easiest [but horribly insecure] way to do it is to simply allow kubectl to bind to privileged ports and then use a `port-forward`: +By default, this Chart only deploys a single pod running Discourse. Should you want to increase the number of replicas, you may follow these simple steps to ensure everything works smoothly: +> **Tip**: Running these steps ensures the PostgreSQL instance to be correctly populated. If you already have an initialised DB, you may directly create a release with the desired number of replicas. Remind to set `discourse.skipInstall` to `true`! + +1. Create a conventional release, that will be scaled later: +```console +$ helm install my-release bitnami/discourse +... +export APP_PASSWORD=$(kubectl get secret --namespace default my-release-discourse -o jsonpath="{.data.discourse-password}" | base64 --decode) +export APP_DATABASE_PASSWORD=$(kubectl get secret --namespace default my-release-postgresql -o jsonpath="{.data.postgresql-password}" | base64 --decode) +... +``` + +2. Wait for the release to complete and Discourse to be running successfully. +```console +$ kubectl get pods +NAME READY STATUS RESTARTS AGE +my-release-discourse-744c48dd97-wx5h9 2/2 Running 0 5m11s +my-release-postgresql-0 1/1 Running 0 5m10s +my-release-redis-master-0 1/1 Running 0 5m11s +``` + +3. Perform an upgrade specifying the number of replicas and the credentials used. ```console -sudo setcap CAP_NET_BIND_SERVICE=+eip $(which kubectl) -kubectl portforward svc/discourse 80:3000 +$ helm upgrade my-release --set replicaCount=2,discourse.password=$APP_PASSWORD,postgresql.postgresqlPassword=$APP_DATABASE_PASSWORD,discourse.skipInstall=true bitnami/discourse +``` + +Note that for this to work properly, you need to provide ReadWriteMany PVCs. If you don't have a provisioner for this type of storage, we recommend that you install the NFS provisioner chart (with the correct parameters, such as `persistence.enabled=true` and `persistence.size=10Gi`) and map it to a RWO volume. + +Then you can deploy Discourse chart using the proper parameters: + +```console +persistence.storageClass=nfs +postgresql.persistence.storageClass=nfs +``` + +### Production configuration + +This chart includes a `values-production.yaml` file where you can find some parameters oriented to production configuration in comparison to the regular `values.yaml`. You can use this file instead of the default one. + +- Use LoadBalancer as default: + +```diff +- service.type: NodePort ++ service.type: LoadBalancer +``` + +- Enable client source IP preservation: + +```diff +- service.externalTrafficPolicy: Cluster ++ service.externalTrafficPolicy: Local ``` +- Make Redis use password for auth: + +```diff +- redis.usePassword: false ++ redis.usePassword: true +``` + +- PVC Access Mode: + +```diff +- persistence.accessMode: ReadWriteOnce ++ ## To use the portal and to ensure you can scale Discourse you need to provide a ++ ## ReadWriteMany PVC, if you dont have a provisioner for this type of storage ++ ## We recommend that you install the nfs provisioner and map it to a RWO volume ++ ## helm install nfs-server stable/nfs-server-provisioner --set persistence.enabled=true,persistence.size=10Gi ++ ## ++ persistence.accessMode: ReadWriteMany +``` +Note that [values-production.yaml](values-production.yaml) specifies ReadWriteMany PVCs are specified. This is intended to ease the process of replication (see [Setting up replication](#setting-up-replication)). + +### Sidecars + +If you have a need for additional containers to run within the same pod as Discourse (e.g. an additional metrics or logging exporter), you can do so via the `sidecars` config parameter. Simply define your container according to the Kubernetes container spec. + +```yaml +sidecars: +- name: your-image-name + image: your-image + imagePullPolicy: Always + ports: + - name: portname + containerPort: 1234 +``` + +If these sidecars export extra ports, you can add extra port definitions using the `service.extraPorts` value: + +```yaml +service: +... + extraPorts: + - name: extraPort + port: 11311 + targetPort: 11311 +``` + +### Using an external database + +Sometimes you may want to have Discourse connect to an external database rather than installing one inside your cluster, e.g. to use a managed database service, or use run a single database server for all your applications. To do this, the chart allows you to specify credentials for an external database under the [`externalDatabase` parameter](#parameters). You should also disable the PostgreSQL installation with the `postgresql.enabled` option. For example with the following parameters: + +```console +postgresql.enabled=false +externalDatabase.host=myexternalhost +externalDatabase.user=myuser +externalDatabase.password=mypassword +externalDatabase.postgresqlPostgresPassword=rootpassword +externalDatabase.database=mydatabase +externalDatabase.port=5432 +``` + +Note also if you disable PostgreSQL per above you MUST supply values for the `externalDatabase` connection. + +In case the database already contains data from a previous Discourse installation, you need to set the `discourse.skipInstall` parameter to _true_. Otherwise, the container would execute the installation wizard and could modify the existing data in the database. This parameter force the container to not execute the Discourse installation wizard. + +Similarly, you can specify an external Redis instance rather than installing one inside your cluster. First, you may disable the Redis installation with the `redis.enabled` option. As aforementioned, used the provided parameters to provide data about your instance: + +```console +redis.enabled=false +externalRedis.host=myexternalhost +externalRedis.password=mypassword +externalRedis.port=5432 +``` + +### Ingress + +This chart provides support for ingress resources. If you have an ingress controller installed on your cluster, such as [nginx-ingress](https://kubeapps.com/charts/stable/nginx-ingress) or [traefik](https://kubeapps.com/charts/stable/traefik) you can utilize the ingress controller to serve your Discourse application. + +To enable ingress integration, please set `ingress.enabled` to `true` + +### Hosts + +Most likely you will only want to have one hostname that maps to this WordPress installation. If that's your case, the property `ingress.hostname` will set it. However, it is possible to have more than one host. To facilitate this, the `ingress.extraHosts` object is can be specified as an array. + +## Persistence + +The [Bitnami Discourse](https://github.com/bitnami/bitnami-docker-discourse) image stores the Discourse data and configurations at the `/bitnami` path of the container. + +Persistent Volume Claims are used to keep the data across deployments. This is known to work in GCE, AWS, and minikube. +See the [Parameters](#parameters) section to configure the PVC or to disable persistence. + ### Image The `image` parameter allows specifying which image will be pulled for the chart. diff --git a/bitnami/discourse/requirements.yaml b/bitnami/discourse/requirements.yaml index c975c181ad4506..a585b5dd5fc82a 100644 --- a/bitnami/discourse/requirements.yaml +++ b/bitnami/discourse/requirements.yaml @@ -1,9 +1,9 @@ dependencies: - name: postgresql repository: https://charts.bitnami.com/bitnami - version: 8.6.4 + version: 8.X.X condition: postgresql.enabled - name: redis repository: https://charts.bitnami.com/bitnami - version: 10.5.11 + version: 10.X.X condition: redis.enabled diff --git a/bitnami/discourse/templates/NOTES.txt b/bitnami/discourse/templates/NOTES.txt index 6d6f36e47c6f22..0ecc89e689221d 100644 --- a/bitnami/discourse/templates/NOTES.txt +++ b/bitnami/discourse/templates/NOTES.txt @@ -1,4 +1,4 @@ -{{- if and (include "discourse.host" .) (.Values.postgresql.enabled) -}} +{{- if or .Values.postgresql.enabled .Values.externalDatabase.host -}} {{- if empty (include "discourse.host" .) -}} ############################################################################### @@ -10,58 +10,79 @@ This deployment will be incomplete until you configure Discourse with a resolvab 1. Get the discourse URL by running: {{- if contains "NodePort" .Values.service.type }} - - export APP_PORT=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "discourse.fullname" . }} -o jsonpath="{.spec.ports[0].nodePort}") - export APP_HOST=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") - + export APP_HOST=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}"):$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "discourse.fullname" . }} -o jsonpath="{.spec.ports[0].nodePort}") {{- else if contains "LoadBalancer" .Values.service.type }} - NOTE: It may take a few minutes for the LoadBalancer IP to be available. Watch the status with: 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "discourse.fullname" . }}' export APP_HOST=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "discourse.fullname" . }} --template "{{ "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}" }}") - export APP_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "discourse.fullname" . }} -o jsonpath="{.data.discourse-password}" | base64 --decode) - {{- if .Values.postgresql.postgresqlPostgresPassword }} - export DATABASE_ROOT_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "discourse.postgresql.fullname" . }} -o jsonpath="{.data.postgresql-postgresql-postgres-password}" | base64 --decode) {{- end }} + export APP_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "discourse.fullname" . }} -o jsonpath="{.data.discourse-password}" | base64 --decode) + export APP_DATABASE_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ include "discourse.databaseSecretName" . }} -o jsonpath="{.data.postgresql-password}" | base64 --decode) + {{- if or (and .Values.redis.enabled .Values.redis.usePassword) (and (not .Values.redis.enabled) (not (empty .Values.externalRedis.password))) }} + export APP_REDIS_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ include "discourse.redisSecretName" . }} -o jsonpath="{.data.redis-password}" | base64 --decode) {{- end }} - export APP_DATABASE_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "discourse.postgresql.fullname" . }} -o jsonpath="{.data.postgresql-postgresql-password}" | base64 --decode) - 2. Complete your Discourse deployment by running: {{- if .Values.postgresql.enabled }} helm upgrade {{ .Release.Name }} bitnami/{{ .Chart.Name }} \ - --set discourseHost=$APP_HOST,discoursePassword=$APP_PASSWORD{{ if .Values.postgresql.postgresqlPostgresPassword }},postgresql.postgresqlPostgresPassword=$DATABASE_ROOT_PASSWORD{{ end }},postgresql.postgresqlPassword=$APP_DATABASE_PASSWORD{{- if .Values.global }}{{- if .Values.global.imagePullSecrets }},global.imagePullSecrets={{ .Values.global.imagePullSecrets }}{{- end }}{{- end }} + --set discourse.host=$APP_HOST \ + --set discourse.password=$APP_PASSWORD \ + {{- if .Values.global }}{{- if .Values.global.imagePullSecrets }} + --set global.imagePullSecrets={{ .Values.global.imagePullSecrets }} \ + {{- end }}{{- end }} + {{- if (and .Values.redis.enabled .Values.redis.usePassword) }} + --set redis.password=$APP_REDIS_PASSWORD \ + {{- else if and (not .Values.redis.enabled) (not (empty .Values.externalRedis.password)) }} + --set redis.externalRedis=$APP_REDIS_PASSWORD \ + --set redis.enabled=false \ + {{- end }} + --set postgresql.postgresqlPassword=$APP_DATABASE_PASSWORD + {{- else }} ## PLEASE UPDATE THE EXTERNAL DATABASE CONNECTION PARAMETERS IN THE FOLLOWING COMMAND AS NEEDED ## helm upgrade {{ .Release.Name }} bitnami/{{ .Chart.Name }} \ - --set discoursePassword=$APP_PASSWORD,discourseHost=$APP_HOST,service.type={{ .Values.service.type }},postgresql.enabled=false{{- if not (empty .Values.externalDatabase.host) }},externalDatabase.host={{ .Values.externalDatabase.host }}{{- end }}{{- if not (empty .Values.externalDatabase.user) }},externalDatabase.user={{ .Values.externalDatabase.user }}{{- end }}{{- if not (empty .Values.externalDatabase.password) }},externalDatabase.password={{ .Values.externalDatabase.password }}{{- end }}{{- if not (empty .Values.externalDatabase.database) }},externalDatabase.database={{ .Values.externalDatabase.database }}{{- end }}{{- if .Values.global }}{{- if .Values.global.imagePullSecrets }},global.imagePullSecrets={{ .Values.global.imagePullSecrets }}{{- end }}{{- end }} + --set discourse.host=$APP_HOST \ + --set discourse.password=$APP_PASSWORD \ + --set service.type={{ .Values.service.type }} \ + --set externalDatabase.host={{ .Values.externalDatabase.host }} \ + --set externalDatabase.port={{ .Values.externalDatabase.port }} \ + --set externalDatabase.user={{ .Values.externalDatabase.user }} \ + --set externalDatabase.password=$APP_DATABASE_PASSWORD \ + --set externalDatabase.database={{ .Values.externalDatabase.database }} \ + {{- if .Values.global }}{{- if .Values.global.imagePullSecrets }} + --set global.imagePullSecrets={{ .Values.global.imagePullSecrets }} \ + {{- end }}{{- end }} + {{- if (and .Values.redis.enabled .Values.redis.usePassword) }} + --set redis.password=$APP_REDIS_PASSWORD \ + {{- else if and (not .Values.redis.enabled) (not (empty .Values.externalRedis.password)) }} + --set redis.externalRedis=$APP_REDIS_PASSWORD \ + --set redis.enabled=false \ + {{- end }} + --set postgresql.enabled=false {{- end }} {{- else -}} -1. Get the Discourse URL by running: -{{- if eq .Values.service.type "ClusterIP" }} - - echo "Store URL: http://127.0.0.1:8080/" - echo "Admin URL: http://127.0.0.1:8080/{{ .Values.discourseAdminUri }}" - kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ template "discourse.fullname" . }} 8080:{{ .Values.service.port }} - -{{- else }} +1. Get the Discourse URL by running: -{{- $port:=.Values.service.port | toString }} - echo Store URL : http://{{ include "discourse.host" . }}{{- if ne $port "80" }}:{{ .Values.service.port }}{{ end }}/ - echo Admin URL : http://{{ include "discourse.host" . }}{{- if ne $port "80" }}:{{ .Values.service.port }}{{ end }}/{{ .Values.discourseAdminUri }} + Discourse URL : http://{{ include "discourse.host" . }}/ +{{- if eq .Values.service.type "ClusterIP" }} + kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ template "discourse.fullname" . }} 80:{{ .Values.service.port }} {{- end }} 2. Get your Discourse login credentials by running: - echo Username: {{ .Values.discourseUsername }} - echo Password: $(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "discourse.fullname" . }} -o jsonpath="{.data.discourse-password}" | base64 --decode) + Username: {{ .Values.discourse.username }} + export APP_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "discourse.fullname" . }} -o jsonpath="{.data.discourse-password}" | base64 --decode) + export APP_DATABASE_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ include "discourse.databaseSecretName" . }} -o jsonpath="{.data.postgresql-password}" | base64 --decode) + {{- if or (and .Values.redis.enabled .Values.redis.usePassword) (and (not .Values.redis.enabled) (not (empty .Values.externalRedis.password))) }} + export APP_REDIS_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ include "discourse.redisSecretName" . }} -o jsonpath="{.data.redis-password}" | base64 --decode) + {{- end }} {{- end }} {{- else -}} @@ -75,7 +96,7 @@ This deployment will be incomplete until you configure Discourse with a resolvab 1. Complete your Discourse deployment by running: {{- if contains "NodePort" .Values.service.type }} - export APP_HOST=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + export APP_HOST=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}"):$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "discourse.fullname" . }} -o jsonpath="{.spec.ports[0].nodePort}") {{- else if contains "LoadBalancer" .Values.service.type }} NOTE: It may take a few minutes for the LoadBalancer IP to be available. @@ -87,11 +108,37 @@ This deployment will be incomplete until you configure Discourse with a resolvab export APP_HOST=127.0.0.1 {{- end }} export APP_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "discourse.fullname" . }} -o jsonpath="{.data.discourse-password}" | base64 --decode) + export APP_DATABASE_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ include "discourse.databaseSecretName" . }} -o jsonpath="{.data.postgresql-password}" | base64 --decode) + {{- if or (and .Values.redis.enabled .Values.redis.usePassword) (and (not .Values.redis.enabled) (not (empty .Values.externalRedis.password))) }} + export APP_REDIS_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ include "discourse.redisSecretName" . }} -o jsonpath="{.data.redis-password}" | base64 --decode) + {{- end }} ## PLEASE UPDATE THE EXTERNAL DATABASE CONNECTION PARAMETERS IN THE FOLLOWING COMMAND AS NEEDED ## helm upgrade {{ .Release.Name }} bitnami/{{ .Chart.Name }} \ - --set discoursePassword=$APP_PASSWORD,discourseHost=$APP_HOST,service.type={{ .Values.service.type }},postgresql.enabled=false{{- if not (empty .Values.externalDatabase.user) }},externalDatabase.user={{ .Values.externalDatabase.user }}{{- end }}{{- if not (empty .Values.externalDatabase.password) }},externalDatabase.password={{ .Values.externalDatabase.password }}{{- end }}{{- if not (empty .Values.externalDatabase.database) }},externalDatabase.database={{ .Values.externalDatabase.database }}{{- end }},externalDatabase.host=YOUR_EXTERNAL_DATABASE_HOST{{- if .Values.global }}{{- if .Values.global.imagePullSecrets }},global.imagePullSecrets={{ .Values.global.imagePullSecrets }}{{- end }}{{- end }} + --set discourse.host=$APP_HOST \ + --set discourse.password=$APP_PASSWORD \ + --set postgresql.enabled=false \ + {{- if not (empty .Values.externalDatabase.user) }} + --set externalDatabase.user={{ .Values.externalDatabase.user }} \ + {{- end }} + {{- if not (empty .Values.externalDatabase.password) }} + --set externalDatabase.password=$APP_DATABASE_PASSWORD \ + {{- end }} + {{- if not (empty .Values.externalDatabase.database) }} + --set externalDatabase.database={{ .Values.externalDatabase.database }} + {{- end }} + --set externalDatabase.host=YOUR_EXTERNAL_DATABASE_HOST \ + {{- if .Values.global }}{{- if .Values.global.imagePullSecrets }} + --set global.imagePullSecrets={{ .Values.global.imagePullSecrets }} \ + {{- end }}{{- end }} + {{- if (and .Values.redis.enabled .Values.redis.usePassword) }} + --set redis.password=$APP_REDIS_PASSWORD \ + {{- else if and (not .Values.redis.enabled) (not (empty .Values.externalRedis.password)) }} + --set redis.externalRedis=$APP_REDIS_PASSWORD \ + --set redis.enabled=false \ + {{- end }} + --set service.type={{ .Values.service.type }} {{- end }} {{- if and (contains "bitnami/" .Values.image.repository) (not (.Values.image.tag | regexFind "-r\\d+$")) }} diff --git a/bitnami/discourse/templates/_helpers.tpl b/bitnami/discourse/templates/_helpers.tpl index 438b46e6be27ce..36fbeaa032b01c 100644 --- a/bitnami/discourse/templates/_helpers.tpl +++ b/bitnami/discourse/templates/_helpers.tpl @@ -1,4 +1,3 @@ -{{/* vim: set filetype=mustache: */}} {{/* Expand the name of the chart. */}} @@ -10,10 +9,18 @@ Expand the name of the chart. Create a default fully qualified app name. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). */}} -{{- define "discourse.postgresql.fullname" -}} +{{- define "postgresql.fullname" -}} {{- printf "%s-%s" .Release.Name "postgresql" | trunc 63 | trimSuffix "-" -}} {{- end -}} +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "redis.fullname" -}} +{{- printf "%s-%s" .Release.Name "redis" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + {{/* Create a default fully qualified app name. We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). @@ -52,7 +59,7 @@ app.kubernetes.io/managed-by: {{ .Release.Service }} {{- end -}} {{/* -Selector labels +Match labels */}} {{- define "discourse.matchLabels" -}} app.kubernetes.io/name: {{ include "discourse.name" . }} @@ -129,7 +136,7 @@ Gets the host to be used for this application. If not using ClusterIP, or if a host or LoadBalancerIP is not defined, the value will be empty. */}} {{- define "discourse.host" -}} -{{- $host := index .Values (printf "%sHost" .Chart.Name) | default "" -}} +{{- $host := .Values.discourse.host | default "" -}} {{- default (include "discourse.serviceIP" .) $host -}} {{- end -}} @@ -155,3 +162,126 @@ Also, we can't use a single if because lazy evaluation is not an option {{- printf "%s/%s:%s" $registryName $repositoryName $tag -}} {{- end -}} {{- end -}} + +{{/* +Return the proper Storage Class +*/}} +{{- define "discourse.storageClass" -}} +{{/* +Helm 2.11 supports the assignment of a value to a variable defined in a different scope, +but Helm 2.9 and 2.10 does not support it, so we need to implement this if-else logic. +*/}} +{{- if .Values.global -}} + {{- if .Values.global.storageClass -}} + {{- if (eq "-" .Values.global.storageClass) -}} + {{- printf "storageClassName: \"\"" -}} + {{- else }} + {{- printf "storageClassName: %s" .Values.global.storageClass -}} + {{- end -}} + {{- else -}} + {{- if .Values.persistence.storageClass -}} + {{- if (eq "-" .Values.persistence.storageClass) -}} + {{- printf "storageClassName: \"\"" -}} + {{- else }} + {{- printf "storageClassName: %s" .Values.persistence.storageClass -}} + {{- end -}} + {{- end -}} + {{- end -}} +{{- else -}} + {{- if .Values.persistence.storageClass -}} + {{- if (eq "-" .Values.persistence.storageClass) -}} + {{- printf "storageClassName: \"\"" -}} + {{- else }} + {{- printf "storageClassName: %s" .Values.persistence.storageClass -}} + {{- end -}} + {{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Return the PostgreSQL Hostname +*/}} +{{- define "discourse.databaseHost" -}} +{{- if .Values.postgresql.enabled }} + {{- printf "%s" (include "postgresql.fullname" .) -}} +{{- else -}} + {{- printf "%s" .Values.externalDatabase.host -}} +{{- end -}} +{{- end -}} + +{{/* +Return the PostgreSQL Port +*/}} +{{- define "discourse.databasePort" -}} +{{- if .Values.postgresql.enabled }} + {{- printf "5432" | quote -}} +{{- else -}} + {{- printf "%d" (.Values.externalDatabase.port | quote ) -}} +{{- end -}} +{{- end -}} + +{{/* +Return the PostgreSQL Database Name +*/}} +{{- define "discourse.databaseName" -}} +{{- if .Values.postgresql.enabled }} + {{- printf "%s" .Values.postgresql.postgresqlDatabase -}} +{{- else -}} + {{- printf "%s" .Values.externalDatabase.database -}} +{{- end -}} +{{- end -}} + +{{/* +Return the PostgreSQL User +*/}} +{{- define "discourse.databaseUser" -}} +{{- if .Values.postgresql.enabled }} + {{- printf "%s" .Values.postgresql.postgresqlUsername -}} +{{- else -}} + {{- printf "%s" .Values.externalDatabase.user -}} +{{- end -}} +{{- end -}} + +{{/* +Return the PostgreSQL Secret +*/}} +{{- define "discourse.databaseSecretName" -}} +{{- if .Values.postgresql.enabled }} + {{- printf "%s" (include "postgresql.fullname" .) -}} +{{- else -}} + {{- printf "%s" (include "discourse.fullname" .) -}} +{{- end -}} +{{- end -}} + +{{/* +Return the Redis Hostname +*/}} +{{- define "discourse.redisHost" -}} +{{- if .Values.redis.enabled }} + {{- printf "%s-master" (include "redis.fullname" .) -}} +{{- else -}} + {{- printf "%s" .Values.externalRedis.host -}} +{{- end -}} +{{- end -}} + +{{/* +Return the Redis Port +*/}} +{{- define "discourse.redisPort" -}} +{{- if .Values.redis.enabled }} + {{- printf "6379" | quote -}} +{{- else -}} + {{- printf "%d" (.Values.externalRedis.port | quote ) -}} +{{- end -}} +{{- end -}} + +{{/* +Return the Redis Secret +*/}} +{{- define "discourse.redisSecretName" -}} +{{- if .Values.redis.enabled }} + {{- printf "%s" (include "redis.fullname" .) -}} +{{- else -}} + {{- printf "%s" (include "discourse.fullname" .) -}} +{{- end -}} +{{- end -}} diff --git a/bitnami/discourse/templates/configmaps.yaml b/bitnami/discourse/templates/configmaps.yaml index 050d778e89d83a..8be97084b6625c 100644 --- a/bitnami/discourse/templates/configmaps.yaml +++ b/bitnami/discourse/templates/configmaps.yaml @@ -4,24 +4,17 @@ metadata: name: {{ template "discourse.fullname" . }} labels: {{- include "discourse.labels" . | nindent 4 }} data: - DISCOURSE_HOSTNAME: {{ .Values.discourseHost }} - DISCOURSE_USERNAME: {{ .Values.discourseUsername }} - DISCOURSE_EMAIL: {{ .Values.discourseEmail }} - DISCOURSE_SITENAME: {{ .Values.sitename }} - {{- if .Values.postgresql.enabled }} - POSTGRESQL_HOST: {{ template "discourse.postgresql.fullname" . }} + DISCOURSE_HOSTNAME: {{ .Values.discourse.host | quote }} + DISCOURSE_USERNAME: {{ .Values.discourse.username | quote }} + DISCOURSE_EMAIL: {{ .Values.discourse.email | quote }} + DISCOURSE_SITENAME: {{ .Values.discourse.siteName | quote }} + REDIS_HOST: {{ template "discourse.redisHost" . }} + REDIS_PORT_NUMBER: {{ template "discourse.redisPort" . }} + POSTGRESQL_HOST: {{ template "discourse.databaseHost" . }} + POSTGRESQL_PORT_NUMBER: {{ template "discourse.databasePort" . }} + DISCOURSE_POSTGRESQL_NAME: {{ template "discourse.databaseName" . }} + DISCOURSE_POSTGRESQL_USERNAME: {{ template "discourse.databaseUser" . }} POSTGRESQL_ROOT_USER: "postgres" - POSTGRESQL_CLIENT_CREATE_DATABASE_NAME: {{ .Values.postgresql.postgresqlDatabase }} - POSTGRESQL_CLIENT_CREATE_DATABASE_USERNAME: {{ .Values.postgresql.postgresqlUsername }} - DISCOURSE_POSTGRESQL_NAME: {{ .Values.postgresql.postgresqlDatabase }} - DISCOURSE_POSTGRESQL_USERNAME: {{ .Values.postgresql.postgresqlUsername }} - {{- else }} - POSTGRESQL_HOST: {{ .Values.externalDatabase.host | quote }} - DISCOURSE_POSTGRESQL_NAME: {{ .Values.externalDatabase.database }} - DISCOURSE_POSTGRESQL_USERNAME: {{ .Values.externalDatabase.user }} - {{- end }} - REDIS_HOST: {{ include "discourse.fullname" . }}-redis-master - REDIS_PORT_NUMBER: "6379" - {{- if .Release.IsUpgrade }} + {{- if .Values.discourse.skipInstall }} DISCOURSE_SKIP_INSTALL: "yes" {{- end }} diff --git a/bitnami/discourse/templates/deployment-sidekiq.yaml b/bitnami/discourse/templates/deployment-sidekiq.yaml deleted file mode 100644 index 2a5992be2cd100..00000000000000 --- a/bitnami/discourse/templates/deployment-sidekiq.yaml +++ /dev/null @@ -1,95 +0,0 @@ -{{- if and (include "discourse.host" .) (or .Values.postgresql.enabled .Values.externalDatabase.host) -}} -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "discourse.fullname" . }}-sidekiq - labels: - {{- include "discourse.labels" . | nindent 4 }} - app.kubernetes.io/component: sidekiq -spec: - replicas: {{ .Values.replicaCount.sidekiq }} - selector: - matchLabels: {{- include "discourse.selectorLabels" . | nindent 6 }} - component: sidekiq - template: - metadata: - labels: {{- include "discourse.selectorLabels" . | nindent 8 }} - component: sidekiq - spec: - {{- include "discourse.imagePullSecrets" . | indent 6 }} - serviceAccountName: {{ include "discourse.serviceAccountName" . }} - securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} - containers: - - name: sidekiq - securityContext: {{- toYaml .Values.containerSecurityContext | nindent 12 }} - image: {{ template "discourse.image" . }} - imagePullPolicy: {{ .Values.image.pullPolicy | quote }} - command: ["/app-entrypoint.sh"] - args: - - nami - - start - - --foreground - - discourse-sidekiq - env: - - name: DISCOURSE_HOST - value: {{ include "discourse.fullname" . }} - - name: DISCOURSE_PORT - value: "3000" - - name: DISCOURSE_PASSWORD - valueFrom: - secretKeyRef: - name: {{ include "discourse.fullname" . }} - key: discourse-password - - name: DISCOURSE_POSTGRESQL_PASSWORD - valueFrom: - secretKeyRef: - name: {{ include "discourse.fullname" . }} - key: discourse-postgresql-password - {{- if .Values.postgresql.enabled }} - - name: POSTGRESQL_CLIENT_CREATE_DATABASE_PASSWORD - valueFrom: - secretKeyRef: - name: {{ include "discourse.fullname" . }} - key: postgresql-client-create-database-password - {{- end }} - - name: REDIS_PASSWORD - valueFrom: - secretKeyRef: - name: {{ include "discourse.fullname" . }} - key: redis-password - - configMapRef: - name: {{ include "discourse.fullname" . }} - {{- if .Values.extraEnvVars.discourse }} - {{- tpl (toYaml .Values.extraEnvVars.discourse) $ | indent 12 }} - {{- end }} - {{- if or .Values.extraEnvVarsCM.discourse .Values.extraEnvVarsSecret.discourse }} - envFrom: - {{- if .Values.extraEnvVarsCM.discourse }} - - configMapRef: - name: {{ .Values.extraEnvVarsCM.discourse }} - {{- end }} - {{- if .Values.extraEnvVarsSecret.discourse }} - - secretRef: - name: {{ .Values.extraEnvVarsSecret.discourse }} - {{- end }} - {{- end }} - # livenessProbe: - # httpGet: - # path: / - # port: http - readinessProbe: - exec: - command: [nami status discourse-sidekiqa] - initialDelaySeconds: 60 - periodSeconds: 60 - resources: {{- toYaml .Values.resources | nindent 12 }} - {{- with .Values.nodeSelector }} - nodeSelector: {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.affinity }} - affinity: {{- toYaml . | nindent 8 }} - {{- end }} - {{- with .Values.tolerations }} - tolerations: {{- toYaml . | nindent 8 }} - {{- end }} -{{- end -}} diff --git a/bitnami/discourse/templates/deployment.yaml b/bitnami/discourse/templates/deployment.yaml index 7391bfadd1f850..ab99f4b353102d 100644 --- a/bitnami/discourse/templates/deployment.yaml +++ b/bitnami/discourse/templates/deployment.yaml @@ -6,18 +6,19 @@ metadata: labels: {{- include "discourse.labels" . | nindent 4 }} component: discourse spec: - replicas: {{ .Values.replicaCount.discourse }} + replicas: {{ .Values.replicaCount }} selector: - matchLabels: {{- include "discourse.selectorLabels" . | nindent 6 }} + matchLabels: {{- include "discourse.matchLabels" . | nindent 6 }} component: discourse template: metadata: annotations: - checksum/config: {{ include (print $.Template.BasePath "/configmap-envs.yaml") . | sha256sum }} - checksum/secret: {{ include (print $.Template.BasePath "/secret-envs.yaml") . | sha256sum }} - labels: {{- include "discourse.selectorLabels" . | nindent 8 }} + checksum/config: {{ include (print $.Template.BasePath "/configmaps.yaml") . | sha256sum }} + checksum/secret: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }} + labels: {{- include "discourse.labels" . | nindent 8 }} component: discourse - spec: {{- include "discourse.imagePullSecrets" . | nindent 6 }} + spec: + {{- include "discourse.imagePullSecrets" . | indent 6 }} serviceAccountName: {{ include "discourse.serviceAccountName" . }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} {{- if .Values.initContainers }} @@ -25,10 +26,14 @@ spec: {{- end }} containers: - name: discourse - securityContext: {{- toYaml .Values.containerSecurityContext | nindent 12 }} + securityContext: {{- toYaml .Values.discourse.securityContext | nindent 12 }} image: {{ template "discourse.image" . }} imagePullPolicy: {{ .Values.image.pullPolicy | quote }} env: + {{- if .Values.image.debug }} + - name: NAMI_DEBUG + value: "--log-level trace" + {{- end }} - name: DISCOURSE_PASSWORD valueFrom: secretKeyRef: @@ -37,52 +42,151 @@ spec: - name: DISCOURSE_POSTGRESQL_PASSWORD valueFrom: secretKeyRef: - name: {{ include "discourse.fullname" . }} - key: discourse-postgresql-password - {{- if .Values.postgresql.enabled }} - - name: POSTGRESQL_CLIENT_CREATE_DATABASE_PASSWORD + name: {{ include "discourse.databaseSecretName" . }} + key: postgresql-password + - name: POSTGRESQL_ROOT_PASSWORD valueFrom: secretKeyRef: - name: {{ include "discourse.fullname" . }} - key: postgresql-client-create-database-password - {{- end }} + name: {{ include "discourse.databaseSecretName" . }} + key: postgresql-postgres-password + {{- if or (and .Values.redis.enabled .Values.redis.usePassword) (and (not .Values.redis.enabled) (not (empty .Values.externalRedis.password))) }} - name: REDIS_PASSWORD valueFrom: secretKeyRef: - name: {{ include "discourse.fullname" . }} + name: {{ include "discourse.redisSecretName" . }} key: redis-password + {{- end }} + {{- if .Values.discourse.extraEnvVars }} + {{- tpl (toYaml .Values.discourse.extraEnvVars) $ | indent 12 }} + {{- end }} + envFrom: - configMapRef: name: {{ include "discourse.fullname" . }} - {{- if .Values.extraEnvVars.discourse }} - {{- tpl (toYaml .Values.extraEnvVars.discourse) $ | indent 12 }} - {{- end }} - {{- if or .Values.extraEnvVarsCM.discourse .Values.extraEnvVarsSecret.discourse }} - envFrom: - {{- if .Values.extraEnvVarsCM.discourse }} + {{- if .Values.discourse.extraEnvVarsCM }} - configMapRef: - name: {{ .Values.extraEnvVarsCM.discourse }} + name: {{ .Values.discourse.extraEnvVarsCM }} {{- end }} - {{- if .Values.extraEnvVarsSecret.discourse }} + {{- if .Values.discourse.extraEnvVarsSecret }} - secretRef: - name: {{ .Values.extraEnvVarsSecret.discourse }} - {{- end }} + name: {{ .Values.discourse.extraEnvVarsSecret }} {{- end }} ports: - name: http containerPort: 3000 protocol: TCP - # livenessProbe: - # httpGet: - # path: / - # port: http + {{- if .Values.discourse.livenessProbe.enabled }} + livenessProbe: + httpGet: + path: / + port: http + initialDelaySeconds: {{ .Values.discourse.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.discourse.livenessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.discourse.livenessProbe.timeoutSeconds }} + successThreshold: {{ .Values.discourse.livenessProbe.successThreshold }} + failureThreshold: {{ .Values.discourse.livenessProbe.failureThreshold }} + {{- end }} + {{- if .Values.discourse.readinessProbe.enabled }} readinessProbe: httpGet: - path: / - port: http - resources: {{- toYaml .Values.resources | nindent 12 }} + path: / + port: http + initialDelaySeconds: {{ .Values.discourse.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.discourse.readinessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.discourse.readinessProbe.timeoutSeconds }} + successThreshold: {{ .Values.discourse.readinessProbe.successThreshold }} + failureThreshold: {{ .Values.discourse.readinessProbe.failureThreshold }} + {{- end }} + volumeMounts: + - name: discourse-data + mountPath: /bitnami/discourse + subPath: discourse + {{- if .Values.discourse.resources }} + resources: {{- toYaml .Values.discourse.resources | nindent 12 }} + {{- end }} + - name: sidekiq + securityContext: {{- toYaml .Values.sidekiq.securityContext | nindent 12 }} + image: {{ template "discourse.image" . }} + imagePullPolicy: {{ .Values.image.pullPolicy | quote }} + command: ["/app-entrypoint.sh"] + args: + - nami + - start + - --foreground + - discourse-sidekiq + env: + {{- if .Values.image.debug }} + - name: NAMI_DEBUG + value: "--log-level trace" + {{- end }} + - name: DISCOURSE_HOST + value: "127.0.0.1" + - name: DISCOURSE_PORT + value: "3000" + - name: DISCOURSE_PASSWORD + valueFrom: + secretKeyRef: + name: {{ include "discourse.fullname" . }} + key: discourse-password + - name: DISCOURSE_POSTGRESQL_PASSWORD + valueFrom: + secretKeyRef: + name: {{ include "discourse.databaseSecretName" . }} + key: postgresql-password + {{- if or (and .Values.redis.enabled .Values.redis.usePassword) (and (not .Values.redis.enabled) (not (empty .Values.externalRedis.password))) }} + - name: REDIS_PASSWORD + valueFrom: + secretKeyRef: + name: {{ include "discourse.redisSecretName" . }} + key: redis-password + {{- end }} + {{- if .Values.sidekiq.extraEnvVars }} + {{- tpl (toYaml .Values.sidekiq.extraEnvVars) $ | indent 12 }} + {{- end }} + envFrom: + - configMapRef: + name: {{ include "discourse.fullname" . }} + {{- if .Values.sidekiq.extraEnvVarsCM }} + - configMapRef: + name: {{ .Values.sidekiq.extraEnvVarsCM }} + {{- end }} + {{- if .Values.sidekiq.extraEnvVarsSecret }} + - secretRef: + name: {{ .Values.sidekiq.extraEnvVarsSecret }} + {{- end }} + livenessProbe: + exec: + command: ["/bin/sh", "-c", "nami status discourse-sidekiq"] + initialDelaySeconds: {{ .Values.sidekiq.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.sidekiq.readinessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.sidekiq.readinessProbe.timeoutSeconds }} + successThreshold: {{ .Values.sidekiq.readinessProbe.successThreshold }} + failureThreshold: {{ .Values.sidekiq.readinessProbe.failureThreshold }} + readinessProbe: + exec: + command: ["/bin/sh", "-c", "nami status discourse-sidekiq"] + initialDelaySeconds: {{ .Values.sidekiq.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.sidekiq.readinessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.sidekiq.readinessProbe.timeoutSeconds }} + successThreshold: {{ .Values.sidekiq.readinessProbe.successThreshold }} + failureThreshold: {{ .Values.sidekiq.readinessProbe.failureThreshold }} + volumeMounts: + - name: discourse-data + mountPath: /bitnami/discourse + subPath: discourse + {{- if .Values.sidekiq.resources }} + resources: {{- toYaml .Values.sidekiq.resources | nindent 12 }} + {{- end }} {{- if .Values.sidecars }} {{- tpl (toYaml .Values.sidecars) $ | indent 8 }} {{- end }} + volumes: + - name: discourse-data + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ .Values.persistence.existingClaim | default (include "discourse.fullname" .) }} + {{- else }} + emptyDir: {} + {{ end }} {{- if .Values.affinity }} affinity: {{- include "discourse.tplValue" (dict "value" .Values.affinity "context" $) | nindent 8 }} {{- end }} diff --git a/bitnami/discourse/templates/pvc.yaml b/bitnami/discourse/templates/pvc.yaml new file mode 100644 index 00000000000000..34fb2877080bad --- /dev/null +++ b/bitnami/discourse/templates/pvc.yaml @@ -0,0 +1,14 @@ +{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ template "discourse.fullname" . }} + labels: {{- include "discourse.labels" . | nindent 4 }} +spec: + accessModes: + - {{ .Values.persistence.accessMode | quote }} + resources: + requests: + storage: {{ .Values.persistence.size | quote }} + {{ include "discourse.storageClass" . }} +{{- end }} diff --git a/bitnami/discourse/templates/secrets.yaml b/bitnami/discourse/templates/secrets.yaml index 13b60bd866d6b7..a40701c7d6264a 100644 --- a/bitnami/discourse/templates/secrets.yaml +++ b/bitnami/discourse/templates/secrets.yaml @@ -5,32 +5,17 @@ metadata: labels: {{- include "discourse.labels" . | nindent 4 }} type: Opaque data: - {{- if .Values.discoursePassword }} - discourse-password: {{ .Values.discoursePassword | b64enc | quote }} + {{- if .Values.discourse.password }} + discourse-password: {{ .Values.discourse.password | b64enc | quote }} {{- else }} discourse-password: {{ randAlphaNum 10 | b64enc | quote }} {{- end }} - {{- if .Values.postgresql.postgresqlPassword }} - discourse-postgresql-password: {{ .Values.postgresql.postgresqlPassword | b64enc | quote }} - {{- else }} - discourse-postgresql-password: {{ randAlphaNum 10 | b64enc | quote }} - {{- end }} - - {{- if .Values.postgresql.postgresqlPostgresPassword }} - postgresql-root-password: {{ .Values.postgresql.postgresqlPostgresPassword | b64enc | quote }} - {{- else }} - postgresql-root-password: {{ randAlphaNum 10 | b64enc | quote }} + {{- if not .Values.postgresql.enabled }} + postgresql-password: {{ .Values.externalDatabase.password | b64enc | quote }} + postgresql-postgres-password: {{ .Values.externalDatabase.postgresqlPostgresPassword | b64enc | quote }} {{- end }} - {{- if .Values.postgresql.postgresqlPassword }} - postgresql-client-create-database-password: {{ .Values.postgresql.postgresqlPassword | b64enc | quote }} - {{- else }} - postgresql-client-create-database-password: {{ randAlphaNum 10 | b64enc | quote }} - {{- end }} - - {{- if .Values.redis.password }} - redis-password: {{ .Values.redis.password | b64enc | quote }} - {{- else }} - redis-password: {{ randAlphaNum 10 | b64enc | quote }} + {{- if and (not .Values.redis.enabled) (not (empty .Values.externalRedis.password)) }} + redis-password: {{ .Values.externalRedis.password | b64enc | quote }} {{- end }} diff --git a/bitnami/discourse/templates/tests/test-connection.yaml b/bitnami/discourse/templates/tests/test-connection.yaml deleted file mode 100644 index 8181247646fd7e..00000000000000 --- a/bitnami/discourse/templates/tests/test-connection.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: v1 -kind: Pod -metadata: - name: "{{ include "discourse.fullname" . }}-test-connection" - labels: {{- include "discourse.labels" . | nindent 4 }} - annotations: - "helm.sh/hook": test-success -spec: - containers: - - name: wget - image: busybox - command: ['wget'] - args: ['{{ include "discourse.fullname" . }}:{{ .Values.service.port }}'] - restartPolicy: Never diff --git a/bitnami/discourse/test.yaml b/bitnami/discourse/test.yaml deleted file mode 100644 index 755987ed2b3ac5..00000000000000 --- a/bitnami/discourse/test.yaml +++ /dev/null @@ -1,183 +0,0 @@ -## This is test deployment for Kubernetes platforms. -## This is not intended to be used in production. -## -apiVersion: apps/v1 -kind: Deployment -metadata: - labels: - app: test-postgresql - name: test-postgresql -spec: - replicas: 1 - selector: - matchLabels: - app: test-postgresql - template: - metadata: - labels: - app: test-postgresql - spec: - containers: - - image: bitnami/postgresql - name: test-postgresql - env: - - name: ALLOW_EMPTY_PASSWORD - value: "yes" ---- -apiVersion: v1 -kind: Service -metadata: - labels: - app: test-postgresql - name: test-postgresql -spec: - ports: - - port: 5432 - protocol: TCP - targetPort: 5432 - selector: - app: test-postgresql - sessionAffinity: None - type: ClusterIP ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - labels: - app: test-redis - name: test-redis -spec: - replicas: 1 - selector: - matchLabels: - app: test-redis - template: - metadata: - labels: - app: test-redis - spec: - containers: - - image: bitnami/redis - name: test-redis - env: - - name: ALLOW_EMPTY_PASSWORD - value: "yes" ---- -apiVersion: v1 -kind: Service -metadata: - labels: - app: test-redis - name: test-redis -spec: - ports: - - port: 6379 - protocol: TCP - targetPort: 6379 - selector: - app: test-redis - sessionAffinity: None - type: ClusterIP ---- -apiVersion: apps/v1 -kind: Deployment -metadata: - labels: - app: test-discourse - name: test-discourse -spec: - replicas: 1 - selector: - matchLabels: - app: test-discourse - template: - metadata: - labels: - app: test-discourse - spec: - containers: - - image: bitnami/discourse - name: test-discourse - env: - - name: POSTGRESQL_HOST - value: test-postgresql - - name: POSTGRESQL_ROOT_USER - value: postgres - - name: POSTGRESQL_CLIENT_CREATE_DATABASE_NAME - value: bitnami_application - - name: POSTGRESQL_CLIENT_CREATE_DATABASE_USERNAME - value: bn_discourse - - name: POSTGRESQL_CLIENT_CREATE_DATABASE_PASSWORD - value: bitnami1 - - name: DISCOURSE_POSTGRESQL_NAME - value: bitnami_application - - name: DISCOURSE_POSTGRESQL_USERNAME - value: bn_discourse - - name: DISCOURSE_POSTGRESQL_PASSWORD - value: bitnami1 - - name: DISCOURSE_HOSTNAME - value: www.example.com - - name: REDIS_HOST - value: test-redis - - name: REDIS_PORT_NUMBER - value: "6379" ---- -apiVersion: v1 -kind: Service -metadata: - labels: - app: test-discourse - name: test-discourse -spec: - ports: - - port: 3000 - protocol: TCP - targetPort: 3000 - selector: - app: test-discourse - sessionAffinity: None - type: ClusterIP ---- -apiVersion: v1 -kind: Pod -metadata: - name: test-sidekiq - labels: - app: test-sidekiq -spec: - containers: - - name: sidekiq - image: bitnami/discourse - args: - - nami - - start - - --foreground - - discourse-sidekiq - env: - - name: POSTGRESQL_HOST - value: test-postgresql - - name: POSTGRESQL_ROOT_USER - value: postgres - - name: POSTGRESQL_CLIENT_CREATE_DATABASE_NAME - value: bitnami_application - - name: POSTGRESQL_CLIENT_CREATE_DATABASE_USERNAME - value: bn_discourse - - name: POSTGRESQL_CLIENT_CREATE_DATABASE_PASSWORD - value: bitnami1 - - name: DISCOURSE_POSTGRESQL_NAME - value: bitnami_application - - name: DISCOURSE_POSTGRESQL_USERNAME - value: bn_discourse - - name: DISCOURSE_POSTGRESQL_PASSWORD - value: bitnami1 - - name: DISCOURSE_HOST - value: test-discourse - - name: DISCOURSE_PORT - value: "3000" - - name: DISCOURSE_HOSTNAME - value: www.example.com - - name: REDIS_HOST - value: test-redis - - name: REDIS_PORT_NUMBER - value: "6379" - diff --git a/bitnami/discourse/values-production.yaml b/bitnami/discourse/values-production.yaml new file mode 100644 index 00000000000000..d8bf20cc0dcaf3 --- /dev/null +++ b/bitnami/discourse/values-production.yaml @@ -0,0 +1,432 @@ +## Global Docker image parameters +## Please, note that this will override the image parameters, including dependencies, configured to use the global value +## Current available global Docker image parameters: imageRegistry and imagePullSecrets +## +# global: +# imageRegistry: myRegistryName +# imagePullSecrets: +# - myRegistryKeySecretName +# storageClass: myStorageClass + +## Number of Discourse & Sidekiq replicas +## (Note that you will need ReadWriteMany PVCs for this to work properly) +## +replicaCount: 1 + +## Bitnami Discourse image version +## ref: https://hub.docker.com/r/bitnami/discourse/tags/ +## +image: + registry: docker.io + repository: bitnami/discourse + tag: 2.4.4-debian-10-r8 + ## Specify a imagePullPolicy + ## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent' + ## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images + ## + pullPolicy: IfNotPresent + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + # pullSecrets: + # - myRegistryKeySecretName + ## Set to true if you would like to see extra information on logs + ## + debug: false + +imagePullSecrets: [] + +## String to partially override discourse.fullname template (will maintain the release name) +## +# nameOverride: + +## String to fully override discourse.fullname template +## +# fullnameOverride: + +discourse: + ## Discourse host to create application URLs. You may also include the port. + ## ref: https://github.com/bitnami/bitnami-docker-discourse#configuration + ## + host: "" + + ## Discourse site name + ## ref: https://github.com/bitnami/bitnami-docker-discourse#environment-variables + ## + siteName: "My Site!" + + ## User of the application + ## ref: https://github.com/bitnami/bitnami-docker-discourse#environment-variables + ## + username: user + + ## Application password + ## WARNING: Minimum length of 10 characters + ## Defaults to a random 10-character alphanumeric string if not set + ## ref: https://github.com/bitnami/bitnami-docker-discourse#environment-variables + ## + # password: + + ## Admin email + ## ref: https://github.com/bitnami/bitnami-docker-discourse#environment-variables + ## + email: user@example.com + + securityContext: {} + ## capabilities: + ## drop: + ## - ALL + ## readOnlyRootFilesystem: true + ## runAsNonRoot: true + ## runAsUser: 1000 + + ## Discourse container's resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## + resources: {} + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + + ## Discourse extra options for liveness and readiness probes + ## WARNING: Discourse installation process may take up some time and + ## setting inappropriate values here may lead to pods failure. + ## ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes + livenessProbe: + enabled: true + initialDelaySeconds: 500 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 + + readinessProbe: + enabled: true + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 + + ## An array to add extra env vars + ## For example: + ## extraEnvVars: + ## discourse: + ## - name: DISCOURSE_ELASTICSEARCH_URL + ## value: test + ## + extraEnvVars: [] + + ## Array to add extra configmaps: + ## + extraEnvVarsCM: [] + + ## Array to add extra environment + ## variables from a secret: + ## + # extraEnvVarsSecret: "" + + ## Do not run the Discourse installation wizard. + ## Use only in case you are importing an existing database. + skipInstall: false + +sidekiq: + + securityContext: {} + ## capabilities: + ## drop: + ## - ALL + ## readOnlyRootFilesystem: true + ## runAsNonRoot: true + ## runAsUser: 1000 + + ## Sidekiq resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## + resources: {} + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + ## limits: + ## cpu: 100m + ## memory: 128Mi + ## requests: + ## cpu: 100m + ## memory: 128Mi + + ## Sidekiq extra options for liveness and readiness probes + ## ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes + livenessProbe: + enabled: true + initialDelaySeconds: 120 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 + + readinessProbe: + enabled: true + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 + + ## An array to add extra env vars + ## For example: + ## extraEnvVars: + ## - name: DISCOURSE_ELASTICSEARCH_URL + ## value: test + ## + extraEnvVars: [] + + ## Array to add extra configmaps: + ## + extraEnvVarsCM: [] + + ## Name of the secret that holds extra + ## env vars: + ## + # extraEnvVarsSecret: + + +## Add sidecars to the pod. +## Example: +## sidecars: +## - name: your-image-name +## image: your-image +## imagePullPolicy: Always +## ports: +## - name: portname +## containerPort: 1234 +## +sidecars: [] + +## Add init containers to the pod +## +## e.g. +## initContainers: +## - name: your-image-name +## image: your-image +## imagePullPolicy: Always +## ports: +## - name: portname +## containerPort: 1234 +initContainers: [] + +serviceAccount: + ## Specifies whether a service account should be created + create: false + ## Annotations to add to the service account + annotations: {} + ## The name of the service account to use. + ## If not set and create is true, a name is generated using the fullname template + name: + +podSecurityContext: {} +## fsGroup: 2000 + +## Enable persistence using Persistent Volume Claims +## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ +## +persistence: + enabled: true + ## discourse & sidekiq data Persistent Volume Storage Class + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack) + ## + # storageClass: "-" + ## + ## If you want to reuse an existing claim, you can pass the name of the PVC using + ## the existingClaim variable + # existingClaim: your-claim + ## To use the portal and to ensure you can scale Discourse you need to provide a + ## ReadWriteMany PVC, if you dont have a provisioner for this type of storage + ## We recommend that you install the nfs provisioner and map it to a RWO volume + ## helm install nfs-server stable/nfs-server-provisioner --set persistence.enabled=true,persistence.size=10Gi + ## + persistence.accessMode: ReadWriteMany + size: 10Gi + +## Kubernetes configuration +## For minikube, set this to NodePort, elsewhere use LoadBalancer or ClusterIP +## +service: + type: LoadBalancer + ## HTTP Port + ## + port: 80 + ## Node Ports to expose + # nodePort: + ## Enable client source IP preservation + ## ref http://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip + ## + externalTrafficPolicy: Local + annotations: {} + ## Limits which cidr blocks can connect to service's load balancer + ## Only valid if service.type: LoadBalancer + loadBalancerSourceRanges: [] + ## Extra ports to expose (normally used with the `sidecar` value) + # extraPorts: + + ## nodePorts: + ## http: + nodePorts: + http: "" + +## Ingress paramaters +## +ingress: + ## Set to true to enable ingress record generation + ## + enabled: false + ## Set this to true in order to add the corresponding annotations for cert-manager + ## + certManager: false + ## When the ingress is enabled, a host pointing to this will be created + ## + hostname: discourse.local + ## Ingress annotations done as key:value pairs + ## For a full list of possible ingress annotations, please see + ## ref: https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/nginx-configuration/annotations.md + ## + ## If certManager is set to true, annotation kubernetes.io/tls-acme: "true" will automatically be set + ## + annotations: {} + ## The list of additional hostnames to be covered with this ingress record. + ## Most likely the hostname above will be enough, but in the event more hosts are needed, this is an array + ## extraHosts: + ## - name: discourse.local + ## path: / + ## The tls configuration for additional hostnames to be covered with this ingress record. + ## see: https://kubernetes.io/docs/concepts/services-networking/ingress/#tls + ## extraTls: + ## - hosts: + ## - discourse.local + ## secretName: discourse.local-tls + ## If you're providing your own certificates, please use this to add the certificates as secrets + ## key and certificate should start with -----BEGIN CERTIFICATE----- or + ## -----BEGIN RSA PRIVATE KEY----- + ## + ## name should line up with a tlsSecret set further up + ## If you're using cert-manager, this is unneeded, as it will create the secret for you if it is not set + ## + ## It is also possible to create and manage the certificates outside of this helm chart + ## Please see README.md for more information + ## + secrets: [] + ## - name: discourse.local-tls + ## key: + ## certificate: + +## Node labels for pod assignment. Evaluated as a template. +## ref: https://kubernetes.io/docs/user-guide/node-selection/ +## +nodeSelector: {} + +## Tolerations for pod assignment. Evaluated as a template. +## ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ +## +tolerations: [] + +## Affinity for pod assignment +## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity +## +affinity: {} + +## +## PostgreSQL chart configuration +## +## https://github.com/bitnami/charts/blob/master/bitnami/postgresql/values.yaml +## +postgresql: + ## Whether to deploy a postgresql server to satisfy the applications database requirements. To use an external database set this to false and configure the externalDatabase parameters + ## + enabled: true + ## PostgreSQL user (has superuser privileges if username is `postgres`) + ## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md#setting-the-root-password-on-first-run + postgresqlUsername: bn_discourse + + ## PostgreSQL password + ## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md#setting-the-root-password-on-first-run + ## + ## postgresqlPassword: + + ## PostgreSQL admin password (used when `postgresqlUsername` is not `postgres`) + ## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md#creating-a-database-user-on-first-run (see note!) + postgresqlPostgresPassword: "bitnami" + + ## Create a database + ## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md#creating-a-database-on-first-run + ## + postgresqlDatabase: bitnami_application + + ## PostgreSQL data Persistent Volume Storage Class + persistence: + enabled: true + +## +## External database configuration +## +externalDatabase: + ## Database host + host: "" + ## Database port + port: 5432 + ## non-root Username for Discourse Database + user: bn_discourse + ## Database password + password: + ## Root "postgres" password (used in the installation stage) + postgresqlPostgresPassword: + ## Database name + database: bitnami_application + +## Redis chart configuration +## +## https://github.com/bitnami/charts/blob/master/bitnami/redis/values.yaml +## +redis: + ## Whether to deploy a redis server to satisfy the applications requirements. To use an external redis instance set this to false and configure the externalRedis parameters + enabled: true + ## Use password authentication + usePassword: true + ## Redis password (both master and slave) + ## Defaults to a random 10-character alphanumeric string if not set and usePassword is true + ## ref: https://github.com/bitnami/bitnami-docker-redis#setting-the-server-password-on-first-run + ## + # password: + + ## Cluster settings + cluster: + enabled: false + + ## + ## Redis Master parameters + ## + master: + persistence: + enabled: true + +## +## External Redis +## +externalRedis: + ## Redis host + host: "" + ## Redis port + port: 6379 + ## Redis password for authentication + password: "" diff --git a/bitnami/discourse/values.yaml b/bitnami/discourse/values.yaml index 74862c24c45ebd..32a600a0d2a720 100644 --- a/bitnami/discourse/values.yaml +++ b/bitnami/discourse/values.yaml @@ -8,56 +8,196 @@ # - myRegistryKeySecretName # storageClass: myStorageClass -## Number of Discourse replicas +## Number of Discourse & Sidekiq replicas ## (Note that you will need ReadWriteMany PVCs for this to work properly) ## -replicaCount: - discourse: 1 - sidekiq: 1 +replicaCount: 1 ## Bitnami Discourse image version ## ref: https://hub.docker.com/r/bitnami/discourse/tags/ ## image: + registry: docker.io repository: bitnami/discourse - tag: latest - pullPolicy: Always + tag: 2.4.4-debian-10-r8 + ## Specify a imagePullPolicy + ## Defaults to 'Always' if image tag is 'latest', else set to 'IfNotPresent' + ## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images + ## + pullPolicy: IfNotPresent + ## Optionally specify an array of imagePullSecrets. + ## Secrets must be manually created in the namespace. + ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ + ## + # pullSecrets: + # - myRegistryKeySecretName + ## Set to true if you would like to see extra information on logs + ## + debug: false imagePullSecrets: [] ## String to partially override discourse.fullname template (will maintain the release name) ## -nameOverride: "" +# nameOverride: ## String to fully override discourse.fullname template ## -fullnameOverride: "" +# fullnameOverride: -## Discourse host to create application URLs -## ref: https://github.com/bitnami/bitnami-docker-discourse#configuration -## -# discourseHost: +discourse: + ## Discourse host to create application URLs. You may also include the port. + ## ref: https://github.com/bitnami/bitnami-docker-discourse#configuration + ## + host: "" -## Discourse site name -## ref: https://github.com/bitnami/bitnami-docker-discourse#environment-variables -## -discourseSitename: "My Site!" + ## Discourse site name + ## ref: https://github.com/bitnami/bitnami-docker-discourse#environment-variables + ## + siteName: "My Site!" -## User of the application -## ref: https://github.com/bitnami/bitnami-docker-discourse#environment-variables -## -discourseUsername: user + ## User of the application + ## ref: https://github.com/bitnami/bitnami-docker-discourse#environment-variables + ## + username: user -## Application password -## Defaults to a random 10-character alphanumeric string if not set -## ref: https://github.com/bitnami/bitnami-docker-discourse#environment-variables -## -# discoursePassword: + ## Application password + ## WARNING: Minimum length of 10 characters + ## Defaults to a random 10-character alphanumeric string if not set + ## ref: https://github.com/bitnami/bitnami-docker-discourse#environment-variables + ## + # password: + + ## Admin email + ## ref: https://github.com/bitnami/bitnami-docker-discourse#environment-variables + ## + email: user@example.com + + securityContext: {} + ## capabilities: + ## drop: + ## - ALL + ## readOnlyRootFilesystem: true + ## runAsNonRoot: true + ## runAsUser: 1000 + + ## Discourse container's resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## + resources: {} + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + + ## Discourse extra options for liveness and readiness probes + ## WARNING: Discourse installation process may take up some time and + ## setting inappropriate values here may lead to pods failure. + ## ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes + livenessProbe: + enabled: true + initialDelaySeconds: 500 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 + + readinessProbe: + enabled: true + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 + + ## An array to add extra env vars + ## For example: + ## extraEnvVars: + ## discourse: + ## - name: DISCOURSE_ELASTICSEARCH_URL + ## value: test + ## + extraEnvVars: [] + + ## Array to add extra configmaps: + ## + extraEnvVarsCM: [] + + ## Array to add extra environment + ## variables from a secret: + ## + # extraEnvVarsSecret: "" + + ## Do not run the Discourse installation wizard. + ## Use only in case you are importing an existing database. + skipInstall: false + +sidekiq: + + securityContext: {} + ## capabilities: + ## drop: + ## - ALL + ## readOnlyRootFilesystem: true + ## runAsNonRoot: true + ## runAsUser: 1000 + + ## Sidekiq resource requests and limits + ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ + ## + resources: {} + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + ## limits: + ## cpu: 100m + ## memory: 128Mi + ## requests: + ## cpu: 100m + ## memory: 128Mi + + ## Sidekiq extra options for liveness and readiness probes + ## ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes + livenessProbe: + enabled: true + initialDelaySeconds: 120 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 + + readinessProbe: + enabled: true + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 + + ## An array to add extra env vars + ## For example: + ## extraEnvVars: + ## - name: DISCOURSE_ELASTICSEARCH_URL + ## value: test + ## + extraEnvVars: [] + + ## Array to add extra configmaps: + ## + extraEnvVarsCM: [] + + ## Name of the secret that holds extra + ## env vars: + ## + # extraEnvVarsSecret: -## Admin email -## ref: https://github.com/bitnami/bitnami-docker-discourse#environment-variables -## -discourseEmail: user@example.com ## Add sidecars to the pod. ## Example: @@ -70,6 +210,7 @@ discourseEmail: user@example.com ## containerPort: 1234 ## sidecars: [] + ## Add init containers to the pod ## ## e.g. @@ -92,21 +233,33 @@ serviceAccount: name: podSecurityContext: {} - ## fsGroup: 2000 +## fsGroup: 2000 -containerSecurityContext: {} - ## capabilities: - ## drop: - ## - ALL - ## readOnlyRootFilesystem: true - ## runAsNonRoot: true - ## runAsUser: 1000 +## Enable persistence using Persistent Volume Claims +## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ +## +persistence: + enabled: true + ## discourse & sidekiq data Persistent Volume Storage Class + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack) + ## + # storageClass: "-" + ## + ## If you want to reuse an existing claim, you can pass the name of the PVC using + ## the existingClaim variable + # existingClaim: your-claim + accessMode: ReadWriteOnce + size: 10Gi ## Kubernetes configuration ## For minikube, set this to NodePort, elsewhere use LoadBalancer or ClusterIP ## service: - type: LoadBalancer + type: NodePort ## HTTP Port ## port: 80 @@ -122,10 +275,11 @@ service: loadBalancerSourceRanges: [] ## Extra ports to expose (normally used with the `sidecar` value) # extraPorts: + + ## nodePorts: + ## http: nodePorts: - http: "" - https: "" - metrics: "" + http: "30000" ## Ingress paramaters ## @@ -172,21 +326,6 @@ ingress: ## key: ## certificate: -## Discourse containers' resource requests and limits -## ref: http://kubernetes.io/docs/user-guide/compute-resources/ -## -resources: {} - ## We usually recommend not to specify default resources and to leave this as a conscious - ## choice for the user. This also increases chances charts run on environments with little - ## resources, such as Minikube. If you do want to specify resources, uncomment the following - ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. - ## limits: - ## cpu: 100m - ## memory: 128Mi - ## requests: - ## cpu: 100m - ## memory: 128Mi - ## Node labels for pod assignment. Evaluated as a template. ## ref: https://kubernetes.io/docs/user-guide/node-selection/ ## @@ -202,61 +341,36 @@ tolerations: [] ## affinity: {} -## Discourse pod extra options for liveness and readiness probes -## ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes -livenessProbe: - enabled: true - initialDelaySeconds: 120 - periodSeconds: 10 - timeoutSeconds: 5 - failureThreshold: 6 - successThreshold: 1 -readinessProbe: - enabled: true - initialDelaySeconds: 30 - periodSeconds: 10 - timeoutSeconds: 5 - failureThreshold: 6 - successThreshold: 1 - -## An array to add extra env vars -## For example: -## extraEnvVars: -## discourse: -## - name: DISCOURSE_ELASTICSEARCH_URL -## value: test -## sidekiq: [] -## -extraEnvVars: - discourse: [] - sidekiq: [] - -## Array to add extra configmaps: -## -extraEnvVarsCM: - discourse: [] - sidekiq: [] - -## Array to add extra environment -## variables from a secret: -## -extraEnvVarsSecret: - discourse: "" - sidekiq: "" - ## ## PostgreSQL chart configuration ## ## https://github.com/bitnami/charts/blob/master/bitnami/postgresql/values.yaml ## postgresql: + ## Whether to deploy a postgresql server to satisfy the applications database requirements. To use an external database set this to false and configure the externalDatabase parameters + ## enabled: true + ## PostgreSQL user (has superuser privileges if username is `postgres`) + ## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md#setting-the-root-password-on-first-run postgresqlUsername: bn_discourse - postgresqlPostgresPassword: "" - postgresqlPassword: "" - postgresqlDatabase: bitnami_discourse + + ## PostgreSQL password + ## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md#setting-the-root-password-on-first-run + ## + ## postgresqlPassword: + + ## PostgreSQL admin password (used when `postgresqlUsername` is not `postgres`) + ## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md#creating-a-database-user-on-first-run (see note!) + postgresqlPostgresPassword: "bitnami" + + ## Create a database + ## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md#creating-a-database-on-first-run + ## + postgresqlDatabase: bitnami_application + + ## PostgreSQL data Persistent Volume Storage Class persistence: - enabled: false + enabled: true ## ## External database configuration @@ -265,31 +379,49 @@ externalDatabase: ## Database host host: "" ## Database port - port: 3306 - ## Database user + port: 5432 + ## non-root Username for Discourse Database user: bn_discourse ## Database password password: + ## Root "postgres" password (used in the installation stage) + postgresqlPostgresPassword: ## Database name - database: bitnami_discourse + database: bitnami_application ## Redis chart configuration ## ## https://github.com/bitnami/charts/blob/master/bitnami/redis/values.yaml ## redis: - ## use redis helm chart dependency + ## Whether to deploy a redis server to satisfy the applications requirements. To use an external redis instance set this to false and configure the externalRedis parameters enabled: true - password: - ## TODO: change from master/slave - ## Sorry for the master/slave terminology, - ## its an upstream chart. Will look for - ## ways to change it. + ## Use password authentication + usePassword: false + ## Redis password (both master and slave) + ## Defaults to a random 10-character alphanumeric string if not set and usePassword is true + ## ref: https://github.com/bitnami/bitnami-docker-redis#setting-the-server-password-on-first-run + ## + # password: + + ## Cluster settings cluster: enabled: false + + ## + ## Redis Master parameters + ## master: persistence: - enabled: false - slave: - persistence: - enabled: false + enabled: true + +## +## External Redis +## +externalRedis: + ## Redis host + host: "" + ## Redis port + port: 6379 + ## Redis password for authentication + password: "" From 44116756c36fe11d89e7eccb62371d1bb96dbca0 Mon Sep 17 00:00:00 2001 From: joancafom Date: Wed, 17 Jun 2020 00:22:02 +0200 Subject: [PATCH 22/35] Fix linter issues --- bitnami/discourse/templates/configmaps.yaml | 2 +- bitnami/discourse/values-production.yaml | 40 ++++++++++----------- bitnami/discourse/values.yaml | 40 ++++++++++----------- 3 files changed, 41 insertions(+), 41 deletions(-) diff --git a/bitnami/discourse/templates/configmaps.yaml b/bitnami/discourse/templates/configmaps.yaml index 8be97084b6625c..27e1c7f25b15bc 100644 --- a/bitnami/discourse/templates/configmaps.yaml +++ b/bitnami/discourse/templates/configmaps.yaml @@ -9,7 +9,7 @@ data: DISCOURSE_EMAIL: {{ .Values.discourse.email | quote }} DISCOURSE_SITENAME: {{ .Values.discourse.siteName | quote }} REDIS_HOST: {{ template "discourse.redisHost" . }} - REDIS_PORT_NUMBER: {{ template "discourse.redisPort" . }} + REDIS_PORT_NUMBER: {{ template "discourse.redisPort" . }} POSTGRESQL_HOST: {{ template "discourse.databaseHost" . }} POSTGRESQL_PORT_NUMBER: {{ template "discourse.databasePort" . }} DISCOURSE_POSTGRESQL_NAME: {{ template "discourse.databaseName" . }} diff --git a/bitnami/discourse/values-production.yaml b/bitnami/discourse/values-production.yaml index d8bf20cc0dcaf3..e35e60f5f5b057 100644 --- a/bitnami/discourse/values-production.yaml +++ b/bitnami/discourse/values-production.yaml @@ -85,16 +85,16 @@ discourse: ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ ## resources: {} - ## We usually recommend not to specify default resources and to leave this as a conscious - ## choice for the user. This also increases chances charts run on environments with little - ## resources, such as Minikube. If you do want to specify resources, uncomment the following - ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. - # limits: - # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi ## Discourse extra options for liveness and readiness probes ## WARNING: Discourse installation process may take up some time and @@ -152,16 +152,16 @@ sidekiq: ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ ## resources: {} - ## We usually recommend not to specify default resources and to leave this as a conscious - ## choice for the user. This also increases chances charts run on environments with little - ## resources, such as Minikube. If you do want to specify resources, uncomment the following - ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. - ## limits: - ## cpu: 100m - ## memory: 128Mi - ## requests: - ## cpu: 100m - ## memory: 128Mi + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi ## Sidekiq extra options for liveness and readiness probes ## ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes diff --git a/bitnami/discourse/values.yaml b/bitnami/discourse/values.yaml index 32a600a0d2a720..be8582b2160559 100644 --- a/bitnami/discourse/values.yaml +++ b/bitnami/discourse/values.yaml @@ -85,16 +85,16 @@ discourse: ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ ## resources: {} - ## We usually recommend not to specify default resources and to leave this as a conscious - ## choice for the user. This also increases chances charts run on environments with little - ## resources, such as Minikube. If you do want to specify resources, uncomment the following - ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. - # limits: - # cpu: 100m - # memory: 128Mi - # requests: - # cpu: 100m - # memory: 128Mi + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi ## Discourse extra options for liveness and readiness probes ## WARNING: Discourse installation process may take up some time and @@ -152,16 +152,16 @@ sidekiq: ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ ## resources: {} - ## We usually recommend not to specify default resources and to leave this as a conscious - ## choice for the user. This also increases chances charts run on environments with little - ## resources, such as Minikube. If you do want to specify resources, uncomment the following - ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. - ## limits: - ## cpu: 100m - ## memory: 128Mi - ## requests: - ## cpu: 100m - ## memory: 128Mi + ## We usually recommend not to specify default resources and to leave this as a conscious + ## choice for the user. This also increases chances charts run on environments with little + ## resources, such as Minikube. If you do want to specify resources, uncomment the following + ## lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi ## Sidekiq extra options for liveness and readiness probes ## ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes From 1c0c972b21af04afe4ee53f44f114de47debaefd Mon Sep 17 00:00:00 2001 From: joancafom Date: Wed, 17 Jun 2020 10:09:46 +0200 Subject: [PATCH 23/35] Chart api version downgraded to v1 --- bitnami/discourse/Chart.yaml | 3 +-- bitnami/discourse/requirements.lock | 8 ++++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/bitnami/discourse/Chart.yaml b/bitnami/discourse/Chart.yaml index 676aed87e4a389..5113fb037b79c9 100644 --- a/bitnami/discourse/Chart.yaml +++ b/bitnami/discourse/Chart.yaml @@ -1,7 +1,6 @@ -apiVersion: v2 +apiVersion: v1 name: discourse description: A Helm chart for deploying Discourse to Kubernetes -type: application version: 0.1.0 appVersion: 2.4.1 engine: gotpl diff --git a/bitnami/discourse/requirements.lock b/bitnami/discourse/requirements.lock index 895ccdd1b40531..d8ed10e9bbc8f1 100644 --- a/bitnami/discourse/requirements.lock +++ b/bitnami/discourse/requirements.lock @@ -1,9 +1,9 @@ dependencies: - name: postgresql repository: https://charts.bitnami.com/bitnami - version: 8.6.4 + version: 8.10.5 - name: redis repository: https://charts.bitnami.com/bitnami - version: 10.5.11 -digest: sha256:a8c674729c5c688f9e3799891d47e04606888c6ab54d2fc2159b03644c322bd0 -generated: "2020-03-14T10:12:55.307197087-05:00" + version: 10.7.2 +digest: sha256:cc984394c0b625227d718eb84193451926a0c507b13ba6c2efca0f4789af1909 +generated: "2020-06-17T10:08:35.360488+02:00" From 93e430d7285b881a7b39dfe68a00cfaf9d6237c9 Mon Sep 17 00:00:00 2001 From: joancafom Date: Wed, 17 Jun 2020 10:48:19 +0200 Subject: [PATCH 24/35] Added special values for CI testing purposes --- bitnami/discourse/ci/ct-values.yaml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 bitnami/discourse/ci/ct-values.yaml diff --git a/bitnami/discourse/ci/ct-values.yaml b/bitnami/discourse/ci/ct-values.yaml new file mode 100644 index 00000000000000..b738e2a57a262e --- /dev/null +++ b/bitnami/discourse/ci/ct-values.yaml @@ -0,0 +1,2 @@ +service: + type: ClusterIP From 13a4ec478e10d13a98f9000803ea5030484e0271 Mon Sep 17 00:00:00 2001 From: joancafom Date: Wed, 17 Jun 2020 10:51:22 +0200 Subject: [PATCH 25/35] Fix identation issues --- bitnami/discourse/templates/deployment.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bitnami/discourse/templates/deployment.yaml b/bitnami/discourse/templates/deployment.yaml index ab99f4b353102d..1e6234fbcbc2b0 100644 --- a/bitnami/discourse/templates/deployment.yaml +++ b/bitnami/discourse/templates/deployment.yaml @@ -77,8 +77,8 @@ spec: {{- if .Values.discourse.livenessProbe.enabled }} livenessProbe: httpGet: - path: / - port: http + path: / + port: http initialDelaySeconds: {{ .Values.discourse.livenessProbe.initialDelaySeconds }} periodSeconds: {{ .Values.discourse.livenessProbe.periodSeconds }} timeoutSeconds: {{ .Values.discourse.livenessProbe.timeoutSeconds }} @@ -88,8 +88,8 @@ spec: {{- if .Values.discourse.readinessProbe.enabled }} readinessProbe: httpGet: - path: / - port: http + path: / + port: http initialDelaySeconds: {{ .Values.discourse.readinessProbe.initialDelaySeconds }} periodSeconds: {{ .Values.discourse.readinessProbe.periodSeconds }} timeoutSeconds: {{ .Values.discourse.readinessProbe.timeoutSeconds }} From 8c2588d3cecb5e3e78acaf1db7420046c7a94c63 Mon Sep 17 00:00:00 2001 From: joancafom Date: Wed, 17 Jun 2020 11:42:38 +0200 Subject: [PATCH 26/35] Fix sidekiq liveness probe + increase time --- bitnami/discourse/templates/deployment.yaml | 10 +++++----- bitnami/discourse/values.yaml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bitnami/discourse/templates/deployment.yaml b/bitnami/discourse/templates/deployment.yaml index 1e6234fbcbc2b0..3a42f33d97b159 100644 --- a/bitnami/discourse/templates/deployment.yaml +++ b/bitnami/discourse/templates/deployment.yaml @@ -156,11 +156,11 @@ spec: livenessProbe: exec: command: ["/bin/sh", "-c", "nami status discourse-sidekiq"] - initialDelaySeconds: {{ .Values.sidekiq.readinessProbe.initialDelaySeconds }} - periodSeconds: {{ .Values.sidekiq.readinessProbe.periodSeconds }} - timeoutSeconds: {{ .Values.sidekiq.readinessProbe.timeoutSeconds }} - successThreshold: {{ .Values.sidekiq.readinessProbe.successThreshold }} - failureThreshold: {{ .Values.sidekiq.readinessProbe.failureThreshold }} + initialDelaySeconds: {{ .Values.sidekiq.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.sidekiq.livenessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.sidekiq.livenessProbe.timeoutSeconds }} + successThreshold: {{ .Values.sidekiq.livenessProbe.successThreshold }} + failureThreshold: {{ .Values.sidekiq.livenessProbe.failureThreshold }} readinessProbe: exec: command: ["/bin/sh", "-c", "nami status discourse-sidekiq"] diff --git a/bitnami/discourse/values.yaml b/bitnami/discourse/values.yaml index be8582b2160559..950e4f97472367 100644 --- a/bitnami/discourse/values.yaml +++ b/bitnami/discourse/values.yaml @@ -167,7 +167,7 @@ sidekiq: ## ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes livenessProbe: enabled: true - initialDelaySeconds: 120 + initialDelaySeconds: 500 periodSeconds: 10 timeoutSeconds: 5 failureThreshold: 6 From 48de8e2f89f899343cf2bda4a9f57006a7180f2b Mon Sep 17 00:00:00 2001 From: joancafom Date: Wed, 17 Jun 2020 16:08:21 +0200 Subject: [PATCH 27/35] Remove CT targeted files As this Chart was removed from the CT GitHub system. Liveness Probe timing for production values was also updated. --- bitnami/discourse/ci/ct-values.yaml | 2 -- bitnami/discourse/values-production.yaml | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) delete mode 100644 bitnami/discourse/ci/ct-values.yaml diff --git a/bitnami/discourse/ci/ct-values.yaml b/bitnami/discourse/ci/ct-values.yaml deleted file mode 100644 index b738e2a57a262e..00000000000000 --- a/bitnami/discourse/ci/ct-values.yaml +++ /dev/null @@ -1,2 +0,0 @@ -service: - type: ClusterIP diff --git a/bitnami/discourse/values-production.yaml b/bitnami/discourse/values-production.yaml index e35e60f5f5b057..7d26cbde3a424e 100644 --- a/bitnami/discourse/values-production.yaml +++ b/bitnami/discourse/values-production.yaml @@ -167,7 +167,7 @@ sidekiq: ## ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes livenessProbe: enabled: true - initialDelaySeconds: 120 + initialDelaySeconds: 500 periodSeconds: 10 timeoutSeconds: 5 failureThreshold: 6 From 32ba718a84f94b234bef7b9539607ef6ab5ea919 Mon Sep 17 00:00:00 2001 From: joancafom Date: Thu, 18 Jun 2020 12:32:30 +0200 Subject: [PATCH 28/35] Add Ingress TLS support --- bitnami/discourse/README.md | 50 +++++++++++++++++++- bitnami/discourse/templates/ingress.yaml | 47 +++++++++++------- bitnami/discourse/templates/tls-secrets.yaml | 13 +++++ bitnami/discourse/values-production.yaml | 8 ++++ bitnami/discourse/values.yaml | 8 ++++ 5 files changed, 107 insertions(+), 19 deletions(-) create mode 100644 bitnami/discourse/templates/tls-secrets.yaml diff --git a/bitnami/discourse/README.md b/bitnami/discourse/README.md index 817bbf1cfb42c5..be8beb29b06d08 100644 --- a/bitnami/discourse/README.md +++ b/bitnami/discourse/README.md @@ -153,9 +153,15 @@ The following table lists the configurable parameters of the Discourse chart and | `ingress.enabled` | Enable ingress controller resource | `false` | | `ingress.certManager` | Add annotations for cert-manager | `false` | | `ingress.hostname` | Default host for the ingress resource | `discourse.local` | +| `ingress.tls` | Create TLS Secret | `false` | | `ingress.annotations` | Ingress annotations | `[]` (evaluated as a template) | | `ingress.extraHosts[0].name` | Additional hostnames to be covered | `nil` | | `ingress.extraHosts[0].path` | Additional hostnames to be covered | `nil` | +| `ingress.extraTls[0].hosts[0]` | TLS configuration for additional hostnames to be covered | `nil` | +| `ingress.extraTls[0].secretName` | TLS configuration for additional hostnames to be covered | `nil` | +| `ingress.secrets[0].name` | TLS Secret Name | `nil` | +| `ingress.secrets[0].certificate` | TLS Secret Certificate | `nil` | +| `ingress.secrets[0].key` | TLS Secret Key | `nil` | ### Database parameters @@ -351,7 +357,49 @@ To enable ingress integration, please set `ingress.enabled` to `true` ### Hosts -Most likely you will only want to have one hostname that maps to this WordPress installation. If that's your case, the property `ingress.hostname` will set it. However, it is possible to have more than one host. To facilitate this, the `ingress.extraHosts` object is can be specified as an array. +Most likely you will only want to have one hostname that maps to this Discourse installation. If that's your case, the property `ingress.hostname` will set it. However, it is possible to have more than one host. To facilitate this, the `ingress.extraHosts` object is can be specified as an array. + +For each host indicated at `ingress.extraHosts`, please indicate a `name`, `path`, and any `annotations` that you may want the ingress controller to know about. + +The actual TLS secret do not have to be generated by this chart. However, please note that if TLS is enabled, the ingress record will not work until this secret exists. + +For annotations, please see [this document](https://github.com/kubernetes/ingress-nginx/blob/master/docs/user-guide/nginx-configuration/annotations.md). Not all annotations are supported by all ingress controllers, but this document does a good job of indicating which annotation is supported by many popular ingress controllers. + +### TLS Secrets + +This chart will facilitate the creation of TLS secrets for use with the ingress controller, however, this is not required. There are three common use cases: + +- Helm generates/manages certificate secrets +- User generates/manages certificates separately +- An additional tool (like [kube-lego](https://kubeapps.com/charts/stable/kube-lego)) manages the secrets for the application + +In the first two cases, one will need a certificate and a key. We would expect them to look like this: + +- certificate files should look like (and there can be more than one certificate if there is a certificate chain) + +```console +-----BEGIN CERTIFICATE----- +MIID6TCCAtGgAwIBAgIJAIaCwivkeB5EMA0GCSqGSIb3DQEBCwUAMFYxCzAJBgNV +... +jScrvkiBO65F46KioCL9h5tDvomdU1aqpI/CBzhvZn1c0ZTf87tGQR8NK7v7 +-----END CERTIFICATE----- +``` + +- keys should look like: + +```console +-----BEGIN RSA PRIVATE KEY----- +MIIEogIBAAKCAQEAvLYcyu8f3skuRyUgeeNpeDvYBCDcgq+LsWap6zbX5f8oLqp4 +... +wrj2wDbCDCFmfqnSJ+dKI3vFLlEz44sAV8jX/kd4Y6ZTQhlLbYc= +-----END RSA PRIVATE KEY----- +``` + +If you are going to use Helm to manage the certificates, please copy these values into the `certificate` and `key` values for a given `ingress.secrets` entry. + +If you are going to manage TLS secrets outside of Helm, please know that you can create a TLS secret (named `discourse.local-tls` for example). + +Please see [this example](https://github.com/kubernetes/contrib/tree/master/ingress/controllers/nginx/examples/tls) for more information. ## Persistence diff --git a/bitnami/discourse/templates/ingress.yaml b/bitnami/discourse/templates/ingress.yaml index cbec3f294febd5..5e732dcb894e64 100644 --- a/bitnami/discourse/templates/ingress.yaml +++ b/bitnami/discourse/templates/ingress.yaml @@ -1,6 +1,4 @@ {{- if .Values.ingress.enabled -}} -{{- $fullName := include "discourse.fullname" . -}} -{{- $svcPort := .Values.service.port -}} {{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} apiVersion: networking.k8s.io/v1beta1 {{- else -}} @@ -10,31 +8,44 @@ kind: Ingress metadata: name: {{ $fullName }} labels: {{- include "discourse.labels" . | nindent 4 }} - {{- with .Values.ingress.annotations }} + {{- if or .Values.ingress.annotations .Values.ingress.certManager }} annotations: + {{- with .Values.ingress.annotations }} {{- toYaml . | nindent 4 }} {{- end }} + {{- if .Values.ingress.certManager }} + kubernetes.io/tls-acme: "true" + {{- end }} + {{- end }} spec: -{{- if .Values.ingress.tls }} + {{- if or .Values.ingress.tls .Values.ingress.extraTls }} tls: - {{- range .Values.ingress.tls }} + {{- if .Values.ingress.tls }} - hosts: - {{- range .hosts }} - - {{ . | quote }} - {{- end }} - secretName: {{ .secretName }} + - {{ .Values.ingress.hostname }} + secretName: {{ printf "%s-tls" .Values.ingress.hostname }} + {{- end }} + {{- if .Values.ingress.extraTls }} + {{- toYaml .Values.ingress.extraTls | nindent 4 }} + {{- end }} {{- end }} -{{- end }} rules: - {{- range .Values.ingress.hosts }} - - host: {{ .host | quote }} + {{- if .Values.ingress.hostname }} + - host: {{ .Values.ingress.hostname }} http: paths: - {{- range .paths }} - - path: {{ . }} + - path: / backend: - serviceName: {{ $fullName }} - servicePort: {{ $svcPort }} - {{- end }} - {{- end }} + serviceName: {{ template "wordpress.fullname" . }} + servicePort: http + {{- end }} + {{- range .Values.ingress.extraHosts }} + - host: {{ .name }} + http: + paths: + - path: {{ default "/" .path }} + backend: + serviceName: {{ template "wordpress.fullname" $ }} + servicePort: http + {{- end }} {{- end }} diff --git a/bitnami/discourse/templates/tls-secrets.yaml b/bitnami/discourse/templates/tls-secrets.yaml new file mode 100644 index 00000000000000..a4822440d6ef1a --- /dev/null +++ b/bitnami/discourse/templates/tls-secrets.yaml @@ -0,0 +1,13 @@ +{{- if .Values.ingress.enabled }} +{{- range .Values.ingress.secrets }} +apiVersion: v1 +kind: Secret +metadata: + name: {{ .name }} + labels: {{- include "discourse.labels" . | nindent 4 }} +type: kubernetes.io/tls +data: + tls.crt: {{ .certificate | b64enc }} + tls.key: {{ .key | b64enc }} +{{- end }} +{{- end }} diff --git a/bitnami/discourse/values-production.yaml b/bitnami/discourse/values-production.yaml index 7d26cbde3a424e..a7be2f65773680 100644 --- a/bitnami/discourse/values-production.yaml +++ b/bitnami/discourse/values-production.yaml @@ -305,17 +305,24 @@ ingress: ## If certManager is set to true, annotation kubernetes.io/tls-acme: "true" will automatically be set ## annotations: {} + ## Enable TLS configuration for the hostname defined at ingress.hostname parameter + ## TLS certificates will be retrieved from a TLS secret with name: {{- printf "%s-tls" .Values.ingress.hostname }} + ## You can use the ingress.secrets parameter to create this TLS secret or relay on cert-manager to create it + ## + tls: false ## The list of additional hostnames to be covered with this ingress record. ## Most likely the hostname above will be enough, but in the event more hosts are needed, this is an array ## extraHosts: ## - name: discourse.local ## path: / + ## ## The tls configuration for additional hostnames to be covered with this ingress record. ## see: https://kubernetes.io/docs/concepts/services-networking/ingress/#tls ## extraTls: ## - hosts: ## - discourse.local ## secretName: discourse.local-tls + ## ## If you're providing your own certificates, please use this to add the certificates as secrets ## key and certificate should start with -----BEGIN CERTIFICATE----- or ## -----BEGIN RSA PRIVATE KEY----- @@ -330,6 +337,7 @@ ingress: ## - name: discourse.local-tls ## key: ## certificate: + ## ## Node labels for pod assignment. Evaluated as a template. ## ref: https://kubernetes.io/docs/user-guide/node-selection/ diff --git a/bitnami/discourse/values.yaml b/bitnami/discourse/values.yaml index 950e4f97472367..140e9ed80e170a 100644 --- a/bitnami/discourse/values.yaml +++ b/bitnami/discourse/values.yaml @@ -300,17 +300,24 @@ ingress: ## If certManager is set to true, annotation kubernetes.io/tls-acme: "true" will automatically be set ## annotations: {} + ## Enable TLS configuration for the hostname defined at ingress.hostname parameter + ## TLS certificates will be retrieved from a TLS secret with name: {{- printf "%s-tls" .Values.ingress.hostname }} + ## You can use the ingress.secrets parameter to create this TLS secret or relay on cert-manager to create it + ## + tls: false ## The list of additional hostnames to be covered with this ingress record. ## Most likely the hostname above will be enough, but in the event more hosts are needed, this is an array ## extraHosts: ## - name: discourse.local ## path: / + ## ## The tls configuration for additional hostnames to be covered with this ingress record. ## see: https://kubernetes.io/docs/concepts/services-networking/ingress/#tls ## extraTls: ## - hosts: ## - discourse.local ## secretName: discourse.local-tls + ## ## If you're providing your own certificates, please use this to add the certificates as secrets ## key and certificate should start with -----BEGIN CERTIFICATE----- or ## -----BEGIN RSA PRIVATE KEY----- @@ -325,6 +332,7 @@ ingress: ## - name: discourse.local-tls ## key: ## certificate: + ## ## Node labels for pod assignment. Evaluated as a template. ## ref: https://kubernetes.io/docs/user-guide/node-selection/ From 774348fd8cb7460cc3cd03f476b3dde29fd83e68 Mon Sep 17 00:00:00 2001 From: joancafom Date: Thu, 18 Jun 2020 13:12:23 +0200 Subject: [PATCH 29/35] Set LoadBalancer service as default one --- bitnami/discourse/README.md | 9 +-------- bitnami/discourse/templates/configmaps.yaml | 3 ++- bitnami/discourse/templates/ingress.yaml | 2 +- bitnami/discourse/values.yaml | 6 +++--- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/bitnami/discourse/README.md b/bitnami/discourse/README.md index be8beb29b06d08..210a6afe4af1c7 100644 --- a/bitnami/discourse/README.md +++ b/bitnami/discourse/README.md @@ -88,7 +88,7 @@ The following table lists the configurable parameters of the Discourse chart and | Parameter | Description | Default | |-------------------------------------------|---------------------------------------------------------------------------------------|--------------------------------------------------------------| -| `service.type` | Kubernetes Service type | `NodePort` | +| `service.type` | Kubernetes Service type | `LoadBalancer` | | `service.port` | Service HTTP port | `80` | | `service.externalTrafficPolicy` | Enable client source IP preservation | `Cluster` | | `service.annotations` | Service annotations | `{}` (evaluated as a template) | @@ -263,13 +263,6 @@ postgresql.persistence.storageClass=nfs This chart includes a `values-production.yaml` file where you can find some parameters oriented to production configuration in comparison to the regular `values.yaml`. You can use this file instead of the default one. -- Use LoadBalancer as default: - -```diff -- service.type: NodePort -+ service.type: LoadBalancer -``` - - Enable client source IP preservation: ```diff diff --git a/bitnami/discourse/templates/configmaps.yaml b/bitnami/discourse/templates/configmaps.yaml index 27e1c7f25b15bc..85b2742f8d6f41 100644 --- a/bitnami/discourse/templates/configmaps.yaml +++ b/bitnami/discourse/templates/configmaps.yaml @@ -4,7 +4,8 @@ metadata: name: {{ template "discourse.fullname" . }} labels: {{- include "discourse.labels" . | nindent 4 }} data: - DISCOURSE_HOSTNAME: {{ .Values.discourse.host | quote }} + {{- $port:=.Values.service.port | toString }} + DISCOURSE_HOSTNAME: "{{ include "discourse.host" . }}{{- if ne $port "80" }}:{{ .Values.service.port }}{{ end }}" DISCOURSE_USERNAME: {{ .Values.discourse.username | quote }} DISCOURSE_EMAIL: {{ .Values.discourse.email | quote }} DISCOURSE_SITENAME: {{ .Values.discourse.siteName | quote }} diff --git a/bitnami/discourse/templates/ingress.yaml b/bitnami/discourse/templates/ingress.yaml index 5e732dcb894e64..1abad83c101e55 100644 --- a/bitnami/discourse/templates/ingress.yaml +++ b/bitnami/discourse/templates/ingress.yaml @@ -6,7 +6,7 @@ apiVersion: extensions/v1beta1 {{- end }} kind: Ingress metadata: - name: {{ $fullName }} + name: {{ template "discourse.fullname" . }} labels: {{- include "discourse.labels" . | nindent 4 }} {{- if or .Values.ingress.annotations .Values.ingress.certManager }} annotations: diff --git a/bitnami/discourse/values.yaml b/bitnami/discourse/values.yaml index 140e9ed80e170a..873bb6146315a5 100644 --- a/bitnami/discourse/values.yaml +++ b/bitnami/discourse/values.yaml @@ -46,7 +46,7 @@ imagePullSecrets: [] # fullnameOverride: discourse: - ## Discourse host to create application URLs. You may also include the port. + ## Discourse host to create application URLs. The port will be automatilly included. ## ref: https://github.com/bitnami/bitnami-docker-discourse#configuration ## host: "" @@ -259,7 +259,7 @@ persistence: ## For minikube, set this to NodePort, elsewhere use LoadBalancer or ClusterIP ## service: - type: NodePort + type: LoadBalancer ## HTTP Port ## port: 80 @@ -279,7 +279,7 @@ service: ## nodePorts: ## http: nodePorts: - http: "30000" + http: "" ## Ingress paramaters ## From 16725097a1b7bc1b03ccf41813cac6cb8db83828 Mon Sep 17 00:00:00 2001 From: joancafom Date: Sun, 21 Jun 2020 23:45:35 +0200 Subject: [PATCH 30/35] Add minor improvements to templates I * Fix wrong helper function name * Add loadBalancerIP missing value * Standardize securityContext names to [pod/container]SecurityContext * Add support for optional liveness and readiness probes in sidekiq --- bitnami/discourse/README.md | 3 ++- bitnami/discourse/templates/deployment.yaml | 8 ++++++-- bitnami/discourse/templates/ingress.yaml | 4 ++-- bitnami/discourse/templates/service.yaml | 3 +++ bitnami/discourse/values-production.yaml | 6 ++++-- bitnami/discourse/values.yaml | 6 ++++-- 6 files changed, 21 insertions(+), 9 deletions(-) diff --git a/bitnami/discourse/README.md b/bitnami/discourse/README.md index 210a6afe4af1c7..6b14ec61201a0c 100644 --- a/bitnami/discourse/README.md +++ b/bitnami/discourse/README.md @@ -90,11 +90,12 @@ The following table lists the configurable parameters of the Discourse chart and |-------------------------------------------|---------------------------------------------------------------------------------------|--------------------------------------------------------------| | `service.type` | Kubernetes Service type | `LoadBalancer` | | `service.port` | Service HTTP port | `80` | +| `service.loadBalancerIP` | LoadBalancer service IP address | `nil` | | `service.externalTrafficPolicy` | Enable client source IP preservation | `Cluster` | | `service.annotations` | Service annotations | `{}` (evaluated as a template) | | `service.loadBalancerSourceRanges` | Restricts access for LoadBalancer (only with `service.type: LoadBalancer`) | `[]` | | `service.extraPorts` | Extra ports to expose in the service (normally used with the `sidecar` value) | `nil` | -| `service.nodePorts.http` | Kubernetes http node port | `30000` | +| `service.nodePorts.http` | Kubernetes http node port | `""` | ### Discourse parameters diff --git a/bitnami/discourse/templates/deployment.yaml b/bitnami/discourse/templates/deployment.yaml index 3a42f33d97b159..80e0342c67d957 100644 --- a/bitnami/discourse/templates/deployment.yaml +++ b/bitnami/discourse/templates/deployment.yaml @@ -26,7 +26,7 @@ spec: {{- end }} containers: - name: discourse - securityContext: {{- toYaml .Values.discourse.securityContext | nindent 12 }} + securityContext: {{- toYaml .Values.discourse.containerSecurityContext | nindent 12 }} image: {{ template "discourse.image" . }} imagePullPolicy: {{ .Values.image.pullPolicy | quote }} env: @@ -104,7 +104,7 @@ spec: resources: {{- toYaml .Values.discourse.resources | nindent 12 }} {{- end }} - name: sidekiq - securityContext: {{- toYaml .Values.sidekiq.securityContext | nindent 12 }} + securityContext: {{- toYaml .Values.sidekiq.containerSecurityContext | nindent 12 }} image: {{ template "discourse.image" . }} imagePullPolicy: {{ .Values.image.pullPolicy | quote }} command: ["/app-entrypoint.sh"] @@ -153,6 +153,7 @@ spec: - secretRef: name: {{ .Values.sidekiq.extraEnvVarsSecret }} {{- end }} + {{- if .Values.sidekiq.livenessProbe.enabled }} livenessProbe: exec: command: ["/bin/sh", "-c", "nami status discourse-sidekiq"] @@ -161,6 +162,8 @@ spec: timeoutSeconds: {{ .Values.sidekiq.livenessProbe.timeoutSeconds }} successThreshold: {{ .Values.sidekiq.livenessProbe.successThreshold }} failureThreshold: {{ .Values.sidekiq.livenessProbe.failureThreshold }} + {{- end }} + {{- if .Values.sidekiq.readinessProbe.enabled }} readinessProbe: exec: command: ["/bin/sh", "-c", "nami status discourse-sidekiq"] @@ -169,6 +172,7 @@ spec: timeoutSeconds: {{ .Values.sidekiq.readinessProbe.timeoutSeconds }} successThreshold: {{ .Values.sidekiq.readinessProbe.successThreshold }} failureThreshold: {{ .Values.sidekiq.readinessProbe.failureThreshold }} + {{- end }} volumeMounts: - name: discourse-data mountPath: /bitnami/discourse diff --git a/bitnami/discourse/templates/ingress.yaml b/bitnami/discourse/templates/ingress.yaml index 1abad83c101e55..bac0ed653b5b3a 100644 --- a/bitnami/discourse/templates/ingress.yaml +++ b/bitnami/discourse/templates/ingress.yaml @@ -36,7 +36,7 @@ spec: paths: - path: / backend: - serviceName: {{ template "wordpress.fullname" . }} + serviceName: {{ template "discourse.fullname" . }} servicePort: http {{- end }} {{- range .Values.ingress.extraHosts }} @@ -45,7 +45,7 @@ spec: paths: - path: {{ default "/" .path }} backend: - serviceName: {{ template "wordpress.fullname" $ }} + serviceName: {{ template "discourse.fullname" $ }} servicePort: http {{- end }} {{- end }} diff --git a/bitnami/discourse/templates/service.yaml b/bitnami/discourse/templates/service.yaml index d871736336bc03..639604d44a96f3 100644 --- a/bitnami/discourse/templates/service.yaml +++ b/bitnami/discourse/templates/service.yaml @@ -3,6 +3,9 @@ kind: Service metadata: name: {{ include "discourse.fullname" . }} labels: {{- include "discourse.labels" . | nindent 4 }} + {{- if .Values.service.annotations }} + annotations: {{- include "discourse.tplValue" (dict "value" .Values.service.annotations "context" $) | nindent 4 }} + {{- end }} spec: type: {{ .Values.service.type }} {{- if (or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort")) }} diff --git a/bitnami/discourse/values-production.yaml b/bitnami/discourse/values-production.yaml index a7be2f65773680..8eb07f6696da41 100644 --- a/bitnami/discourse/values-production.yaml +++ b/bitnami/discourse/values-production.yaml @@ -73,7 +73,7 @@ discourse: ## email: user@example.com - securityContext: {} + containerSecurityContext: {} ## capabilities: ## drop: ## - ALL @@ -140,7 +140,7 @@ discourse: sidekiq: - securityContext: {} + containerSecurityContext: {} ## capabilities: ## drop: ## - ALL @@ -270,6 +270,8 @@ service: port: 80 ## Node Ports to expose # nodePort: + ## Use loadBalancerIP to request a specific static IP, + # loadBalancerIP: ## Enable client source IP preservation ## ref http://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip ## diff --git a/bitnami/discourse/values.yaml b/bitnami/discourse/values.yaml index 873bb6146315a5..34ea2ed99ef0de 100644 --- a/bitnami/discourse/values.yaml +++ b/bitnami/discourse/values.yaml @@ -73,7 +73,7 @@ discourse: ## email: user@example.com - securityContext: {} + containerSecurityContext: {} ## capabilities: ## drop: ## - ALL @@ -140,7 +140,7 @@ discourse: sidekiq: - securityContext: {} + containerSecurityContext: {} ## capabilities: ## drop: ## - ALL @@ -265,6 +265,8 @@ service: port: 80 ## Node Ports to expose # nodePort: + ## Use loadBalancerIP to request a specific static IP, + # loadBalancerIP: ## Enable client source IP preservation ## ref http://kubernetes.io/docs/tasks/access-application-cluster/create-external-load-balancer/#preserving-the-client-source-ip ## From 568f855b75d41e9ac000c3511594c05df735e9da Mon Sep 17 00:00:00 2001 From: joancafom Date: Mon, 22 Jun 2020 19:03:00 +0200 Subject: [PATCH 31/35] Add improvements II * Capabilities for extraVolumes and extraVolumeMounts * Configurable commands for both containers * Add label and annotations at pod level * Add support for common annotations in every resource * Support for custom readiness and liveness probes --- bitnami/discourse/templates/configmaps.yaml | 3 + bitnami/discourse/templates/deployment.yaml | 50 ++++++++++--- bitnami/discourse/templates/ingress.yaml | 9 ++- bitnami/discourse/templates/pvc.yaml | 3 + bitnami/discourse/templates/secrets.yaml | 3 + bitnami/discourse/templates/service.yaml | 12 ++- .../discourse/templates/serviceaccount.yaml | 10 ++- bitnami/discourse/templates/tls-secrets.yaml | 3 + bitnami/discourse/values-production.yaml | 74 ++++++++++++++++++- bitnami/discourse/values.yaml | 71 ++++++++++++++++++ 10 files changed, 217 insertions(+), 21 deletions(-) diff --git a/bitnami/discourse/templates/configmaps.yaml b/bitnami/discourse/templates/configmaps.yaml index 85b2742f8d6f41..cafa5bd57f54e9 100644 --- a/bitnami/discourse/templates/configmaps.yaml +++ b/bitnami/discourse/templates/configmaps.yaml @@ -3,6 +3,9 @@ kind: ConfigMap metadata: name: {{ template "discourse.fullname" . }} labels: {{- include "discourse.labels" . | nindent 4 }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "discourse.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} data: {{- $port:=.Values.service.port | toString }} DISCOURSE_HOSTNAME: "{{ include "discourse.host" . }}{{- if ne $port "80" }}:{{ .Values.service.port }}{{ end }}" diff --git a/bitnami/discourse/templates/deployment.yaml b/bitnami/discourse/templates/deployment.yaml index 80e0342c67d957..188bebb3b1265c 100644 --- a/bitnami/discourse/templates/deployment.yaml +++ b/bitnami/discourse/templates/deployment.yaml @@ -5,6 +5,9 @@ metadata: name: {{ template "discourse.fullname" . }} labels: {{- include "discourse.labels" . | nindent 4 }} component: discourse + {{- if .Values.commonAnnotations }} + annotations: {{- include "discourse.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} spec: replicas: {{ .Values.replicaCount }} selector: @@ -17,18 +20,30 @@ spec: checksum/secret: {{ include (print $.Template.BasePath "/secrets.yaml") . | sha256sum }} labels: {{- include "discourse.labels" . | nindent 8 }} component: discourse + {{- if .Values.podLabels }} + {{- include "discourse.tplValue" (dict "value" .Values.podLabels "context" $) | nindent 8 }} + {{- end }} + {{- if .Values.podAnnotations }} + annotations: {{- include "discourse.tplValue" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }} + {{- end }} spec: - {{- include "discourse.imagePullSecrets" . | indent 6 }} + {{- include "discourse.imagePullSecrets" . | nindent 6 }} serviceAccountName: {{ include "discourse.serviceAccountName" . }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} {{- if .Values.initContainers }} - initContainers: {{- tpl (toYaml .Values.initContainers) $ | nindent 8 }} + initContainers: {{- include "discourse.tplValue" (dict "value" .Values.initContainers "context" $) | nindent 8 }} {{- end }} containers: - name: discourse securityContext: {{- toYaml .Values.discourse.containerSecurityContext | nindent 12 }} image: {{ template "discourse.image" . }} imagePullPolicy: {{ .Values.image.pullPolicy | quote }} + {{- if .Values.discourse.command }} + command: {{- include "discourse.tplValue" (dict "value" .Values.discourse.command "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.discourse.args }} + args: {{- include "discourse.tplValue" (dict "value" .Values.discourse.args "context" $) | nindent 12 }} + {{- end }} env: {{- if .Values.image.debug }} - name: NAMI_DEBUG @@ -57,7 +72,7 @@ spec: key: redis-password {{- end }} {{- if .Values.discourse.extraEnvVars }} - {{- tpl (toYaml .Values.discourse.extraEnvVars) $ | indent 12 }} + {{- include "discourse.tplValue" (dict "value" .Values.discourse.extraEnvVars "context" $) | indent 12 }} {{- end }} envFrom: - configMapRef: @@ -84,6 +99,8 @@ spec: timeoutSeconds: {{ .Values.discourse.livenessProbe.timeoutSeconds }} successThreshold: {{ .Values.discourse.livenessProbe.successThreshold }} failureThreshold: {{ .Values.discourse.livenessProbe.failureThreshold }} + {{- else if .Values.discourse.customLivenessProbe }} + livenessProbe: {{- include "discourse.tplValue" (dict "value" .Values.discourse.customLivenessProbe "context" $) | nindent 12 }} {{- end }} {{- if .Values.discourse.readinessProbe.enabled }} readinessProbe: @@ -95,11 +112,16 @@ spec: timeoutSeconds: {{ .Values.discourse.readinessProbe.timeoutSeconds }} successThreshold: {{ .Values.discourse.readinessProbe.successThreshold }} failureThreshold: {{ .Values.discourse.readinessProbe.failureThreshold }} + {{- else if .Values.discourse.customReadinessProbe }} + readinessProbe: {{- include "discourse.tplValue" (dict "value" .Values.discourse.customReadinessProbe "context" $) | nindent 12 }} {{- end }} volumeMounts: - name: discourse-data mountPath: /bitnami/discourse subPath: discourse + {{- if .Values.discourse.extraVolumeMounts }} + {{- include "discourse.tplValue" (dict "value" .Values.discourse.extraVolumeMounts "context" $) | nindent 12 }} + {{- end }} {{- if .Values.discourse.resources }} resources: {{- toYaml .Values.discourse.resources | nindent 12 }} {{- end }} @@ -107,12 +129,8 @@ spec: securityContext: {{- toYaml .Values.sidekiq.containerSecurityContext | nindent 12 }} image: {{ template "discourse.image" . }} imagePullPolicy: {{ .Values.image.pullPolicy | quote }} - command: ["/app-entrypoint.sh"] - args: - - nami - - start - - --foreground - - discourse-sidekiq + command: {{- include "discourse.tplValue" (dict "value" .Values.sidekiq.command "context" $) | nindent 12 }} + args: {{- include "discourse.tplValue" (dict "value" .Values.sidekiq.args "context" $) | nindent 12 }} env: {{- if .Values.image.debug }} - name: NAMI_DEBUG @@ -140,7 +158,7 @@ spec: key: redis-password {{- end }} {{- if .Values.sidekiq.extraEnvVars }} - {{- tpl (toYaml .Values.sidekiq.extraEnvVars) $ | indent 12 }} + {{- include "discourse.tplValue" (dict "value" .Values.sidekiq.extraEnvVars "context" $) | indent 12 }} {{- end }} envFrom: - configMapRef: @@ -162,6 +180,8 @@ spec: timeoutSeconds: {{ .Values.sidekiq.livenessProbe.timeoutSeconds }} successThreshold: {{ .Values.sidekiq.livenessProbe.successThreshold }} failureThreshold: {{ .Values.sidekiq.livenessProbe.failureThreshold }} + {{- else if .Values.sidekiq.customLivenessProbe }} + livenessProbe: {{- include "discourse.tplValue" (dict "value" .Values.sidekiq.customLivenessProbe "context" $) | nindent 12 }} {{- end }} {{- if .Values.sidekiq.readinessProbe.enabled }} readinessProbe: @@ -172,16 +192,21 @@ spec: timeoutSeconds: {{ .Values.sidekiq.readinessProbe.timeoutSeconds }} successThreshold: {{ .Values.sidekiq.readinessProbe.successThreshold }} failureThreshold: {{ .Values.sidekiq.readinessProbe.failureThreshold }} + {{- else if .Values.sidekiq.customReadinessProbe }} + readinessProbe: {{- include "discourse.tplValue" (dict "value" .Values.sidekiq.customReadinessProbe "context" $) | nindent 12 }} {{- end }} volumeMounts: - name: discourse-data mountPath: /bitnami/discourse subPath: discourse + {{- if .Values.sidekiq.extraVolumeMounts }} + {{- include "discourse.tplValue" (dict "value" .Values.sidekiq.extraVolumeMounts "context" $) | nindent 12 }} + {{- end }} {{- if .Values.sidekiq.resources }} resources: {{- toYaml .Values.sidekiq.resources | nindent 12 }} {{- end }} {{- if .Values.sidecars }} - {{- tpl (toYaml .Values.sidecars) $ | indent 8 }} + {{- include "discourse.tplValue" (dict "value" .Values.sidecars "context" $) | indent 8 }} {{- end }} volumes: - name: discourse-data @@ -191,6 +216,9 @@ spec: {{- else }} emptyDir: {} {{ end }} + {{- if .Values.extraVolumes }} + {{- include "discourse.tplValue" (dict "value" .Values.extraVolumes "context" $) | nindent 8 }} + {{- end }} {{- if .Values.affinity }} affinity: {{- include "discourse.tplValue" (dict "value" .Values.affinity "context" $) | nindent 8 }} {{- end }} diff --git a/bitnami/discourse/templates/ingress.yaml b/bitnami/discourse/templates/ingress.yaml index bac0ed653b5b3a..e9b5d283dda178 100644 --- a/bitnami/discourse/templates/ingress.yaml +++ b/bitnami/discourse/templates/ingress.yaml @@ -8,10 +8,13 @@ kind: Ingress metadata: name: {{ template "discourse.fullname" . }} labels: {{- include "discourse.labels" . | nindent 4 }} - {{- if or .Values.ingress.annotations .Values.ingress.certManager }} + {{- if or .Values.ingress.annotations .Values.ingress.certManager .Values.commonAnnotations }} annotations: - {{- with .Values.ingress.annotations }} - {{- toYaml . | nindent 4 }} + {{- if .Values.commonAnnotations }} + {{- include "discourse.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} + {{- if .Values.ingress.annotations }} + {{- toYaml .Values.ingress.annotations | nindent 4 }} {{- end }} {{- if .Values.ingress.certManager }} kubernetes.io/tls-acme: "true" diff --git a/bitnami/discourse/templates/pvc.yaml b/bitnami/discourse/templates/pvc.yaml index 34fb2877080bad..3513df5af56b0b 100644 --- a/bitnami/discourse/templates/pvc.yaml +++ b/bitnami/discourse/templates/pvc.yaml @@ -4,6 +4,9 @@ apiVersion: v1 metadata: name: {{ template "discourse.fullname" . }} labels: {{- include "discourse.labels" . | nindent 4 }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "discourse.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} spec: accessModes: - {{ .Values.persistence.accessMode | quote }} diff --git a/bitnami/discourse/templates/secrets.yaml b/bitnami/discourse/templates/secrets.yaml index a40701c7d6264a..1ef01f63fe9dcf 100644 --- a/bitnami/discourse/templates/secrets.yaml +++ b/bitnami/discourse/templates/secrets.yaml @@ -3,6 +3,9 @@ kind: Secret metadata: name: {{ template "discourse.fullname" . }} labels: {{- include "discourse.labels" . | nindent 4 }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "discourse.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} type: Opaque data: {{- if .Values.discourse.password }} diff --git a/bitnami/discourse/templates/service.yaml b/bitnami/discourse/templates/service.yaml index 639604d44a96f3..12415bc35c2360 100644 --- a/bitnami/discourse/templates/service.yaml +++ b/bitnami/discourse/templates/service.yaml @@ -3,8 +3,14 @@ kind: Service metadata: name: {{ include "discourse.fullname" . }} labels: {{- include "discourse.labels" . | nindent 4 }} + {{- if or .Values.service.annotations .Values.commonAnnotations}} + annotations: {{- if .Values.service.annotations }} - annotations: {{- include "discourse.tplValue" (dict "value" .Values.service.annotations "context" $) | nindent 4 }} + {{- include "discourse.tplValue" (dict "value" .Values.service.annotations "context" $) | nindent 4 }} + {{- end }} + {{- if .Values.commonAnnotations }} + {{- include "discourse.tplValue" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }} + {{- end }} {{- end }} spec: type: {{ .Values.service.type }} @@ -13,9 +19,7 @@ spec: {{- end }} {{- if (and (eq .Values.service.type "LoadBalancer") .Values.service.loadBalancerSourceRanges) }} loadBalancerSourceRanges: - {{- with .Values.service.loadBalancerSourceRanges }} - {{ toYaml . | indent 4 }} - {{- end }} + {{ toYaml .Values.service.loadBalancerSourceRanges | nindent 4 }} {{- end }} ports: - name: http diff --git a/bitnami/discourse/templates/serviceaccount.yaml b/bitnami/discourse/templates/serviceaccount.yaml index cd4a26635b54bc..a26beff162fe53 100644 --- a/bitnami/discourse/templates/serviceaccount.yaml +++ b/bitnami/discourse/templates/serviceaccount.yaml @@ -4,7 +4,13 @@ kind: ServiceAccount metadata: name: {{ include "discourse.serviceAccountName" . }} labels: {{- include "discourse.labels" . | nindent 4 }} - {{- with .Values.serviceAccount.annotations }} - annotations: {{- toYaml . | nindent 4 }} + {{- if or .Values.serviceAccount.annotations .Values.commonAnnotations }} + annotations: + {{- if .Values.serviceAccount.annotations }} + {{- toYaml .Values.serviceAccount.annotations | nindent 4 }} + {{- end }} + {{- if .Values.commonAnnotations }} + {{- include "discourse.tplValue" (dict "value" .Values.commonAnnotations "context" $) | nindent 4 }} + {{- end }} {{- end }} {{- end -}} diff --git a/bitnami/discourse/templates/tls-secrets.yaml b/bitnami/discourse/templates/tls-secrets.yaml index a4822440d6ef1a..25eba840aa5c60 100644 --- a/bitnami/discourse/templates/tls-secrets.yaml +++ b/bitnami/discourse/templates/tls-secrets.yaml @@ -5,6 +5,9 @@ kind: Secret metadata: name: {{ .name }} labels: {{- include "discourse.labels" . | nindent 4 }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "discourse.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} type: kubernetes.io/tls data: tls.crt: {{ .certificate | b64enc }} diff --git a/bitnami/discourse/values-production.yaml b/bitnami/discourse/values-production.yaml index 8eb07f6696da41..a75b50cf00ab27 100644 --- a/bitnami/discourse/values-production.yaml +++ b/bitnami/discourse/values-production.yaml @@ -46,7 +46,7 @@ imagePullSecrets: [] # fullnameOverride: discourse: - ## Discourse host to create application URLs. You may also include the port. + ## Discourse host to create application URLs. The port will be automatilly included. ## ref: https://github.com/bitnami/bitnami-docker-discourse#configuration ## host: "" @@ -73,6 +73,13 @@ discourse: ## email: user@example.com + ## Custom command to override image cmd + ## + # command: [] + + ## Custom args for the custom commad: + # args: [] + containerSecurityContext: {} ## capabilities: ## drop: @@ -116,6 +123,11 @@ discourse: failureThreshold: 6 successThreshold: 1 + ## Custom liveness and readiness probes, it overrides the default one (evaluated as a template) + ## + customLivenessProbe: {} + customReadinessProbe: {} + ## An array to add extra env vars ## For example: ## extraEnvVars: @@ -134,6 +146,15 @@ discourse: ## # extraEnvVarsSecret: "" + ## Additional volume mounts + ## Example: Mount CA file + ## extraVolumeMounts + ## - name: ca-cert + ## subPath: ca_cert + ## mountPath: /path/to/ca_cert + ## + extraVolumeMounts: [] + ## Do not run the Discourse installation wizard. ## Use only in case you are importing an existing database. skipInstall: false @@ -148,6 +169,14 @@ sidekiq: ## runAsNonRoot: true ## runAsUser: 1000 + ## Custom command to override image cmd + ## + command: ["/app-entrypoint.sh"] + + ## Custom args for the custom commad: + args: ["nami", "start", "--foreground", "discourse-sidekiq"] + + ## Sidekiq resource requests and limits ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ ## @@ -181,6 +210,11 @@ sidekiq: failureThreshold: 6 successThreshold: 1 + ## Custom liveness and readiness probes, it overrides the default one (evaluated as a template) + ## + customLivenessProbe: {} + customReadinessProbe: {} + ## An array to add extra env vars ## For example: ## extraEnvVars: @@ -198,6 +232,26 @@ sidekiq: ## # extraEnvVarsSecret: + ## Additional volume mounts + ## Example: Mount CA file + ## extraVolumeMounts + ## - name: ca-cert + ## subPath: ca_cert + ## mountPath: /path/to/ca_cert + ## + extraVolumeMounts: [] + +## Additional volumes +## Example: Add secret volume +## extraVolumes: +## - name: ca-cert +## secret: +## secretName: ca-cert +## items: +## - key: ca-cert +## path: ca_cert +## +extraVolumes: [] ## Add sidecars to the pod. ## Example: @@ -341,6 +395,24 @@ ingress: ## certificate: ## +## Additional pod annotations +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ +## +podAnnotations: {} + +## Additional pod labels +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ +## +podLabels: {} + +## Add labels to all the deployed resources +## +commonLabels: {} + +## Add annotations to all the deployed resources +## +commonAnnotations: {} + ## Node labels for pod assignment. Evaluated as a template. ## ref: https://kubernetes.io/docs/user-guide/node-selection/ ## diff --git a/bitnami/discourse/values.yaml b/bitnami/discourse/values.yaml index 34ea2ed99ef0de..d9e49ea7ad0427 100644 --- a/bitnami/discourse/values.yaml +++ b/bitnami/discourse/values.yaml @@ -73,6 +73,13 @@ discourse: ## email: user@example.com + ## Custom command to override image cmd + ## + # command: [] + + ## Custom args for the custom commad: + # args: [] + containerSecurityContext: {} ## capabilities: ## drop: @@ -116,6 +123,11 @@ discourse: failureThreshold: 6 successThreshold: 1 + ## Custom liveness and readiness probes, it overrides the default one (evaluated as a template) + ## + customLivenessProbe: {} + customReadinessProbe: {} + ## An array to add extra env vars ## For example: ## extraEnvVars: @@ -134,6 +146,15 @@ discourse: ## # extraEnvVarsSecret: "" + ## Additional volume mounts + ## Example: Mount CA file + ## extraVolumeMounts + ## - name: ca-cert + ## subPath: ca_cert + ## mountPath: /path/to/ca_cert + ## + extraVolumeMounts: [] + ## Do not run the Discourse installation wizard. ## Use only in case you are importing an existing database. skipInstall: false @@ -148,6 +169,13 @@ sidekiq: ## runAsNonRoot: true ## runAsUser: 1000 + ## Custom command to override image cmd + ## + command: ["/app-entrypoint.sh"] + + ## Custom args for the custom commad: + args: ["nami", "start", "--foreground", "discourse-sidekiq"] + ## Sidekiq resource requests and limits ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ ## @@ -181,6 +209,11 @@ sidekiq: failureThreshold: 6 successThreshold: 1 + ## Custom liveness and readiness probes, it overrides the default one (evaluated as a template) + ## + customLivenessProbe: {} + customReadinessProbe: {} + ## An array to add extra env vars ## For example: ## extraEnvVars: @@ -198,6 +231,26 @@ sidekiq: ## # extraEnvVarsSecret: + ## Additional volume mounts + ## Example: Mount CA file + ## extraVolumeMounts + ## - name: ca-cert + ## subPath: ca_cert + ## mountPath: /path/to/ca_cert + ## + extraVolumeMounts: [] + +## Additional volumes +## Example: Add secret volume +## extraVolumes: +## - name: ca-cert +## secret: +## secretName: ca-cert +## items: +## - key: ca-cert +## path: ca_cert +## +extraVolumes: [] ## Add sidecars to the pod. ## Example: @@ -336,6 +389,24 @@ ingress: ## certificate: ## +## Additional pod annotations +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ +## +podAnnotations: {} + +## Additional pod labels +## ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ +## +podLabels: {} + +## Add labels to all the deployed resources +## +commonLabels: {} + +## Add annotations to all the deployed resources +## +commonAnnotations: {} + ## Node labels for pod assignment. Evaluated as a template. ## ref: https://kubernetes.io/docs/user-guide/node-selection/ ## From e57186e155777266cdfb5ebf1d8e2ca57b4ddc0c Mon Sep 17 00:00:00 2001 From: joancafom Date: Tue, 23 Jun 2020 13:37:07 +0200 Subject: [PATCH 32/35] Add improvements III * Add commonLabels for all deployed resources * Massive update on README.md * Add comment on both values --- bitnami/discourse/README.md | 118 ++++++++++-------- bitnami/discourse/templates/configmaps.yaml | 3 + bitnami/discourse/templates/deployment.yaml | 3 + bitnami/discourse/templates/ingress.yaml | 3 + bitnami/discourse/templates/pvc.yaml | 3 + bitnami/discourse/templates/secrets.yaml | 3 + bitnami/discourse/templates/service.yaml | 3 + .../discourse/templates/serviceaccount.yaml | 3 + bitnami/discourse/templates/tls-secrets.yaml | 3 + bitnami/discourse/values-production.yaml | 1 + bitnami/discourse/values.yaml | 1 + 11 files changed, 93 insertions(+), 51 deletions(-) diff --git a/bitnami/discourse/README.md b/bitnami/discourse/README.md index 6b14ec61201a0c..1b36553da1ff35 100644 --- a/bitnami/discourse/README.md +++ b/bitnami/discourse/README.md @@ -13,9 +13,9 @@ $ helm install my-release bitnami/discourse This chart bootstraps a [Discourse](https://www.discourse.org/) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. -It also packages [Bitnami Postgresql](https://github.com/bitnami/charts/tree/master/bitnami/postgresql) and [Bitnami Redis](https://github.com/bitnami/charts/tree/master/bitnami/redis) which are required as a database for the Discourse application. +It also packages [Bitnami Postgresql](https://github.com/bitnami/charts/tree/master/bitnami/postgresql) and [Bitnami Redis](https://github.com/bitnami/charts/tree/master/bitnami/redis) which are required as databases for the Discourse application. -Bitnami charts can be used with [Kubeapps](https://kubeapps.com/) for deployment and management of Helm Charts in clusters. This chart has been tested to work with NGINX Ingress, cert-manager, fluentd and Prometheus on top of the [BKPR](https://kubeprod.io/). +Bitnami charts can be used with [Kubeapps](https://kubeapps.com/) for deployment and management of Helm Charts in clusters. ## Prerequisites @@ -65,21 +65,26 @@ The following table lists the configurable parameters of the Discourse chart and | `image.repository` | Discourse image name | `bitnami/discouse` | | `image.tag` | Discourse image tag | `{TAG_NAME}` | | `image.pullPolicy` | Discourse image pull policy | `IfNotPresent` | -| `imagePullSecrets` | Specify docker-registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) | | `image.debug` | Specify if debug logs should be enabled | `false` | +| `imagePullSecrets` | Specify docker-registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) | | `nameOverride` | String to partially override discourse.fullname | `nil` | | `fullnameOverride` | String to fully override discourse.fullname | `nil` | +| `extraVolumes` | Array of extra volumes to be added deployment. Requires setting `extraVolumeMounts` | `[]` (evaluated as a template) | | `sidecars` | Attach additional sidecar containers to the pod | `[]` (evaluated as a template) | | `initContainers` | Additional init containers to add to the pods | `[]` (evaluated as a template) | | `serviceAccount.create` | Whether the service account should be created | `false` | -| `serviceAccount.annotations` | Annotations to add to the service account | `false` | -| `serviceAccount.name` | Name to be used for the service account | `false` | +| `serviceAccount.annotations` | Annotations to add to the service account | `{}` | +| `serviceAccount.name` | Name to be used for the service account | `""` | | `podSecurityContext` | Pod security context specification | `{}` | | `persistence.enabled` | Whether to enable persistence based on Persistent Volume Claims | `true` | | `persistence.storageClass` | PVC Storage Class | `nil` | | `persistence.existingClaim` | Name of an existing PVC to reuse | `nil` | | `persistence.accessMode` | PVC Access Mode (RWO, ROX, RWX) | `ReadWriteOnce` | | `persistence.size` | Size of the PVC to request | `10Gi` | +| `podAnnotations` | Additional pod annotations | `{}` | +| `podLabels` | Additional pod labels | `{}` (evaluated as a template) | +| `commonLabels` | Labels to be added to all deployed resources | `{}` (evaluated as a template) | +| `commonAnnotations` | Annotations to be added to all deployed resources | `{}` (evaluated as a template) | | `nodeSelector` | Node labels for pod assignment. | `{}` (evaluated as a template) | | `tolerations` | Tolerations for pod assignment. | `[]` (evaluated as a template) | | `affinity` | Affinity for pod assignment | `{}` (evaluated as a template) | @@ -90,6 +95,7 @@ The following table lists the configurable parameters of the Discourse chart and |-------------------------------------------|---------------------------------------------------------------------------------------|--------------------------------------------------------------| | `service.type` | Kubernetes Service type | `LoadBalancer` | | `service.port` | Service HTTP port | `80` | +| `service.nodePort` | NodePort service IP address | `nil` | | `service.loadBalancerIP` | LoadBalancer service IP address | `nil` | | `service.externalTrafficPolicy` | Enable client source IP preservation | `Cluster` | | `service.annotations` | Service annotations | `{}` (evaluated as a template) | @@ -101,51 +107,61 @@ The following table lists the configurable parameters of the Discourse chart and | Parameter | Description | Default | |-------------------------------------------|---------------------------------------------------------------------------------------|--------------------------------------------------------------| -| `host` | Discourse host to create application URLs (include the port if =/= 80) | `""` | -| `siteName` | Discourse site name | `My Site!` | -| `username` | Admin user of the application | `user` | -| `email ` | Admin user email of the application | `user@example.com` | -| `password` | Application password (min length of 10 chars) | _random 10 character long alphanumeric string_ | -| `securityContext` | Container security context specification | `{}` | -| `resources` | Discourse container's resource requests and limits | `{}` | -| `livenessProbe.enabled` | Enable/disable livenessProbe | `true` | -| `livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | `500` | -| `livenessProbe.periodSeconds` | How often to perform the probe | `10` | -| `livenessProbe.timeoutSeconds` | When the probe times out | `5` | -| `livenessProbe.failureThreshold` | Minimum consecutive failures for the probe | `6` | -| `livenessProbe.successThreshold` | Minimum consecutive successes for the probe | `1` | -| `readinessProbe.enabled` | Enable/disable readinessProbe | `true` | -| `readinessProbe.initialDelaySeconds` | Delay before readiness probe is initiated | `30` | -| `readinessProbe.periodSeconds` | How often to perform the probe | `10` | -| `readinessProbe.timeoutSeconds` | When the probe times out | `5` | -| `readinessProbe.failureThreshold` | Minimum consecutive failures for the probe | `6` | -| `readinessProbe.successThreshold` | Minimum consecutive successes for the probe | `1` | -| `extraEnvVars` | An array to add extra env vars | `[]` | -| `extraEnvVarsCM` | Array to add extra configmaps | `[]` | -| `extraEnvVarsSecret` | Array to add extra environment from a Secret | `nil` | -| `skipInstall` | Do not run the Discourse installation wizard | `false` | +| `discourse.host` | Discourse host to create application URLs (include the port if =/= 80) | `""` | +| `discourse.siteName` | Discourse site name | `My Site!` | +| `discourse.username` | Admin user of the application | `user` | +| `discourse.password` | Application password (min length of 10 chars) | _random 10 character long alphanumeric string_ | +| `discourse.email` | Admin user email of the application | `user@example.com` | +| `discourse.command` | Custom command to override image cmd | `nil` (evaluated as a template) | +| `discourse.args` | Custom args for the custom commad | `nil` (evaluated as a template) | +| `discourse.containerSecurityContext` | Container security context specification | `{}` | +| `discourse.resources` | Discourse container's resource requests and limits | `{}` | +| `discourse.livenessProbe.enabled` | Enable/disable livenessProbe | `true` | +| `discourse.livenessProbe.initialDelaySeconds`| Delay before liveness probe is initiated | `500` | +| `discourse.livenessProbe.periodSeconds` | How often to perform the probe | `10` | +| `discourse.livenessProbe.timeoutSeconds` | When the probe times out | `5` | +| `discourse.livenessProbe.failureThreshold`| Minimum consecutive failures for the probe | `6` | +| `discourse.livenessProbe.successThreshold`| Minimum consecutive successes for the probe | `1` | +| `discourse.readinessProbe.enabled` | Enable/disable readinessProbe | `true` | +| `discourse.readinessProbe.initialDelaySeconds`| Delay before readiness probe is initiated | `30` | +| `discourse.readinessProbe.periodSeconds` | How often to perform the probe | `10` | +| `discourse.readinessProbe.timeoutSeconds` | When the probe times out | `5` | +| `discourse.readinessProbe.failureThreshold`| Minimum consecutive failures for the probe | `6` | +| `discourse.readinessProbe.successThreshold`| Minimum consecutive successes for the probe | `1` | +| `discourse.customLivenessProbe` | Custom liveness probe to execute (when the main one is disabled) | `{}` (evaluated as a template) | +| `discourse.customReadinessProbe` | Custom readiness probe to execute (when the main one is disabled) | `{}` (evaluated as a template) | +| `discourse.extraEnvVars` | An array to add extra env vars | `[]` (evaluated as a template) | +| `discourse.extraEnvVarsCM` | Array to add extra configmaps | `[]` | +| `discourse.extraEnvVarsSecret` | Array to add extra environment from a Secret | `nil` | +| `discourse.extraVolumeMounts` | Additional volume mounts (used along with `extraVolumes`) | `[]` (evaluated as a template) | +| `discourse.skipInstall` | Do not run the Discourse installation wizard | `false` | ### Sidekiq parameters | Parameter | Description | Default | |-------------------------------------------|---------------------------------------------------------------------------------------|--------------------------------------------------------------| -| `securityContext` | Container security context specification | `{}` | -| `resources` | Discourse container's resource requests and limits | `{}` | -| `livenessProbe.enabled` | Enable/disable livenessProbe | `true` | -| `livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | `500` | -| `livenessProbe.periodSeconds` | How often to perform the probe | `10` | -| `livenessProbe.timeoutSeconds` | When the probe times out | `5` | -| `livenessProbe.failureThreshold` | Minimum consecutive failures for the probe | `6` | -| `livenessProbe.successThreshold` | Minimum consecutive successes for the probe | `1` | -| `readinessProbe.enabled` | Enable/disable readinessProbe | `true` | -| `readinessProbe.initialDelaySeconds` | Delay before readiness probe is initiated | `30` | -| `readinessProbe.periodSeconds` | How often to perform the probe | `10` | -| `readinessProbe.timeoutSeconds` | When the probe times out | `5` | -| `readinessProbe.failureThreshold` | Minimum consecutive failures for the probe | `6` | -| `readinessProbe.successThreshold` | Minimum consecutive successes for the probe | `1` | -| `extraEnvVars` | An array to add extra env vars | `[]` | -| `extraEnvVarsCM` | Array to add extra configmaps | `[]` | -| `extraEnvVarsSecret` | Array to add extra environment from a Secret | `nil` | +| `sidekiq.containerSecurityContext` | Container security context specification | `{}` | +| `sidekiq.command` | Custom command to override image cmd (evaluated as a template) | `["/app-entrypoint.sh"]` | +| `sidekiq.args` | Custom args for the custom commad (evaluated as a template) | `["nami", "start", "--foreground", "discourse-sidekiq"` | +| `sidekiq.resources` | Sidekiq container's resource requests and limits | `{}` | +| `sidekiq.livenessProbe.enabled` | Enable/disable livenessProbe | `true` | +| `sidekiq.livenessProbe.initialDelaySeconds`| Delay before liveness probe is initiated | `500` | +| `sidekiq.livenessProbe.periodSeconds` | How often to perform the probe | `10` | +| `sidekiq.livenessProbe.timeoutSeconds` | When the probe times out | `5` | +| `sidekiq.livenessProbe.failureThreshold` | Minimum consecutive failures for the probe | `6` | +| `sidekiq.livenessProbe.successThreshold` | Minimum consecutive successes for the probe | `1` | +| `sidekiq.readinessProbe.enabled` | Enable/disable readinessProbe | `true` | +| `sidekiq.readinessProbe.initialDelaySeconds`| Delay before readiness probe is initiated | `30` | +| `sidekiq.readinessProbe.periodSeconds` | How often to perform the probe | `10` | +| `sidekiq.readinessProbe.timeoutSeconds` | When the probe times out | `5` | +| `sidekiq.readinessProbe.failureThreshold` | Minimum consecutive failures for the probe | `6` | +| `sidekiq.readinessProbe.successThreshold` | Minimum consecutive successes for the probe | `1` | +| `sidekiq.customLivenessProbe` | Custom liveness probe to execute (when the main one is disabled) | `{}` (evaluated as a template) | +| `sidekiq.customReadinessProbe` | Custom readiness probe to execute (when the main one is disabled) | `{}` (evaluated as a template) | +| `sidekiq.extraEnvVars` | An array to add extra env vars | `[]` (evaluated as a template) | +| `sidekiq.extraEnvVarsCM` | Array to add extra configmaps | `[]` | +| `sidekiq.extraEnvVarsSecret` | Array to add extra environment from a Secret | `nil` | +| `discourse.extraVolumeMounts` | Additional volume mounts (used along with `extraVolumes`) | `[]` (evaluated as a template) | ### Ingress parameters @@ -155,7 +171,7 @@ The following table lists the configurable parameters of the Discourse chart and | `ingress.certManager` | Add annotations for cert-manager | `false` | | `ingress.hostname` | Default host for the ingress resource | `discourse.local` | | `ingress.tls` | Create TLS Secret | `false` | -| `ingress.annotations` | Ingress annotations | `[]` (evaluated as a template) | +| `ingress.annotations` | Ingress annotations | `{}` (evaluated as a template) | | `ingress.extraHosts[0].name` | Additional hostnames to be covered | `nil` | | `ingress.extraHosts[0].path` | Additional hostnames to be covered | `nil` | | `ingress.extraTls[0].hosts[0]` | TLS configuration for additional hostnames to be covered | `nil` | @@ -178,7 +194,7 @@ The following table lists the configurable parameters of the Discourse chart and | `externalDatabase.port` | Database port number | `5432` | | `externalDatabase.user` | Existing username in the external db | `bn_discourse` | | `externalDatabase.password` | Password for the above username | `nil` | -| `externalDatabase.postgresqlPostgresPassword`| Password for the root "postgres" user | `nil` | +| `externalDatabase.postgresqlPostgresPassword`| Password for the root "postgres" user (used in the installation stage) | `nil` | | `externalDatabase.database` | Name of the existing database | `bitnami_application` | ### Redis parameters @@ -226,7 +242,7 @@ Bitnami will release a new chart updating its containers if a new version of the By default, this Chart only deploys a single pod running Discourse. Should you want to increase the number of replicas, you may follow these simple steps to ensure everything works smoothly: -> **Tip**: Running these steps ensures the PostgreSQL instance to be correctly populated. If you already have an initialised DB, you may directly create a release with the desired number of replicas. Remind to set `discourse.skipInstall` to `true`! +> **Tip**: Running these steps ensures the PostgreSQL instance is correctly populated. If you already have an initialised DB, you may directly create a release with the desired number of replicas. Remind to set `discourse.skipInstall` to `true`! 1. Create a conventional release, that will be scaled later: ```console @@ -293,7 +309,7 @@ Note that [values-production.yaml](values-production.yaml) specifies ReadWriteMa ### Sidecars -If you have a need for additional containers to run within the same pod as Discourse (e.g. an additional metrics or logging exporter), you can do so via the `sidecars` config parameter. Simply define your container according to the Kubernetes container spec. +If you have a need for additional containers to run within the same pod as Discourse (e.g. metrics or logging exporter), you can do so via the `sidecars` config parameter. Simply define your container according to the Kubernetes container spec. ```yaml sidecars: @@ -330,7 +346,7 @@ externalDatabase.database=mydatabase externalDatabase.port=5432 ``` -Note also if you disable PostgreSQL per above you MUST supply values for the `externalDatabase` connection. +Note also that if you disable PostgreSQL per above you MUST supply values for the `externalDatabase` connection. In case the database already contains data from a previous Discourse installation, you need to set the `discourse.skipInstall` parameter to _true_. Otherwise, the container would execute the installation wizard and could modify the existing data in the database. This parameter force the container to not execute the Discourse installation wizard. @@ -351,7 +367,7 @@ To enable ingress integration, please set `ingress.enabled` to `true` ### Hosts -Most likely you will only want to have one hostname that maps to this Discourse installation. If that's your case, the property `ingress.hostname` will set it. However, it is possible to have more than one host. To facilitate this, the `ingress.extraHosts` object is can be specified as an array. +Most likely you will only want to have one hostname that maps to this Discourse installation. If that's your case, the property `ingress.hostname` will set it. However, it is possible to have more than one host. To facilitate this, the `ingress.extraHosts` object can be specified as an array. For each host indicated at `ingress.extraHosts`, please indicate a `name`, `path`, and any `annotations` that you may want the ingress controller to know about. diff --git a/bitnami/discourse/templates/configmaps.yaml b/bitnami/discourse/templates/configmaps.yaml index cafa5bd57f54e9..8cb4052a84ae22 100644 --- a/bitnami/discourse/templates/configmaps.yaml +++ b/bitnami/discourse/templates/configmaps.yaml @@ -3,6 +3,9 @@ kind: ConfigMap metadata: name: {{ template "discourse.fullname" . }} labels: {{- include "discourse.labels" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "discourse.tplValue" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} {{- if .Values.commonAnnotations }} annotations: {{- include "discourse.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} diff --git a/bitnami/discourse/templates/deployment.yaml b/bitnami/discourse/templates/deployment.yaml index 188bebb3b1265c..091a8112f9e990 100644 --- a/bitnami/discourse/templates/deployment.yaml +++ b/bitnami/discourse/templates/deployment.yaml @@ -5,6 +5,9 @@ metadata: name: {{ template "discourse.fullname" . }} labels: {{- include "discourse.labels" . | nindent 4 }} component: discourse + {{- if .Values.commonLabels }} + {{- include "discourse.tplValue" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} {{- if .Values.commonAnnotations }} annotations: {{- include "discourse.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} diff --git a/bitnami/discourse/templates/ingress.yaml b/bitnami/discourse/templates/ingress.yaml index e9b5d283dda178..d4520d4d29d169 100644 --- a/bitnami/discourse/templates/ingress.yaml +++ b/bitnami/discourse/templates/ingress.yaml @@ -8,6 +8,9 @@ kind: Ingress metadata: name: {{ template "discourse.fullname" . }} labels: {{- include "discourse.labels" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "discourse.tplValue" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} {{- if or .Values.ingress.annotations .Values.ingress.certManager .Values.commonAnnotations }} annotations: {{- if .Values.commonAnnotations }} diff --git a/bitnami/discourse/templates/pvc.yaml b/bitnami/discourse/templates/pvc.yaml index 3513df5af56b0b..8dd170a9677cd4 100644 --- a/bitnami/discourse/templates/pvc.yaml +++ b/bitnami/discourse/templates/pvc.yaml @@ -4,6 +4,9 @@ apiVersion: v1 metadata: name: {{ template "discourse.fullname" . }} labels: {{- include "discourse.labels" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "discourse.tplValue" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} {{- if .Values.commonAnnotations }} annotations: {{- include "discourse.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} diff --git a/bitnami/discourse/templates/secrets.yaml b/bitnami/discourse/templates/secrets.yaml index 1ef01f63fe9dcf..0cb0d7dd770147 100644 --- a/bitnami/discourse/templates/secrets.yaml +++ b/bitnami/discourse/templates/secrets.yaml @@ -3,6 +3,9 @@ kind: Secret metadata: name: {{ template "discourse.fullname" . }} labels: {{- include "discourse.labels" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "discourse.tplValue" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} {{- if .Values.commonAnnotations }} annotations: {{- include "discourse.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} diff --git a/bitnami/discourse/templates/service.yaml b/bitnami/discourse/templates/service.yaml index 12415bc35c2360..c0c53d3194ec56 100644 --- a/bitnami/discourse/templates/service.yaml +++ b/bitnami/discourse/templates/service.yaml @@ -3,6 +3,9 @@ kind: Service metadata: name: {{ include "discourse.fullname" . }} labels: {{- include "discourse.labels" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "discourse.tplValue" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} {{- if or .Values.service.annotations .Values.commonAnnotations}} annotations: {{- if .Values.service.annotations }} diff --git a/bitnami/discourse/templates/serviceaccount.yaml b/bitnami/discourse/templates/serviceaccount.yaml index a26beff162fe53..d87dae1b3594e0 100644 --- a/bitnami/discourse/templates/serviceaccount.yaml +++ b/bitnami/discourse/templates/serviceaccount.yaml @@ -4,6 +4,9 @@ kind: ServiceAccount metadata: name: {{ include "discourse.serviceAccountName" . }} labels: {{- include "discourse.labels" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "discourse.tplValue" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} {{- if or .Values.serviceAccount.annotations .Values.commonAnnotations }} annotations: {{- if .Values.serviceAccount.annotations }} diff --git a/bitnami/discourse/templates/tls-secrets.yaml b/bitnami/discourse/templates/tls-secrets.yaml index 25eba840aa5c60..62d996834967d8 100644 --- a/bitnami/discourse/templates/tls-secrets.yaml +++ b/bitnami/discourse/templates/tls-secrets.yaml @@ -5,6 +5,9 @@ kind: Secret metadata: name: {{ .name }} labels: {{- include "discourse.labels" . | nindent 4 }} + {{- if .Values.commonLabels }} + {{- include "discourse.tplValue" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} {{- if .Values.commonAnnotations }} annotations: {{- include "discourse.tplValue" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} {{- end }} diff --git a/bitnami/discourse/values-production.yaml b/bitnami/discourse/values-production.yaml index a75b50cf00ab27..2595c2de9698e2 100644 --- a/bitnami/discourse/values-production.yaml +++ b/bitnami/discourse/values-production.yaml @@ -442,6 +442,7 @@ postgresql: postgresqlUsername: bn_discourse ## PostgreSQL password + ## Defaults to a random 10-character alphanumeric string if not set ## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md#setting-the-root-password-on-first-run ## ## postgresqlPassword: diff --git a/bitnami/discourse/values.yaml b/bitnami/discourse/values.yaml index d9e49ea7ad0427..1267970c8b38bf 100644 --- a/bitnami/discourse/values.yaml +++ b/bitnami/discourse/values.yaml @@ -436,6 +436,7 @@ postgresql: postgresqlUsername: bn_discourse ## PostgreSQL password + ## Defaults to a random 10-character alphanumeric string if not set ## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md#setting-the-root-password-on-first-run ## ## postgresqlPassword: From d94a7a5b01464b5b7de1a92de66565e610571ef6 Mon Sep 17 00:00:00 2001 From: joancafom Date: Tue, 23 Jun 2020 18:04:48 +0200 Subject: [PATCH 33/35] Add warning comments in NOTES.txt --- bitnami/discourse/templates/NOTES.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bitnami/discourse/templates/NOTES.txt b/bitnami/discourse/templates/NOTES.txt index 0ecc89e689221d..398ea18ca8cc1b 100644 --- a/bitnami/discourse/templates/NOTES.txt +++ b/bitnami/discourse/templates/NOTES.txt @@ -147,3 +147,9 @@ WARNING: Rolling tag detected ({{ .Values.image.repository }}:{{ .Values.image.t +info https://docs.bitnami.com/containers/how-to/understand-rolling-tags-containers/ {{- end }} + +{{ if and .Values.postgresql.enabled (eq .Values.postgresql.postgresqlPostgresPassword "bitnami") -}} +##################################################################################### +### WARNING: You did not change the default password for the PostgreSQL root user ### +##################################################################################### +{{- end }} From 3fdae969c508629c79d688f14df4dbd743245f5e Mon Sep 17 00:00:00 2001 From: joancafom Date: Tue, 23 Jun 2020 18:11:19 +0200 Subject: [PATCH 34/35] Apply formatting to both values files --- bitnami/discourse/values-production.yaml | 30 +++++++++++++++++++++++- bitnami/discourse/values.yaml | 29 +++++++++++++++++++++++ 2 files changed, 58 insertions(+), 1 deletion(-) diff --git a/bitnami/discourse/values-production.yaml b/bitnami/discourse/values-production.yaml index 2595c2de9698e2..99ef01244f5aba 100644 --- a/bitnami/discourse/values-production.yaml +++ b/bitnami/discourse/values-production.yaml @@ -87,6 +87,7 @@ discourse: ## readOnlyRootFilesystem: true ## runAsNonRoot: true ## runAsUser: 1000 + ## ## Discourse container's resource requests and limits ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ @@ -107,6 +108,7 @@ discourse: ## WARNING: Discourse installation process may take up some time and ## setting inappropriate values here may lead to pods failure. ## ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes + ## livenessProbe: enabled: true initialDelaySeconds: 500 @@ -157,6 +159,7 @@ discourse: ## Do not run the Discourse installation wizard. ## Use only in case you are importing an existing database. + ## skipInstall: false sidekiq: @@ -168,15 +171,16 @@ sidekiq: ## readOnlyRootFilesystem: true ## runAsNonRoot: true ## runAsUser: 1000 + ## ## Custom command to override image cmd ## command: ["/app-entrypoint.sh"] ## Custom args for the custom commad: + ## args: ["nami", "start", "--foreground", "discourse-sidekiq"] - ## Sidekiq resource requests and limits ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ ## @@ -194,6 +198,7 @@ sidekiq: ## Sidekiq extra options for liveness and readiness probes ## ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes + ## livenessProbe: enabled: true initialDelaySeconds: 500 @@ -275,19 +280,24 @@ sidecars: [] ## ports: ## - name: portname ## containerPort: 1234 +## initContainers: [] serviceAccount: ## Specifies whether a service account should be created + ## create: false ## Annotations to add to the service account + ## annotations: {} ## The name of the service account to use. ## If not set and create is true, a name is generated using the fullname template + ## name: podSecurityContext: {} ## fsGroup: 2000 +## ## Enable persistence using Persistent Volume Claims ## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ @@ -333,12 +343,14 @@ service: annotations: {} ## Limits which cidr blocks can connect to service's load balancer ## Only valid if service.type: LoadBalancer + ## loadBalancerSourceRanges: [] ## Extra ports to expose (normally used with the `sidecar` value) # extraPorts: ## nodePorts: ## http: + ## nodePorts: http: "" @@ -439,6 +451,7 @@ postgresql: enabled: true ## PostgreSQL user (has superuser privileges if username is `postgres`) ## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md#setting-the-root-password-on-first-run + ## postgresqlUsername: bn_discourse ## PostgreSQL password @@ -446,9 +459,11 @@ postgresql: ## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md#setting-the-root-password-on-first-run ## ## postgresqlPassword: + ## ## PostgreSQL admin password (used when `postgresqlUsername` is not `postgres`) ## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md#creating-a-database-user-on-first-run (see note!) + ## postgresqlPostgresPassword: "bitnami" ## Create a database @@ -457,6 +472,7 @@ postgresql: postgresqlDatabase: bitnami_application ## PostgreSQL data Persistent Volume Storage Class + ## persistence: enabled: true @@ -465,16 +481,22 @@ postgresql: ## externalDatabase: ## Database host + ## host: "" ## Database port + ## port: 5432 ## non-root Username for Discourse Database + ## user: bn_discourse ## Database password + ## password: ## Root "postgres" password (used in the installation stage) + ## postgresqlPostgresPassword: ## Database name + ## database: bitnami_application ## Redis chart configuration @@ -483,8 +505,10 @@ externalDatabase: ## redis: ## Whether to deploy a redis server to satisfy the applications requirements. To use an external redis instance set this to false and configure the externalRedis parameters + ## enabled: true ## Use password authentication + ## usePassword: true ## Redis password (both master and slave) ## Defaults to a random 10-character alphanumeric string if not set and usePassword is true @@ -493,6 +517,7 @@ redis: # password: ## Cluster settings + ## cluster: enabled: false @@ -508,8 +533,11 @@ redis: ## externalRedis: ## Redis host + ## host: "" ## Redis port + ## port: 6379 ## Redis password for authentication + ## password: "" diff --git a/bitnami/discourse/values.yaml b/bitnami/discourse/values.yaml index 1267970c8b38bf..d69f17b7de1adc 100644 --- a/bitnami/discourse/values.yaml +++ b/bitnami/discourse/values.yaml @@ -87,6 +87,7 @@ discourse: ## readOnlyRootFilesystem: true ## runAsNonRoot: true ## runAsUser: 1000 + ## ## Discourse container's resource requests and limits ## ref: http://kubernetes.io/docs/user-guide/compute-resources/ @@ -107,6 +108,7 @@ discourse: ## WARNING: Discourse installation process may take up some time and ## setting inappropriate values here may lead to pods failure. ## ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes + ## livenessProbe: enabled: true initialDelaySeconds: 500 @@ -157,6 +159,7 @@ discourse: ## Do not run the Discourse installation wizard. ## Use only in case you are importing an existing database. + ## skipInstall: false sidekiq: @@ -168,12 +171,14 @@ sidekiq: ## readOnlyRootFilesystem: true ## runAsNonRoot: true ## runAsUser: 1000 + ## ## Custom command to override image cmd ## command: ["/app-entrypoint.sh"] ## Custom args for the custom commad: + ## args: ["nami", "start", "--foreground", "discourse-sidekiq"] ## Sidekiq resource requests and limits @@ -193,6 +198,7 @@ sidekiq: ## Sidekiq extra options for liveness and readiness probes ## ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-lifecycle/#container-probes + ## livenessProbe: enabled: true initialDelaySeconds: 500 @@ -274,19 +280,24 @@ sidecars: [] ## ports: ## - name: portname ## containerPort: 1234 +## initContainers: [] serviceAccount: ## Specifies whether a service account should be created + ## create: false ## Annotations to add to the service account + ## annotations: {} ## The name of the service account to use. ## If not set and create is true, a name is generated using the fullname template + ## name: podSecurityContext: {} ## fsGroup: 2000 +## ## Enable persistence using Persistent Volume Claims ## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ @@ -327,12 +338,14 @@ service: annotations: {} ## Limits which cidr blocks can connect to service's load balancer ## Only valid if service.type: LoadBalancer + ## loadBalancerSourceRanges: [] ## Extra ports to expose (normally used with the `sidecar` value) # extraPorts: ## nodePorts: ## http: + ## nodePorts: http: "" @@ -433,6 +446,7 @@ postgresql: enabled: true ## PostgreSQL user (has superuser privileges if username is `postgres`) ## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md#setting-the-root-password-on-first-run + ## postgresqlUsername: bn_discourse ## PostgreSQL password @@ -440,9 +454,11 @@ postgresql: ## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md#setting-the-root-password-on-first-run ## ## postgresqlPassword: + ## ## PostgreSQL admin password (used when `postgresqlUsername` is not `postgres`) ## ref: https://github.com/bitnami/bitnami-docker-postgresql/blob/master/README.md#creating-a-database-user-on-first-run (see note!) + ## postgresqlPostgresPassword: "bitnami" ## Create a database @@ -451,6 +467,7 @@ postgresql: postgresqlDatabase: bitnami_application ## PostgreSQL data Persistent Volume Storage Class + ## persistence: enabled: true @@ -459,16 +476,22 @@ postgresql: ## externalDatabase: ## Database host + ## host: "" ## Database port + ## port: 5432 ## non-root Username for Discourse Database + ## user: bn_discourse ## Database password + ## password: ## Root "postgres" password (used in the installation stage) + ## postgresqlPostgresPassword: ## Database name + ## database: bitnami_application ## Redis chart configuration @@ -477,8 +500,10 @@ externalDatabase: ## redis: ## Whether to deploy a redis server to satisfy the applications requirements. To use an external redis instance set this to false and configure the externalRedis parameters + ## enabled: true ## Use password authentication + ## usePassword: false ## Redis password (both master and slave) ## Defaults to a random 10-character alphanumeric string if not set and usePassword is true @@ -487,6 +512,7 @@ redis: # password: ## Cluster settings + ## cluster: enabled: false @@ -502,8 +528,11 @@ redis: ## externalRedis: ## Redis host + ## host: "" ## Redis port + ## port: 6379 ## Redis password for authentication + ## password: "" From 4b825da1066318eaa279263ede714662167c15e2 Mon Sep 17 00:00:00 2001 From: joancafom Date: Tue, 23 Jun 2020 18:12:47 +0200 Subject: [PATCH 35/35] Update licesing --- LICENSE | 1 - bitnami/discourse/LICENSE | 13 ------------- 2 files changed, 14 deletions(-) delete mode 100644 bitnami/discourse/LICENSE diff --git a/LICENSE b/LICENSE index 599c7e1cac2659..7dbac3a04f20a8 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,3 @@ -Copyright (c) 2020 Paul Czarkowski Copyright (c) 2019 Bitnami Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/bitnami/discourse/LICENSE b/bitnami/discourse/LICENSE deleted file mode 100644 index 340e7270a1f5c1..00000000000000 --- a/bitnami/discourse/LICENSE +++ /dev/null @@ -1,13 +0,0 @@ -Copyright 2020 Paul Czarkowski - -Licensed 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. \ No newline at end of file