diff --git a/bitnami/discourse/.helmignore b/bitnami/discourse/.helmignore new file mode 100644 index 0000000000..0e8a0eb36f --- /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.yaml b/bitnami/discourse/Chart.yaml new file mode 100644 index 0000000000..5113fb037b --- /dev/null +++ b/bitnami/discourse/Chart.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +name: discourse +description: A Helm chart for deploying Discourse to Kubernetes +version: 0.1.0 +appVersion: 2.4.1 +engine: gotpl +home: https://www.discourse.org/ +icon: https://bitnami.com/assets/stacks/discourse/img/discourse-stack-220x234.png +sources: + - https://github.com/bitnami/bitnami-docker-discourse + - https://github.com/spinnaker +maintainers: + - name: Bitnami + email: containers@bitnami.com + - name: paulczar + email: username.taken@gmail.com + - name: lucaprete + email: preteluca@gmail.com diff --git a/bitnami/discourse/README.md b/bitnami/discourse/README.md new file mode 100644 index 0000000000..1b36553da1 --- /dev/null +++ b/bitnami/discourse/README.md @@ -0,0 +1,436 @@ +# Discourse + +[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. + +## TL;DR; + +```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 databases for the Discourse application. + +Bitnami charts can be used with [Kubeapps](https://kubeapps.com/) for deployment and management of Helm Charts in clusters. + +## 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`: + +```console +$ helm install my-release bitnami/discourse +``` + +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. + +> **Tip**: List all releases using `helm list` + +## Uninstalling the Chart + +To uninstall/delete the `my-release` deployment: + +```console +$ helm delete my-release +``` + +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 | +|-------------------------------------------|---------------------------------------------------------------------------------------|--------------------------------------------------------------| +| `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` | +| `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 | `{}` | +| `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) | + +### Service parameters + +| Parameter | Description | Default | +|-------------------------------------------|---------------------------------------------------------------------------------------|--------------------------------------------------------------| +| `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) | +| `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 | `""` | + +### Discourse parameters + +| Parameter | Description | Default | +|-------------------------------------------|---------------------------------------------------------------------------------------|--------------------------------------------------------------| +| `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 | +|-------------------------------------------|---------------------------------------------------------------------------------------|--------------------------------------------------------------| +| `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 + +| 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.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 + +| 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 (used in the installation stage) | `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. + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, + +```console +$ helm install my-release \ + --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 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, + +```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. + +### Setting up replication + +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 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 +$ 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 +$ 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. + +- 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. 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 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. + +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 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. + +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 + +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. + +#### 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 diff --git a/bitnami/discourse/requirements.lock b/bitnami/discourse/requirements.lock new file mode 100644 index 0000000000..d8ed10e9bb --- /dev/null +++ b/bitnami/discourse/requirements.lock @@ -0,0 +1,9 @@ +dependencies: +- name: postgresql + repository: https://charts.bitnami.com/bitnami + version: 8.10.5 +- name: redis + repository: https://charts.bitnami.com/bitnami + version: 10.7.2 +digest: sha256:cc984394c0b625227d718eb84193451926a0c507b13ba6c2efca0f4789af1909 +generated: "2020-06-17T10:08:35.360488+02:00" diff --git a/bitnami/discourse/requirements.yaml b/bitnami/discourse/requirements.yaml new file mode 100644 index 0000000000..a585b5dd5f --- /dev/null +++ b/bitnami/discourse/requirements.yaml @@ -0,0 +1,9 @@ +dependencies: + - name: postgresql + repository: https://charts.bitnami.com/bitnami + version: 8.X.X + condition: postgresql.enabled + - name: redis + repository: https://charts.bitnami.com/bitnami + version: 10.X.X + condition: redis.enabled diff --git a/bitnami/discourse/templates/NOTES.txt b/bitnami/discourse/templates/NOTES.txt new file mode 100644 index 0000000000..398ea18ca8 --- /dev/null +++ b/bitnami/discourse/templates/NOTES.txt @@ -0,0 +1,155 @@ +{{- 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 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 }}" }}") + {{- 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 }} +2. Complete your Discourse deployment by running: + +{{- if .Values.postgresql.enabled }} + + helm upgrade {{ .Release.Name }} bitnami/{{ .Chart.Name }} \ + --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 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: + + 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: + + 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 -}} + +######################################################################################## +### 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}"):$(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 }}" }}") +{{- 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) + 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 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+$")) }} + +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 }} + +{{ if and .Values.postgresql.enabled (eq .Values.postgresql.postgresqlPostgresPassword "bitnami") -}} +##################################################################################### +### WARNING: You did not change the default password for the PostgreSQL root user ### +##################################################################################### +{{- end }} diff --git a/bitnami/discourse/templates/_helpers.tpl b/bitnami/discourse/templates/_helpers.tpl new file mode 100644 index 0000000000..36fbeaa032 --- /dev/null +++ b/bitnami/discourse/templates/_helpers.tpl @@ -0,0 +1,287 @@ +{{/* +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). +*/}} +{{- 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). +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.matchLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end -}} + +{{/* +Match labels +*/}} +{{- define "discourse.matchLabels" -}} +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 -}} + +{{/* +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 -}} + +{{/* +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. +*/}} +{{- define "discourse.host" -}} +{{- $host := .Values.discourse.host | 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 -}} + +{{/* +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 new file mode 100644 index 0000000000..8cb4052a84 --- /dev/null +++ b/bitnami/discourse/templates/configmaps.yaml @@ -0,0 +1,27 @@ +apiVersion: v1 +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 }} +data: + {{- $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 }} + 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" + {{- if .Values.discourse.skipInstall }} + DISCOURSE_SKIP_INSTALL: "yes" + {{- end }} diff --git a/bitnami/discourse/templates/deployment.yaml b/bitnami/discourse/templates/deployment.yaml new file mode 100644 index 0000000000..091a8112f9 --- /dev/null +++ b/bitnami/discourse/templates/deployment.yaml @@ -0,0 +1,234 @@ +{{- 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 }} + 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 }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: {{- include "discourse.matchLabels" . | nindent 6 }} + component: discourse + template: + metadata: + annotations: + 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 + {{- 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" . | nindent 6 }} + serviceAccountName: {{ include "discourse.serviceAccountName" . }} + securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }} + {{- if .Values.initContainers }} + 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 + value: "--log-level trace" + {{- end }} + - 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 + - name: POSTGRESQL_ROOT_PASSWORD + valueFrom: + secretKeyRef: + 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.redisSecretName" . }} + key: redis-password + {{- end }} + {{- if .Values.discourse.extraEnvVars }} + {{- include "discourse.tplValue" (dict "value" .Values.discourse.extraEnvVars "context" $) | indent 12 }} + {{- end }} + envFrom: + - configMapRef: + name: {{ include "discourse.fullname" . }} + {{- if .Values.discourse.extraEnvVarsCM }} + - configMapRef: + name: {{ .Values.discourse.extraEnvVarsCM }} + {{- end }} + {{- if .Values.discourse.extraEnvVarsSecret }} + - secretRef: + name: {{ .Values.discourse.extraEnvVarsSecret }} + {{- end }} + ports: + - name: http + containerPort: 3000 + protocol: TCP + {{- 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 }} + {{- else if .Values.discourse.customLivenessProbe }} + livenessProbe: {{- include "discourse.tplValue" (dict "value" .Values.discourse.customLivenessProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.discourse.readinessProbe.enabled }} + readinessProbe: + httpGet: + 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 }} + {{- 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 }} + - name: sidekiq + securityContext: {{- toYaml .Values.sidekiq.containerSecurityContext | nindent 12 }} + image: {{ template "discourse.image" . }} + imagePullPolicy: {{ .Values.image.pullPolicy | quote }} + 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 + 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 }} + {{- include "discourse.tplValue" (dict "value" .Values.sidekiq.extraEnvVars "context" $) | 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 }} + {{- if .Values.sidekiq.livenessProbe.enabled }} + livenessProbe: + exec: + command: ["/bin/sh", "-c", "nami status discourse-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 "discourse.tplValue" (dict "value" .Values.sidekiq.customLivenessProbe "context" $) | nindent 12 }} + {{- end }} + {{- if .Values.sidekiq.readinessProbe.enabled }} + 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 }} + {{- 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 }} + {{- include "discourse.tplValue" (dict "value" .Values.sidecars "context" $) | 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.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 }} + {{- 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 }} +{{- end }} diff --git a/bitnami/discourse/templates/ingress.yaml b/bitnami/discourse/templates/ingress.yaml new file mode 100644 index 0000000000..d4520d4d29 --- /dev/null +++ b/bitnami/discourse/templates/ingress.yaml @@ -0,0 +1,57 @@ +{{- if .Values.ingress.enabled -}} +{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +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 }} + {{- 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" + {{- end }} + {{- end }} +spec: + {{- if or .Values.ingress.tls .Values.ingress.extraTls }} + tls: + {{- if .Values.ingress.tls }} + - hosts: + - {{ .Values.ingress.hostname }} + secretName: {{ printf "%s-tls" .Values.ingress.hostname }} + {{- end }} + {{- if .Values.ingress.extraTls }} + {{- toYaml .Values.ingress.extraTls | nindent 4 }} + {{- end }} + {{- end }} + rules: + {{- if .Values.ingress.hostname }} + - host: {{ .Values.ingress.hostname }} + http: + paths: + - path: / + backend: + serviceName: {{ template "discourse.fullname" . }} + servicePort: http + {{- end }} + {{- range .Values.ingress.extraHosts }} + - host: {{ .name }} + http: + paths: + - path: {{ default "/" .path }} + backend: + serviceName: {{ template "discourse.fullname" $ }} + servicePort: http + {{- end }} +{{- end }} diff --git a/bitnami/discourse/templates/pvc.yaml b/bitnami/discourse/templates/pvc.yaml new file mode 100644 index 0000000000..8dd170a967 --- /dev/null +++ b/bitnami/discourse/templates/pvc.yaml @@ -0,0 +1,20 @@ +{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} +kind: PersistentVolumeClaim +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 }} +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 new file mode 100644 index 0000000000..0cb0d7dd77 --- /dev/null +++ b/bitnami/discourse/templates/secrets.yaml @@ -0,0 +1,27 @@ +apiVersion: v1 +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 }} +type: Opaque +data: + {{- if .Values.discourse.password }} + discourse-password: {{ .Values.discourse.password | b64enc | quote }} + {{- else }} + discourse-password: {{ randAlphaNum 10 | b64enc | quote }} + {{- end }} + + {{- if not .Values.postgresql.enabled }} + postgresql-password: {{ .Values.externalDatabase.password | b64enc | quote }} + postgresql-postgres-password: {{ .Values.externalDatabase.postgresqlPostgresPassword | b64enc | quote }} + {{- end }} + + {{- 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/service.yaml b/bitnami/discourse/templates/service.yaml new file mode 100644 index 0000000000..c0c53d3194 --- /dev/null +++ b/bitnami/discourse/templates/service.yaml @@ -0,0 +1,39 @@ +apiVersion: v1 +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 }} + {{- 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 }} + {{- 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: + {{ toYaml .Values.service.loadBalancerSourceRanges | nindent 4 }} + {{- end }} + ports: + - name: http + port: {{ .Values.service.port }} + targetPort: http + {{- 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" $) | indent 4 }} + {{- end }} + selector: {{- include "discourse.matchLabels" . | nindent 4 }} diff --git a/bitnami/discourse/templates/serviceaccount.yaml b/bitnami/discourse/templates/serviceaccount.yaml new file mode 100644 index 0000000000..d87dae1b35 --- /dev/null +++ b/bitnami/discourse/templates/serviceaccount.yaml @@ -0,0 +1,19 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +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 }} + {{- 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 new file mode 100644 index 0000000000..62d9968349 --- /dev/null +++ b/bitnami/discourse/templates/tls-secrets.yaml @@ -0,0 +1,19 @@ +{{- if .Values.ingress.enabled }} +{{- range .Values.ingress.secrets }} +apiVersion: v1 +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 }} +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 new file mode 100644 index 0000000000..99ef01244f --- /dev/null +++ b/bitnami/discourse/values-production.yaml @@ -0,0 +1,543 @@ +## 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. The port will be automatilly included. + ## 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 + + ## Custom command to override image cmd + ## + # command: [] + + ## Custom args for the custom commad: + # args: [] + + containerSecurityContext: {} + ## 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 + + ## 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: + ## discourse: + ## - name: DISCOURSE_ELASTICSEARCH_URL + ## value: test + ## + extraEnvVars: [] + + ## Array to add extra configmaps: + ## + extraEnvVarsCM: [] + + ## Array to add extra environment + ## variables from a secret: + ## + # 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 + +sidekiq: + + containerSecurityContext: {} + ## capabilities: + ## drop: + ## - ALL + ## 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/ + ## + 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: 500 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 + + readinessProbe: + enabled: true + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 5 + 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: + ## - name: DISCOURSE_ELASTICSEARCH_URL + ## value: test + ## + extraEnvVars: [] + + ## Array to add extra configmaps: + ## + extraEnvVarsCM: [] + + ## Name of the secret that holds extra + ## env vars: + ## + # 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: +## 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: + ## 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 + ## + 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: {} + ## 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----- + ## + ## 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: + ## + +## 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/ +## +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 + ## 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: + ## + + ## 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 new file mode 100644 index 0000000000..d69f17b7de --- /dev/null +++ b/bitnami/discourse/values.yaml @@ -0,0 +1,538 @@ +## 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. The port will be automatilly included. + ## 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 + + ## Custom command to override image cmd + ## + # command: [] + + ## Custom args for the custom commad: + # args: [] + + containerSecurityContext: {} + ## 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 + + ## 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: + ## discourse: + ## - name: DISCOURSE_ELASTICSEARCH_URL + ## value: test + ## + extraEnvVars: [] + + ## Array to add extra configmaps: + ## + extraEnvVarsCM: [] + + ## Array to add extra environment + ## variables from a secret: + ## + # 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 + +sidekiq: + + containerSecurityContext: {} + ## capabilities: + ## drop: + ## - ALL + ## 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/ + ## + 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: 500 + periodSeconds: 10 + timeoutSeconds: 5 + failureThreshold: 6 + successThreshold: 1 + + readinessProbe: + enabled: true + initialDelaySeconds: 30 + periodSeconds: 10 + timeoutSeconds: 5 + 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: + ## - name: DISCOURSE_ELASTICSEARCH_URL + ## value: test + ## + extraEnvVars: [] + + ## Array to add extra configmaps: + ## + extraEnvVarsCM: [] + + ## Name of the secret that holds extra + ## env vars: + ## + # 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: +## 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 + accessMode: ReadWriteOnce + 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: + ## 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 + ## + 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: + + ## 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: {} + ## 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----- + ## + ## 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: + ## + +## 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/ +## +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 + ## 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: + ## + + ## 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: 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: true + +## +## External Redis +## +externalRedis: + ## Redis host + ## + host: "" + ## Redis port + ## + port: 6379 + ## Redis password for authentication + ## + password: ""