diff --git a/deployment/helmchart/templates/NOTES.txt b/deployment/helmchart/templates/NOTES.txt deleted file mode 100644 index 8caea61..0000000 --- a/deployment/helmchart/templates/NOTES.txt +++ /dev/null @@ -1,165 +0,0 @@ -{{- $secretName := include "discourse.secretName" . -}} -{{- $postgresqlSecretName := include "discourse.postgresql.secretName" . -}} -{{- $redisSecretName := include "discourse.redis.secretName" . -}} - -{{- if or .Values.postgresql.enabled .Values.externalDatabase.host -}} - -{{- 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 DISCOURSE_HOST=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}"):$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "common.names.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 "common.names.fullname" . }}' - - export DISCOURSE_HOST=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "common.names.fullname" . }} --template "{{ "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}" }}") - {{- end }} - {{ include "common.utils.secret.getvalue" (dict "secret" $secretName "field" "discourse-password" "context" $) }} - {{ include "common.utils.secret.getvalue" (dict "secret" $postgresqlSecretName "field" "postgresql-password" "context" $) }} - {{- if (include "discourse.redis.auth.enabled" .) }} - {{ include "common.utils.secret.getvalue" (dict "secret" $redisSecretName "field" "redis-password" "context" $) }} - {{- end }} - -2. Complete your Discourse deployment by running: - -{{- if .Values.postgresql.enabled }} - - helm upgrade --namespace {{ .Release.Namespace }} {{ .Release.Name }} bitnami/{{ .Chart.Name }} \ - --set discourse.host=$DISCOURSE_HOST \ - --set discourse.password=$DISCOURSE_PASSWORD \ - {{- if .Values.global }}{{- if .Values.global.imagePullSecrets }} - --set global.imagePullSecrets={{ .Values.global.imagePullSecrets }} \ - {{- end }}{{- end }} - {{- if and .Values.redis.enabled .Values.redis.auth.enabled (not .Values.redis.auth.existingSecret) (not .Values.redis.auth.password) }} - --set redis.auth.password=$REDIS_PASSWORD \ - {{- end }} - --set postgresql.postgresqlPassword=$POSTGRESQL_PASSWORD - -{{- else }} - - ## PLEASE UPDATE THE EXTERNAL DATABASE CONNECTION PARAMETERS IN THE FOLLOWING COMMAND AS NEEDED ## - - helm upgrade --namespace {{ .Release.Namespace }} {{ .Release.Name }} bitnami/{{ .Chart.Name }} \ - --set discourse.host=$DISCOURSE_HOST \ - --set discourse.password=$DISCOURSE_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=$POSTGRESQL_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.auth.enabled (not .Values.redis.auth.existingSecret) (not .Values.redis.auth.password) }} - --set redis.auth.password=$REDIS_PASSWORD \ - {{- end }} - --set postgresql.enabled=false -{{- end }} - -{{- else -}} - -1. Get the Discourse URL by running: - - Discourse URL : http://{{ include "discourse.host" . }}/ - -{{- if eq .Values.service.type "ClusterIP" }} - kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ template "common.names.fullname" . }} 80:{{ .Values.service.port }} -{{- end }} - -2. Get your Discourse login credentials by running: - - Username: {{ .Values.discourse.username }} - {{ include "common.utils.secret.getvalue" (dict "secret" $secretName "field" "discourse-password" "context" $) }} - {{ include "common.utils.secret.getvalue" (dict "secret" $postgresqlSecretName "field" "postgresql-password" "context" $) }} - {{- if (include "discourse.redis.auth.enabled" .) }} - {{ include "common.utils.secret.getvalue" (dict "secret" $redisSecretName "field" "redis-password" "context" $) }} - {{- end }} - -{{- end }} - -{{- 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 DISCOURSE_HOST=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}"):$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "common.names.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 "common.names.fullname" . }}' - - export DISCOURSE_HOST=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "common.names.fullname" . }} --template "{{ "{{ range (index .status.loadBalancer.ingress 0) }}{{ . }}{{ end }}" }}") -{{- else }} - - export DISCOURSE_HOST=127.0.0.1 -{{- end }} - {{ include "common.utils.secret.getvalue" (dict "secret" $secretName "field" "discourse-password" "context" $) }} - {{ include "common.utils.secret.getvalue" (dict "secret" $postgresqlSecretName "field" "postgresql-password" "context" $) }} - {{- if (include "discourse.redis.auth.enabled" .) }} - {{ include "common.utils.secret.getvalue" (dict "secret" $redisSecretName "field" "redis-password" "context" $) }} - {{- end }} - - - ## PLEASE UPDATE THE EXTERNAL DATABASE CONNECTION PARAMETERS IN THE FOLLOWING COMMAND AS NEEDED ## - - helm upgrade --namespace {{ .Release.Namespace }} {{ .Release.Name }} bitnami/{{ .Chart.Name }} \ - --set discourse.host=$DISCOURSE_HOST \ - --set discourse.password=$DISCOURSE_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=$POSTGRESQL_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.auth.enabled (not .Values.redis.auth.existingSecret) (not .Values.redis.auth.password) }} - --set redis.auth.password=$REDIS_PASSWORD \ - {{- end }} - --set service.type={{ .Values.service.type }} -{{- end }} - -{{ if and .Values.postgresql.enabled (not .Values.postgresql.existingSecret) (eq .Values.postgresql.postgresqlPostgresPassword "bitnami") -}} -##################################################################################### -### WARNING: You did not change the default password for the PostgreSQL root user ### -##################################################################################### -{{- end }} - -{{- include "common.warnings.rollingTag" .Values.image }} - -{{- $passwordValidationErrors := list -}} -{{- if not .Values.discourse.existingSecret -}} - {{- $requiredDiscoursePassword := dict "valueKey" "discourse.password" "secret" $secretName "field" "discourse-password" "context" $ -}} - {{- $requiredDiscoursePasswordError := include "common.validations.values.single.empty" $requiredDiscoursePassword -}} - {{- $passwordValidationErrors = append $passwordValidationErrors $requiredDiscoursePasswordError -}} -{{- end -}} - -{{- $postgresqlPasswordValidationErrors := include "common.validations.values.postgresql.passwords" (dict "secret" $postgresqlSecretName "subchart" true "context" $) -}} -{{- $passwordValidationErrors = append $passwordValidationErrors $postgresqlPasswordValidationErrors -}} - -{{- if (include "discourse.redis.auth.enabled" .) }} -{{- $redisPasswordValidationErrors := include "common.validations.values.redis.passwords" (dict "secret" $redisSecretName "subchart" true "context" $) -}} -{{- $passwordValidationErrors = append $passwordValidationErrors $redisPasswordValidationErrors -}} -{{- end }} - -{{- include "common.errors.upgrade.passwords.empty" (dict "validationErrors" $passwordValidationErrors "context" $) -}} diff --git a/deployment/helmchart/templates/_helpers.tpl b/deployment/helmchart/templates/_helpers.tpl index 9bc649d..f6dd8cd 100644 --- a/deployment/helmchart/templates/_helpers.tpl +++ b/deployment/helmchart/templates/_helpers.tpl @@ -1,24 +1,8 @@ -{{/* -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 "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 the name of the service account to use */}} -{{- define "discourse.serviceAccountName" -}} +{{- define "adminFrontend.serviceAccountName" -}} {{- if .Values.serviceAccount.create -}} {{ default (include "common.names.fullname" .) .Values.serviceAccount.name }} {{- else -}} @@ -29,46 +13,46 @@ Create the name of the service account to use {{/* Return the proper Docker image registry secret names */}} -{{- define "discourse.imagePullSecrets" -}} +{{- define "adminFrontend.imagePullSecrets" -}} {{ include "common.images.pullSecrets" (dict "images" (list .Values.image) "global" .Values.global) }} {{- end -}} {{/* -Return true if a secret object for Discourse should be created +Return true if a secret object for Admin-frontend should be created */}} -{{- define "discourse.createSecret" -}} -{{- if or (not .Values.discourse.existingSecret) (and (not .Values.discourse.smtp.existingSecret) .Values.discourse.smtp.password .Values.discourse.smtp.enabled) }} +{{- define "adminFrontend.createSecret" -}} +{{- if or (not .Values.adminFrontend.existingSecret) (and (not .Values.adminFrontend.smtp.existingSecret) .Values.adminFrontend.smtp.password .Values.adminFrontend.smtp.enabled) }} {{- true -}} {{- end -}} {{- end -}} {{/* -Return the Discourse secret name +Return the Admin-frontend secret name */}} -{{- define "discourse.secretName" -}} -{{- if .Values.discourse.existingSecret }} - {{- printf "%s" .Values.discourse.existingSecret -}} +{{- define "adminFrontend.secretName" -}} +{{- if .Values.adminFrontend.existingSecret }} + {{- printf "%s" .Values.adminFrontend.existingSecret -}} {{- else -}} - {{- printf "%s-discourse" (include "common.names.fullname" .) -}} + {{- printf "%s-adminFrontend" (include "common.names.fullname" .) -}} {{- end -}} {{- end -}} {{/* -Return the Discourse SMTP secret name +Return the Admin-frontend SMTP secret name */}} -{{- define "discourse.smtp.secretName" -}} -{{- if .Values.discourse.smtp.existingSecret }} - {{- printf "%s" .Values.discourse.smtp.existingSecret -}} +{{- define "adminFrontend.smtp.secretName" -}} +{{- if .Values.adminFrontend.smtp.existingSecret }} + {{- printf "%s" .Values.adminFrontend.smtp.existingSecret -}} {{- else -}} - {{- printf "%s-discourse" (include "common.names.fullname" .) -}} + {{- printf "%s-adminFrontend" (include "common.names.fullname" .) -}} {{- end -}} {{- end -}} {{/* -Return true if Discourse SMTP uses password authentication +Return true if Admin-frontend SMTP uses password authentication */}} -{{- define "discourse.smtp.password.enabled" -}} -{{- if and (or .Values.discourse.smtp.password .Values.discourse.smtp.existingSecret) .Values.discourse.smtp.enabled }} +{{- define "adminFrontend.smtp.password.enabled" -}} +{{- if and (or .Values.adminFrontend.smtp.password .Values.adminFrontend.smtp.existingSecret) .Values.adminFrontend.smtp.enabled }} {{- true -}} {{- end -}} {{- end -}} @@ -77,7 +61,7 @@ Return true if Discourse SMTP uses password authentication Get the user defined LoadBalancerIP for this release Note, returns 127.0.0.1 if using ClusterIP. */}} -{{- define "discourse.serviceIP" -}} +{{- define "adminFrontend.serviceIP" -}} {{- if eq .Values.service.type "ClusterIP" -}} 127.0.0.1 {{- else -}} @@ -89,161 +73,21 @@ Note, returns 127.0.0.1 if using ClusterIP. 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 := .Values.discourse.host | default "" -}} -{{- default (include "discourse.serviceIP" .) $host -}} +{{- define "adminFrontend.host" -}} +{{- $host := .Values.adminFrontend.host | default "" -}} +{{- default (include "adminFrontend.serviceIP" .) $host -}} {{- end -}} {{/* -Return the proper Discourse image name +Return the proper Admin-frontend image name */}} -{{- define "discourse.image" -}} +{{- define "adminFrontend.image" -}} {{ include "common.images.image" (dict "imageRoot" .Values.image "global" .Values.global) }} {{- end -}} {{/* Return the proper Storage Class */}} -{{- define "discourse.storageClass" -}} +{{- define "adminFrontend.storageClass" -}} {{- include "common.storage.class" (dict "persistence" .Values.persistence "global" .Values.global) -}} {{- 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 -}} - {{- .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 true if a secret object for Postgres should be created -*/}} -{{- define "discourse.postgresql.createSecret" -}} -{{- if and (not .Values.postgresql.enabled) (not .Values.externalDatabase.existingSecret) }} - {{- true -}} -{{- end -}} -{{- end -}} - -{{/* -Return the Postgresql secret name -*/}} -{{- define "discourse.postgresql.secretName" -}} -{{- if .Values.postgresql.enabled }} - {{- if .Values.postgresql.existingSecret }} - {{- printf "%s" .Values.postgresql.existingSecret -}} - {{- else -}} - {{- printf "%s" (include "postgresql.fullname" .) -}} - {{- end -}} -{{- else if .Values.externalDatabase.existingSecret }} - {{- printf "%s" .Values.externalDatabase.existingSecret -}} -{{- else -}} - {{- printf "%s-database" (include "common.names.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 -}} - {{- .Values.externalRedis.port | quote -}} -{{- end -}} -{{- end -}} - -{{/* -Return true if a secret object for Redis™ should be created -*/}} -{{- define "discourse.redis.createSecret" -}} -{{- if and (not .Values.redis.enabled) (not .Values.externalRedis.existingSecret) .Values.externalRedis.password }} - {{- true -}} -{{- end -}} -{{- end -}} - -{{/* -Return the Redis™ secret name -*/}} -{{- define "discourse.redis.secretName" -}} -{{- if .Values.redis.enabled }} - {{- if .Values.redis.auth.existingSecret }} - {{- printf "%s" .Values.redis.auth.existingSecret -}} - {{- else -}} - {{- printf "%s" (include "redis.fullname" .) -}} - {{- end -}} -{{- else if .Values.externalRedis.existingSecret }} - {{- printf "%s" .Values.externalRedis.existingSecret -}} -{{- else -}} - {{- printf "%s-redis" (include "common.names.fullname" .) -}} -{{- end -}} -{{- end -}} - -{{/* -Return the Redis™ secret key -*/}} -{{- define "discourse.redis.secretPasswordKey" -}} -{{- if and .Values.redis.enabled .Values.redis.auth.existingSecret }} - {{- required "You need to provide existingSecretPasswordKey when an existingSecret is specified in redis" .Values.redis.auth.existingSecretPasswordKey | printf "%s" }} -{{- else if and (not .Values.redis.enabled) .Values.externalRedis.existingSecret }} - {{- required "You need to provide existingSecretPasswordKey when an existingSecret is specified in redis" .Values.externalRedis.existingSecretPasswordKey | printf "%s" }} -{{- else -}} - {{- printf "redis-password" -}} -{{- end -}} -{{- end -}} - -{{/* -Return whether Redis™ uses password authentication or not -*/}} -{{- define "discourse.redis.auth.enabled" -}} -{{- if or (and .Values.redis.enabled .Values.redis.auth.enabled) (and (not .Values.redis.enabled) (or .Values.externalRedis.password .Values.externalRedis.existingSecret)) }} - {{- true -}} -{{- end -}} -{{- end -}} diff --git a/deployment/helmchart/templates/configmaps.yaml b/deployment/helmchart/templates/configmaps.yaml index cded68d..d854040 100644 --- a/deployment/helmchart/templates/configmaps.yaml +++ b/deployment/helmchart/templates/configmaps.yaml @@ -11,40 +11,22 @@ metadata: {{- end }} data: {{- $port := .Values.service.port | toString }} - DISCOURSE_HOST: "{{ include "discourse.host" . }}" - DISCOURSE_SKIP_INSTALL: {{ ternary "yes" "no" .Values.discourse.skipInstall | quote }} - DISCOURSE_SITE_NAME: {{ .Values.discourse.siteName | quote }} - DISCOURSE_USERNAME: {{ .Values.discourse.username | quote }} - DISCOURSE_EMAIL: {{ .Values.discourse.email | quote }} - DISCOURSE_REDIS_HOST: {{ template "discourse.redisHost" . }} - DISCOURSE_REDIS_PORT_NUMBER: {{ template "discourse.redisPort" . }} - DISCOURSE_DATABASE_HOST: {{ template "discourse.databaseHost" . }} - DISCOURSE_DATABASE_PORT_NUMBER: {{ template "discourse.databasePort" . }} - DISCOURSE_DATABASE_NAME: {{ template "discourse.databaseName" . }} - DISCOURSE_DATABASE_USER: {{ template "discourse.databaseUser" . }} - {{- if .Values.discourse.smtp.enabled }} - DISCOURSE_SMTP_HOST: {{ .Values.discourse.smtp.host | quote }} - DISCOURSE_SMTP_PORT: {{ .Values.discourse.smtp.port | quote }} - {{- if .Values.discourse.smtp.user }} - DISCOURSE_SMTP_USER: {{ .Values.discourse.smtp.user | quote }} - {{- end }} - {{- if .Values.discourse.smtp.protocol }} - DISCOURSE_SMTP_PROTOCOL: {{ .Values.discourse.smtp.protocol | quote }} - {{- end }} - {{- if .Values.discourse.smtp.auth }} - DISCOURSE_SMTP_AUTH: {{ .Values.discourse.smtp.auth | quote }} - {{- end }} - {{- end }} - {{- if or .Values.postgresql.enabled .Values.externalDatabase.create }} - POSTGRESQL_CLIENT_DATABASE_HOST: {{ template "discourse.databaseHost" . }} - POSTGRESQL_CLIENT_DATABASE_PORT_NUMBER: {{ template "discourse.databasePort" . }} - {{- if or .Values.postgresql.enabled (not .Values.externalDatabase.postgresqlPostgresUser) }} - POSTGRESQL_CLIENT_POSTGRES_USER: "postgres" - {{- else }} - POSTGRESQL_CLIENT_POSTGRES_USER: {{ .Values.externalDatabase.postgresqlPostgresUser | quote }} - POSTGRESQL_CLIENT_CREATE_DATABASE_USERNAME: {{ .Values.externalDatabase.user | quote }} - POSTGRESQL_CLIENT_CREATE_DATABASE_PASSWORD: {{ .Values.externalDatabase.password | quote }} - {{- end }} - POSTGRESQL_CLIENT_CREATE_DATABASE_NAME: {{ template "discourse.databaseName" . }} - POSTGRESQL_CLIENT_CREATE_DATABASE_EXTENSIONS: "hstore,pg_trgm" - {{- end }} + REACT_APP_API_URL: {{ .Values.adminFrontend.reactAppApiUrl }} + EXTEND_ESLINT: {{ .Values.adminFrontend.extendEslint }} + ADMIN_FRONTEND_HOST: "{{ include "adminFrontend.host" . }}" + # Probably needed in the future: + # ADMIN_FRONTEND_USERNAME: {{ .Values.adminFrontend.username | quote }} + # ADMIN_FRONTEND_EMAIL: {{ .Values.adminFrontend.email | quote }} + # {{- if .Values.adminFrontend.smtp.enabled }} + # ADMIN_FRONTEND_SMTP_HOST: {{ .Values.adminFrontend.smtp.host | quote }} + # ADMIN_FRONTEND_SMTP_PORT: {{ .Values.adminFrontend.smtp.port | quote }} + # {{- if .Values.adminFrontend.smtp.user }} + # ADMIN_FRONTEND_SMTP_USER: {{ .Values.adminFrontend.smtp.user | quote }} + # {{- end }} + # {{- if .Values.adminFrontend.smtp.protocol }} + # ADMIN_FRONTEND_SMTP_PROTOCOL: {{ .Values.adminFrontend.smtp.protocol | quote }} + # {{- end }} + # {{- if .Values.adminFrontend.smtp.auth }} + # ADMIN_FRONTEND_SMTP_AUTH: {{ .Values.adminFrontend.smtp.auth | quote }} + # {{- end }} + # {{- end }} diff --git a/deployment/helmchart/templates/deployment.yaml b/deployment/helmchart/templates/deployment.yaml index 7a94f21..4f9d32e 100644 --- a/deployment/helmchart/templates/deployment.yaml +++ b/deployment/helmchart/templates/deployment.yaml @@ -1,10 +1,10 @@ -{{- if and (include "discourse.host" .) (or .Values.postgresql.enabled .Values.externalDatabase.host) -}} +{{- if (include "adminFrontend.host" .) -}} apiVersion: {{ template "common.capabilities.deployment.apiVersion" . }} kind: Deployment metadata: name: {{ template "common.names.fullname" . }} labels: {{- include "common.labels.standard" . | nindent 4 }} - component: discourse + component: adminFrontend {{- if .Values.commonLabels }} {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} {{- end }} @@ -15,19 +15,14 @@ spec: replicas: {{ .Values.replicaCount }} selector: matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }} - component: discourse + component: adminFrontend {{- if .Values.updateStrategy }} strategy: {{- toYaml .Values.updateStrategy | nindent 4 }} {{- end }} template: metadata: - annotations: - checksum/config: {{ include (print $.Template.BasePath "/configmaps.yaml") . | sha256sum }} - checksum/secrets-discourse: {{ include (print $.Template.BasePath "/secrets-discourse.yaml") . | sha256sum }} - checksum/secrets-database: {{ include (print $.Template.BasePath "/secrets-database.yaml") . | sha256sum }} - checksum/secrets-redis: {{ include (print $.Template.BasePath "/secrets-redis.yaml") . | sha256sum }} labels: {{- include "common.labels.standard" . | nindent 8 }} - component: discourse + component: adminFrontend {{- if .Values.podLabels }} {{- include "common.tplvalues.render" (dict "value" .Values.podLabels "context" $) | nindent 8 }} {{- end }} @@ -35,7 +30,7 @@ spec: annotations: {{- include "common.tplvalues.render" (dict "value" .Values.podAnnotations "context" $) | nindent 8 }} {{- end }} spec: - {{- include "discourse.imagePullSecrets" . | nindent 6 }} + {{- include "adminFrontend.imagePullSecrets" . | nindent 6 }} {{- if .Values.hostAliases }} hostAliases: {{- include "common.tplvalues.render" (dict "value" .Values.hostAliases "context" $) | nindent 8 }} {{- end }} @@ -53,7 +48,7 @@ spec: {{- if .Values.tolerations }} tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" $) | nindent 8 }} {{- end }} - serviceAccountName: {{ include "discourse.serviceAccountName" . }} + serviceAccountName: {{ include "adminFrontend.serviceAccountName" . }} securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} initContainers: {{- if .Values.initContainers }} @@ -61,214 +56,105 @@ spec: {{- end }} {{- if and .Values.volumePermissions.enabled .Values.persistence.enabled }} - name: volume-permissions - image: {{ include "discourse.image" . }} + image: {{ include "adminFrontend.image" . }} imagePullPolicy: {{ .Values.volumePermissions.image.pullPolicy | quote }} command: - sh - -c - | - mkdir -p "/bitnami/discourse" - chown -R "discourse:root" "/bitnami/discourse" + mkdir -p "/bitnami/adminFrontend" + chown -R "adminFrontend:root" "/bitnami/adminFrontend" securityContext: runAsUser: 0 {{- if .Values.volumePermissions.resources }} resources: {{- toYaml .Values.volumePermissions.resources | nindent 12 }} {{- end }} volumeMounts: - - name: discourse-data - mountPath: /bitnami/discourse + - name: adminFrontend-data + mountPath: /bitnami/adminFrontend {{- end }} containers: - - name: discourse - securityContext: {{- toYaml .Values.discourse.containerSecurityContext | nindent 12 }} - image: {{ template "discourse.image" . }} + - name: adminFrontend + securityContext: {{- toYaml .Values.adminFrontend.containerSecurityContext | nindent 12 }} + image: {{ template "adminFrontend.image" . }} imagePullPolicy: {{ .Values.image.pullPolicy | quote }} - {{- if .Values.discourse.command }} - command: {{- include "common.tplvalues.render" (dict "value" .Values.discourse.command "context" $) | nindent 12 }} + {{- if .Values.adminFrontend.command }} + command: {{- include "common.tplvalues.render" (dict "value" .Values.adminFrontend.command "context" $) | nindent 12 }} {{- end }} - {{- if .Values.discourse.args }} - args: {{- include "common.tplvalues.render" (dict "value" .Values.discourse.args "context" $) | nindent 12 }} + {{- if .Values.adminFrontend.args }} + args: {{- include "common.tplvalues.render" (dict "value" .Values.adminFrontend.args "context" $) | nindent 12 }} {{- end }} env: - - name: BITNAMI_DEBUG - value: {{ ternary "true" "false" .Values.image.debug | quote }} - - name: DISCOURSE_PASSWORD + - name: ADMIN_FRONTEND_PASSWORD valueFrom: secretKeyRef: - name: {{ include "discourse.secretName" . }} - key: discourse-password - - name: DISCOURSE_DATABASE_PASSWORD + name: {{ include "adminFrontend.secretName" . }} + key: adminFrontend-password + {{- if (include "adminFrontend.smtp.password.enabled" .) }} + - name: ADMIN_FRONTEND_SMTP_PASSWORD valueFrom: secretKeyRef: - name: {{ include "discourse.postgresql.secretName" . }} - key: postgresql-password - {{- if or .Values.postgresql.enabled .Values.externalDatabase.create }} - - name: POSTGRESQL_CLIENT_POSTGRES_PASSWORD - valueFrom: - secretKeyRef: - name: {{ include "discourse.postgresql.secretName" . }} - key: postgresql-postgres-password - {{- end }} - {{- if (include "discourse.redis.auth.enabled" .) }} - - name: DISCOURSE_REDIS_PASSWORD - valueFrom: - secretKeyRef: - name: {{ include "discourse.redis.secretName" . }} - key: {{ include "discourse.redis.secretPasswordKey" . }} - {{- end }} - {{- if (include "discourse.smtp.password.enabled" .) }} - - name: DISCOURSE_SMTP_PASSWORD - valueFrom: - secretKeyRef: - name: {{ include "discourse.smtp.secretName" . }} + name: {{ include "adminFrontend.smtp.secretName" . }} key: smtp-password {{- end }} - {{- if .Values.discourse.extraEnvVars }} - {{- include "common.tplvalues.render" (dict "value" .Values.discourse.extraEnvVars "context" $) | nindent 12 }} + {{- if .Values.adminFrontend.extraEnvVars }} + {{- include "common.tplvalues.render" (dict "value" .Values.adminFrontend.extraEnvVars "context" $) | nindent 12 }} {{- end }} envFrom: - configMapRef: name: {{ include "common.names.fullname" . }} - {{- if .Values.discourse.extraEnvVarsCM }} + {{- if .Values.adminFrontend.extraEnvVarsCM }} - configMapRef: - name: {{ .Values.discourse.extraEnvVarsCM }} + name: {{ .Values.adminFrontend.extraEnvVarsCM }} {{- end }} - {{- if .Values.discourse.extraEnvVarsSecret }} + {{- if .Values.adminFrontend.extraEnvVarsSecret }} - secretRef: - name: {{ .Values.discourse.extraEnvVarsSecret }} + name: {{ .Values.adminFrontend.extraEnvVarsSecret }} {{- end }} ports: - name: http containerPort: 3000 protocol: TCP - {{- if .Values.discourse.livenessProbe.enabled }} + {{- if .Values.adminFrontend.livenessProbe.enabled }} livenessProbe: httpGet: path: /srv/status 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 }} - {{- else if .Values.discourse.customLivenessProbe }} - livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.discourse.customLivenessProbe "context" $) | nindent 12 }} + initialDelaySeconds: {{ .Values.adminFrontend.livenessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.adminFrontend.livenessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.adminFrontend.livenessProbe.timeoutSeconds }} + successThreshold: {{ .Values.adminFrontend.livenessProbe.successThreshold }} + failureThreshold: {{ .Values.adminFrontend.livenessProbe.failureThreshold }} + {{- else if .Values.adminFrontend.customLivenessProbe }} + livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.adminFrontend.customLivenessProbe "context" $) | nindent 12 }} {{- end }} - {{- if .Values.discourse.readinessProbe.enabled }} + {{- if .Values.adminFrontend.readinessProbe.enabled }} readinessProbe: httpGet: path: /srv/status 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 }} - {{- else if .Values.discourse.customReadinessProbe }} - readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.discourse.customReadinessProbe "context" $) | nindent 12 }} + initialDelaySeconds: {{ .Values.adminFrontend.readinessProbe.initialDelaySeconds }} + periodSeconds: {{ .Values.adminFrontend.readinessProbe.periodSeconds }} + timeoutSeconds: {{ .Values.adminFrontend.readinessProbe.timeoutSeconds }} + successThreshold: {{ .Values.adminFrontend.readinessProbe.successThreshold }} + failureThreshold: {{ .Values.adminFrontend.readinessProbe.failureThreshold }} + {{- else if .Values.adminFrontend.customReadinessProbe }} + readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.adminFrontend.customReadinessProbe "context" $) | nindent 12 }} {{- end }} volumeMounts: - - name: discourse-data - mountPath: /bitnami/discourse - subPath: discourse - {{- if .Values.discourse.extraVolumeMounts }} - {{- include "common.tplvalues.render" (dict "value" .Values.discourse.extraVolumeMounts "context" $) | nindent 12 }} + - name: adminFrontend-data + mountPath: /bitnami/adminFrontend + subPath: adminFrontend + {{- if .Values.adminFrontend.extraVolumeMounts }} + {{- include "common.tplvalues.render" (dict "value" .Values.adminFrontend.extraVolumeMounts "context" $) | nindent 12 }} {{- end }} - {{- if .Values.discourse.resources }} - resources: {{- toYaml .Values.discourse.resources | nindent 12 }} - {{- end }} - - name: sidekiq - securityContext: {{- toYaml .Values.sidekiq.containerSecurityContext | nindent 12 }} - image: {{ template "discourse.image" . }} - imagePullPolicy: {{ .Values.image.pullPolicy | quote }} - command: {{- include "common.tplvalues.render" (dict "value" .Values.sidekiq.command "context" $) | nindent 12 }} - args: {{- include "common.tplvalues.render" (dict "value" .Values.sidekiq.args "context" $) | nindent 12 }} - env: - - name: BITNAMI_DEBUG - value: {{ ternary "true" "false" .Values.image.debug | quote }} - - name: DISCOURSE_PASSWORD - valueFrom: - secretKeyRef: - name: {{ include "discourse.secretName" . }} - key: discourse-password - - name: DISCOURSE_POSTGRESQL_PASSWORD - valueFrom: - secretKeyRef: - name: {{ include "discourse.postgresql.secretName" . }} - key: postgresql-password - {{- if (include "discourse.redis.auth.enabled" .) }} - - name: REDIS_PASSWORD - valueFrom: - secretKeyRef: - name: {{ include "discourse.redis.secretName" . }} - key: {{ include "discourse.redis.secretPasswordKey" . }} - {{- end }} - {{- if (include "discourse.smtp.password.enabled" .) }} - - name: DISCOURSE_SMTP_PASSWORD - valueFrom: - secretKeyRef: - name: {{ include "discourse.smtp.secretName" . }} - key: smtp-password - {{- end }} - {{- if .Values.sidekiq.extraEnvVars }} - {{- include "common.tplvalues.render" (dict "value" .Values.sidekiq.extraEnvVars "context" $) | nindent 12 }} - {{- end }} - envFrom: - - configMapRef: - name: {{ include "common.names.fullname" . }} - {{- if .Values.sidekiq.extraEnvVarsCM }} - - configMapRef: - name: {{ .Values.sidekiq.extraEnvVarsCM }} - {{- end }} - {{- if .Values.sidekiq.extraEnvVarsSecret }} - - secretRef: - name: {{ .Values.sidekiq.extraEnvVarsSecret }} - {{- end }} - {{- if .Values.sidekiq.livenessProbe.enabled }} - livenessProbe: - exec: - command: ["/bin/sh", "-c", "pgrep -f ^sidekiq"] - 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 }} - {{- else if .Values.sidekiq.customLivenessProbe }} - livenessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.sidekiq.customLivenessProbe "context" $) | nindent 12 }} - {{- end }} - {{- if .Values.sidekiq.readinessProbe.enabled }} - readinessProbe: - exec: - command: ["/bin/sh", "-c", "pgrep -f ^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 }} - {{- else if .Values.sidekiq.customReadinessProbe }} - readinessProbe: {{- include "common.tplvalues.render" (dict "value" .Values.sidekiq.customReadinessProbe "context" $) | nindent 12 }} - {{- end }} - volumeMounts: - - name: discourse-data - mountPath: /bitnami/discourse - subPath: discourse - {{- if .Values.sidekiq.extraVolumeMounts }} - {{- include "common.tplvalues.render" (dict "value" .Values.sidekiq.extraVolumeMounts "context" $) | nindent 12 }} - {{- end }} - {{- if .Values.sidekiq.resources }} - resources: {{- toYaml .Values.sidekiq.resources | nindent 12 }} + {{- if .Values.adminFrontend.resources }} + resources: {{- toYaml .Values.adminFrontend.resources | nindent 12 }} {{- end }} {{- if .Values.sidecars }} {{- include "common.tplvalues.render" (dict "value" .Values.sidecars "context" $) | nindent 8 }} {{- end }} volumes: - - name: discourse-data - {{- if .Values.persistence.enabled }} - persistentVolumeClaim: - claimName: {{ .Values.persistence.existingClaim | default (include "common.names.fullname" .) }} - {{- else }} - emptyDir: {} - {{ end }} {{- if .Values.extraVolumes }} {{- include "common.tplvalues.render" (dict "value" .Values.extraVolumes "context" $) | nindent 8 }} {{- end }} diff --git a/deployment/helmchart/templates/pvc.yaml b/deployment/helmchart/templates/pvc.yaml index 42e02c2..cb508e9 100644 --- a/deployment/helmchart/templates/pvc.yaml +++ b/deployment/helmchart/templates/pvc.yaml @@ -1,4 +1,5 @@ -{{- if and (include "discourse.host" .) .Values.persistence.enabled (not .Values.persistence.existingClaim) }} +# Disabled by default because the current admin panel does not need persistence +{{- if and (include "adminFrontend.host" .) .Values.persistence.enabled (not .Values.persistence.existingClaim) }} kind: PersistentVolumeClaim apiVersion: v1 metadata: @@ -16,7 +17,7 @@ spec: resources: requests: storage: {{ .Values.persistence.size | quote }} - {{ include "discourse.storageClass" . }} + {{ include "adminFrontend.storageClass" . }} {{- if .Values.persistence.selector }} selector: {{- include "common.tplvalues.render" (dict "value" .Values.persistence.selector "context" $) | nindent 4 }} {{- end -}} diff --git a/deployment/helmchart/templates/secrets-database.yaml b/deployment/helmchart/templates/secrets-database.yaml deleted file mode 100644 index d9f42f7..0000000 --- a/deployment/helmchart/templates/secrets-database.yaml +++ /dev/null @@ -1,17 +0,0 @@ -{{- if (include "discourse.postgresql.createSecret" .) }} -apiVersion: v1 -kind: Secret -metadata: - name: {{ template "common.names.fullname" . }}-database - labels: {{- include "common.labels.standard" . | nindent 4 }} - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} - {{- if .Values.commonAnnotations }} - annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} - {{- end }} -type: Opaque -data: - postgresql-password: {{ .Values.externalDatabase.password | b64enc | quote }} - postgresql-postgres-password: {{ .Values.externalDatabase.postgresqlPostgresPassword | b64enc | quote }} -{{- end }} diff --git a/deployment/helmchart/templates/secrets-discourse.yaml b/deployment/helmchart/templates/secrets-discourse.yaml index 5f81810..e026b84 100644 --- a/deployment/helmchart/templates/secrets-discourse.yaml +++ b/deployment/helmchart/templates/secrets-discourse.yaml @@ -1,8 +1,8 @@ -{{- if (include "discourse.createSecret" .) }} +{{- if (include "adminFrontend.createSecret" .) }} apiVersion: v1 kind: Secret metadata: - name: {{ template "common.names.fullname" . }}-discourse + name: {{ template "common.names.fullname" . }}-adminFrontend labels: {{- include "common.labels.standard" . | nindent 4 }} {{- if .Values.commonLabels }} {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} @@ -12,12 +12,12 @@ metadata: {{- end }} type: Opaque data: - {{- if and (.Values.discourse.password) (not .Values.discourse.existingSecret) }} - discourse-password: {{ .Values.discourse.password | b64enc | quote }} - {{- else if not .Values.discourse.existingSecret }} - discourse-password: {{ randAlphaNum 10 | b64enc | quote }} + {{- if and (.Values.adminFrontend.password) (not .Values.adminFrontend.existingSecret) }} + adminFrontend-password: {{ .Values.adminFrontend.password | b64enc | quote }} + {{- else if not .Values.adminFrontend.existingSecret }} + adminFrontend-password: {{ randAlphaNum 10 | b64enc | quote }} {{- end }} - {{- if and (.Values.discourse.smtp.password) (.Values.discourse.smtp.enabled) (not .Values.discourse.smtp.existingSecret) }} - smtp-password: {{ .Values.discourse.smtp.password | b64enc | quote }} + {{- if and (.Values.adminFrontend.smtp.password) (.Values.adminFrontend.smtp.enabled) (not .Values.adminFrontend.smtp.existingSecret) }} + smtp-password: {{ .Values.adminFrontend.smtp.password | b64enc | quote }} {{- end }} {{- end }} diff --git a/deployment/helmchart/templates/secrets-redis.yaml b/deployment/helmchart/templates/secrets-redis.yaml deleted file mode 100644 index b854605..0000000 --- a/deployment/helmchart/templates/secrets-redis.yaml +++ /dev/null @@ -1,16 +0,0 @@ -{{- if (include "discourse.redis.createSecret" .) }} -apiVersion: v1 -kind: Secret -metadata: - name: {{ template "common.names.fullname" . }}-redis - labels: {{- include "common.labels.standard" . | nindent 4 }} - {{- if .Values.commonLabels }} - {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} - {{- end }} - {{- if .Values.commonAnnotations }} - annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} - {{- end }} -type: Opaque -data: - redis-password: {{ .Values.externalRedis.password | b64enc | quote }} -{{- end }} diff --git a/deployment/helmchart/templates/serviceaccount.yaml b/deployment/helmchart/templates/serviceaccount.yaml index acbe841..27a8838 100644 --- a/deployment/helmchart/templates/serviceaccount.yaml +++ b/deployment/helmchart/templates/serviceaccount.yaml @@ -2,7 +2,7 @@ apiVersion: v1 kind: ServiceAccount metadata: - name: {{ include "discourse.serviceAccountName" . }} + name: {{ include "adminFrontend.serviceAccountName" . }} labels: {{- include "common.labels.standard" . | nindent 4 }} {{- if .Values.commonLabels }} {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}