From 9092df7e71ba2fa0c8fec9d6d95771452fcb3ee9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20de=20Paz=20Gal=C3=A1n?= Date: Thu, 19 Nov 2020 17:13:34 +0100 Subject: [PATCH] [bitnami/phpBB] Major version. Adapt Chart to apiVersion: v2 and Update MariaDB Dependency (#4353) * Drop Helm 2 support and update mariadb major * Add missing info * Migrate mariadb values * Remove requirements.lock * Format/Fix linter issues in yaml * [bitnami/phpbb] Update components versions Signed-off-by: Bitnami Containers Co-authored-by: fdepaz Co-authored-by: Carlos Rodriguez Hernandez Co-authored-by: Bitnami Containers --- bitnami/phpbb/Chart.lock | 9 ++ bitnami/phpbb/Chart.yaml | 30 +++-- bitnami/phpbb/README.md | 123 ++++++++++++++---- bitnami/phpbb/requirements.lock | 9 -- bitnami/phpbb/requirements.yaml | 8 -- bitnami/phpbb/templates/NOTES.txt | 25 ++-- bitnami/phpbb/templates/_helpers.tpl | 71 ++++++++-- bitnami/phpbb/templates/deployment.yaml | 40 +++--- .../phpbb/templates/externaldb-secrets.yaml | 9 +- bitnami/phpbb/templates/ingress.yaml | 9 +- bitnami/phpbb/templates/phpbb-pvc.yaml | 3 +- bitnami/phpbb/templates/secrets.yaml | 3 +- bitnami/phpbb/templates/svc.yaml | 6 +- bitnami/phpbb/templates/tls-secrets.yaml | 1 + bitnami/phpbb/values.yaml | 98 ++++++++++---- 15 files changed, 317 insertions(+), 127 deletions(-) create mode 100644 bitnami/phpbb/Chart.lock delete mode 100644 bitnami/phpbb/requirements.lock delete mode 100644 bitnami/phpbb/requirements.yaml diff --git a/bitnami/phpbb/Chart.lock b/bitnami/phpbb/Chart.lock new file mode 100644 index 000000000..4489b9e83 --- /dev/null +++ b/bitnami/phpbb/Chart.lock @@ -0,0 +1,9 @@ +dependencies: +- name: mariadb + repository: https://charts.bitnami.com/bitnami + version: 9.0.1 +- name: common + repository: https://charts.bitnami.com/bitnami + version: 1.0.1 +digest: sha256:7d78cbcd54bade2608462bb162c8487091689ff7f5cb65080a3d580dc6a24912 +generated: "2020-11-19T15:27:05.051431097Z" diff --git a/bitnami/phpbb/Chart.yaml b/bitnami/phpbb/Chart.yaml index 71b0f76a8..53e76dfc3 100644 --- a/bitnami/phpbb/Chart.yaml +++ b/bitnami/phpbb/Chart.yaml @@ -1,21 +1,29 @@ -apiVersion: v1 -name: phpbb -version: 8.0.5 +annotations: + category: Forum +apiVersion: v2 appVersion: 3.3.2 +dependencies: + - condition: mariadb.enabled + name: mariadb + repository: https://charts.bitnami.com/bitnami + version: 9.x.x + - name: common + repository: https://charts.bitnami.com/bitnami + version: 1.x.x description: Community forum that supports the notion of users and groups, file attachments, full-text search, notifications and more. +engine: gotpl +home: https://github.com/bitnami/charts/tree/master/bitnami/phpbb +icon: https://bitnami.com/assets/stacks/phpbb/img/phpbb-stack-220x234.png keywords: - phpbb - forum - http - php -home: https://github.com/bitnami/charts/tree/master/bitnami/phpbb -icon: https://bitnami.com/assets/stacks/phpbb/img/phpbb-stack-220x234.png +maintainers: + - email: containers@bitnami.com + name: Bitnami +name: phpbb sources: - https://github.com/bitnami/bitnami-docker-phpbb - https://www.phpbb.com/ -maintainers: - - name: Bitnami - email: containers@bitnami.com -engine: gotpl -annotations: - category: Forum +version: 9.0.0 diff --git a/bitnami/phpbb/README.md b/bitnami/phpbb/README.md index 3427e95c5..5d32344f1 100644 --- a/bitnami/phpbb/README.md +++ b/bitnami/phpbb/README.md @@ -20,7 +20,7 @@ Bitnami charts can be used with [Kubeapps](https://kubeapps.com/) for deployment ## Prerequisites - Kubernetes 1.12+ -- Helm 2.12+ or Helm 3.0-beta3+ +- Helm 3.0-beta3+ - PV provisioner support in the underlying infrastructure - ReadWriteMany volumes for deployment scaling @@ -68,8 +68,8 @@ The following table lists the configurable parameters of the phpBB chart and the | `image.pullPolicy` | phpBB image pull policy | `IfNotPresent` | | `image.pullSecrets` | Specify docker-registry secret names as an array | `[]` (does not add image pull secrets to deployed pods) | | `image.debug` | Specify if debug logs should be enabled | `false` | -| `nameOverride` | String to partially override phpbb.fullname template | `nil` | -| `fullnameOverride` | String to fully override phpbb.fullname template | `nil` | +| `nameOverride` | String to partially override common.names.fullname template | `nil` | +| `fullnameOverride` | String to fully override common.names.fullname template | `nil` | | `commonLabels` | Labels to add to all deployed objects | `nil` | | `commonAnnotations` | Annotations to add to all deployed objects | `[]` | | `extraDeploy` | Array of extra objects to deploy with the release (evaluated as a template). | `nil` | @@ -106,6 +106,9 @@ The following table lists the configurable parameters of the phpBB chart and the | `phpbbPassword` | Application password | _random 10 character alphanumeric string_ | | `phpbbEmail` | Admin email | `user@example.com` | | `phpbbDisableSessionValidation` | Disable session validation | `yes` | +| `nodeAffinityPreset.type` | Node affinity preset type. Ignored if `affinity` is set. Allowed values: `soft` or `hard` | `""` | +| `nodeAffinityPreset.key` | Node label key to match Ignored if `affinity` is set. | `""` | +| `nodeAffinityPreset.values` | Node label values to match. Ignored if `affinity` is set. | `[]` | | `nodeSelector` | Node labels for pod assignment | `{}` (The value is evaluated as a template) | | `persistence.accessMode` | PVC Access Mode for phpBB volume | `ReadWriteOnce` | | `persistence.enabled` | Enable persistence using PVC | `true` | @@ -113,10 +116,13 @@ The following table lists the configurable parameters of the phpBB chart and the | `persistence.hostPath` | Host mount path for phpBB volume | `nil` (will not mount to a host path) | | `persistence.size` | PVC Storage Request for phpBB volume | `8Gi` | | `persistence.storageClass` | PVC Storage Class for phpBB volume | `nil` (uses alpha storage class annotation) | +| `podAffinityPreset` | Pod affinity preset. Ignored if `affinity` is set. Allowed values: `soft` or `hard` | `""` | +| `podAntiAffinityPreset` | Pod anti-affinity preset. Ignored if `affinity` is set. Allowed values: `soft` or `hard` | `soft` | | `podAnnotations` | Pod annotations | `{}` | | `podLabels` | Add additional labels to the pod (evaluated as a template) | `nil` | | `podSecurityContext.enabled` | Enable phpBB pods' Security Context | `true` | | `podSecurityContext.fsGroup` | phpBB pods' group ID | `1001` | +| `priorityClassName` | Define the priority class name to use for the phpbb pods here. | `""` | | `readinessProbe` | Readiness probe configuration | `Check values.yaml file` | | `replicaCount` | Number of phpBB Pods to run | `1` | | `resources` | CPU/Memory resource requests/limits | Memory: `512Mi`, CPU: `300m` | @@ -139,6 +145,7 @@ The following table lists the configurable parameters of the phpBB chart and the | `service.externalTrafficPolicy` | Enable client source IP preservation | `Cluster` | | `service.nodePorts.http` | Kubernetes http node port | `""` | | `service.nodePorts.https` | Kubernetes https node port | `""` | +| `service.loadBalancerIP` | loadBalancerIP for phpBB Service | `nil` | | `ingress.enabled` | Enable ingress controller resource | `false` | | `ingress.certManager` | Add annotations for cert-manager | `false` | | `ingress.hostname` | Default host for the ingress resource | `phpbb.local` | @@ -153,25 +160,26 @@ The following table lists the configurable parameters of the phpBB chart and the ### Database parameters -| Parameter | Description | Default | -|--------------------------------------------|------------------------------------------|------------------------------------------------| -| `mariadb.enabled` | Whether to use the MariaDB chart | `true` | -| `mariadb.rootUser.password` | MariaDB admin password | `nil` | -| `mariadb.db.name` | Database name to create | `bitnami_phpbb` | -| `mariadb.db.user` | Database user to create | `bn_phpbb` | -| `mariadb.db.password` | Password for the database | _random 10 character long alphanumeric string_ | -| `mariadb.replication.enabled` | MariaDB replication enabled | `false` | -| `mariadb.master.persistence.enabled` | Enable database persistence using PVC | `true` | -| `mariadb.master.persistence.accessMode` | Database Persistent Volume Access Modes | `ReadWriteOnce` | -| `mariadb.master.persistence.size` | Database Persistent Volume Size | `8Gi` | -| `mariadb.master.persistence.existingClaim` | Enable persistence using an existing PVC | `nil` | -| `mariadb.master.persistence.storageClass` | PVC Storage Class | `nil` (uses alpha storage class annotation) | -| `mariadb.master.persistence.hostPath` | Host mount path for MariaDB volume | `nil` (will not mount to a host path) | -| `externalDatabase.user` | Existing username in the external db | `bn_phpbb` | -| `externalDatabase.password` | Password for the above username | `nil` | -| `externalDatabase.database` | Name of the existing database | `bitnami_phpbb` | -| `externalDatabase.host` | Host of the existing database | `nil` | -| `externalDatabase.port` | Port of the existing database | `3306` | +| Parameter | Description | Default | +|--------------------------------------------|-----------------------------------------------------------------------------|------------------------------------------------| +| `mariadb.enabled` | Whether to use the MariaDB chart | `true` | +| `mariadb.architecture` | MariaDB architecture (`standalone` or `replication`) | `standalone` | +| `mariadb.auth.rootPassword` | Password for the MariaDB `root` user | _random 10 character alphanumeric string_ | +| `mariadb.auth.database` | Database name to create | `bitnami_phpbb` | +| `mariadb.auth.username` | Database user to create | `bn_phpbb` | +| `mariadb.auth.password` | Password for the database | _random 10 character long alphanumeric string_ | +| `mariadb.primary.persistence.enabled` | Enable database persistence using PVC | `true` | +| `mariadb.primary.persistence.existingClaim`| Name of an existing `PersistentVolumeClaim` for MariaDB primary replicas | `nil` | +| `mariadb.primary.persistence.accessMode` | Database Persistent Volume Access Modes | `[ReadWriteOnce]` | +| `mariadb.primary.persistence.size` | Database Persistent Volume Size | `8Gi` | +| `mariadb.primary.persistence.storageClass` | MariaDB primary persistent volume storage Class | `nil` (uses alpha storage class annotation) | +| `mariadb.primary.persistence.hostPath` | Host mount path for MariaDB volume | `nil` (will not mount to a host path) | +| `externalDatabase.user` | Existing username in the external db | `bn_phpbb` | +| `externalDatabase.password` | Password for the above username | `nil` | +| `externalDatabase.database` | Name of the existing database | `bitnami_phpbb` | +| `externalDatabase.host` | Host of the existing database | `nil` | +| `externalDatabase.port` | Port of the existing database | `3306` | +| `externalDatabase.existingSecret` | Name of the database existing Secret Object | `nil` | ### Metrics parameters @@ -276,6 +284,77 @@ Find more information about how to deal with common errors related to Bitnami’ ## Upgrading +### To 9.0.0 + +In this major there were two main changes introduced: + +1. Adaptation to Helm v2 EOL +2. Updated MariaDB dependency version + +Please read the update notes carefully. + +**1. Adaptation to Helm v2 EOL** + +[On November 13, 2020, Helm v2 support was formally finished](https://github.com/helm/charts#status-of-the-project), this major version is the result of the required changes applied to the Helm Chart to be able to incorporate the different features added in Helm v3 and to be consistent with the Helm project itself regarding the Helm v2 EOL. + +**What changes were introduced in this major version?** + +- Previous versions of this Helm Chart use `apiVersion: v1` (installable by both Helm 2 and 3), this Helm Chart was updated to `apiVersion: v2` (installable by Helm 3 only). [Here](https://helm.sh/docs/topics/charts/#the-apiversion-field) you can find more information about the `apiVersion` field. +- Move dependency information from the *requirements.yaml* to the *Chart.yaml* +- After running `helm dependency update`, a *Chart.lock* file is generated containing the same structure used in the previous *requirements.lock* +- The different fields present in the *Chart.yaml* file has been ordered alphabetically in a homogeneous way for all the Bitnami Helm Charts + +**Considerations when upgrading to this version** + +- If you want to upgrade to this version from a previous one installed with Helm v3, you shouldn't face any issues +- If you want to upgrade to this version using Helm v2, this scenario is not supported as this version doesn't support Helm v2 anymore +- If you installed the previous version with Helm v2 and wants to upgrade to this version with Helm v3, please refer to the [official Helm documentation](https://helm.sh/docs/topics/v2_v3_migration/#migration-use-cases) about migrating from Helm v2 to v3 + +**Useful links** + +- https://docs.bitnami.com/tutorials/resolve-helm2-helm3-post-migration-issues/ +- https://helm.sh/docs/topics/v2_v3_migration/ +- https://helm.sh/blog/migrate-from-helm-v2-to-helm-v3/ + +**2. Updated MariaDB dependency version** + +In this major the MariaDB dependency version was also bumped to a new major version that introduces several incompatilibites. Therefore, backwards compatibility is not guaranteed unless an external database is used. Check [MariaDB Upgrading Notes](https://github.com/bitnami/charts/tree/master/bitnami/mariadb#to-800) for more information. + +To upgrade to `9.0.0`, it should be done reusing the PVCs used to hold both the MariaDB and phpBB data on your previous release. To do so, follow the instructions below (the following example assumes that the release name is `phpbb`): + +> NOTE: Please, create a backup of your database before running any of those actions. The steps below would be only valid if your application (e.g. any plugins or custom code) is compatible with MariaDB 10.5.x + +Obtain the credentials and the names of the PVCs used to hold both the MariaDB and phpBB data on your current release: + +```console +export PHPBB_PASSWORD=$(kubectl get secret --namespace default phpbb -o jsonpath="{.data.phpbb-password}" | base64 --decode) +export MARIADB_ROOT_PASSWORD=$(kubectl get secret --namespace default phpbb-mariadb -o jsonpath="{.data.mariadb-root-password}" | base64 --decode) +export MARIADB_PASSWORD=$(kubectl get secret --namespace default phpbb-mariadb -o jsonpath="{.data.mariadb-password}" | base64 --decode) +export MARIADB_PVC=$(kubectl get pvc -l app=mariadb,component=master,release=phpbb -o jsonpath="{.items[0].metadata.name}") +``` + +Upgrade your release (maintaining the version) disabling MariaDB and scaling phpBB replicas to 0: + +```console +$ helm upgrade phpbb bitnami/phpbb --set phpbbPassword=$PHPBB_PASSWORD --set replicaCount=0 --set mariadb.enabled=false --version 8.0.5 +``` + +Finally, upgrade you release to 9.0.0 reusing the existing PVC, and enabling back MariaDB: + +```console +$ helm upgrade phpbb bitnami/phpbb --set mariadb.primary.persistence.existingClaim=$MARIADB_PVC --set mariadb.auth.rootPassword=$MARIADB_ROOT_PASSWORD --set mariadb.auth.password=$MARIADB_PASSWORD --set phpbbPassword=$PHPBB_PASSWORD +``` + +You should see the lines below in MariaDB container logs: + +```console +$ kubectl logs $(kubectl get pods -l app.kubernetes.io/instance=phpbb,app.kubernetes.io/name=mariadb,app.kubernetes.io/component=primary -o jsonpath="{.items[0].metadata.name}") +... +mariadb 12:13:24.98 INFO ==> Using persisted data +mariadb 12:13:25.01 INFO ==> Running mysql_upgrade +... +``` + ### To 8.0.0 The [Bitnami phpBB](https://github.com/bitnami/bitnami-docker-phpbb) image was migrated to a "non-root" user approach. Previously the container ran as the `root` user and the Apache daemon was started as the `daemon` user. From now on, both the container and the Apache daemon run as user `1001`. You can revert this behavior by setting the parameters `containerSecurityContext.runAsUser` to `root`. diff --git a/bitnami/phpbb/requirements.lock b/bitnami/phpbb/requirements.lock deleted file mode 100644 index eda36c536..000000000 --- a/bitnami/phpbb/requirements.lock +++ /dev/null @@ -1,9 +0,0 @@ -dependencies: -- name: mariadb - repository: https://charts.bitnami.com/bitnami - version: 7.10.4 -- name: common - repository: https://charts.bitnami.com/bitnami - version: 0.7.1 -digest: sha256:5f22fe7cbd6975ac37e970b3d200a18ed6f1eafe5ab80ca22d2aba0eb4472e80 -generated: "2020-10-13T15:21:57.913161567Z" diff --git a/bitnami/phpbb/requirements.yaml b/bitnami/phpbb/requirements.yaml deleted file mode 100644 index ef4b43870..000000000 --- a/bitnami/phpbb/requirements.yaml +++ /dev/null @@ -1,8 +0,0 @@ -dependencies: - - name: mariadb - version: 7.x.x - repository: https://charts.bitnami.com/bitnami - condition: mariadb.enabled - - name: common - version: 0.7.x - repository: https://charts.bitnami.com/bitnami diff --git a/bitnami/phpbb/templates/NOTES.txt b/bitnami/phpbb/templates/NOTES.txt index 4a1b29eb9..16402a95b 100644 --- a/bitnami/phpbb/templates/NOTES.txt +++ b/bitnami/phpbb/templates/NOTES.txt @@ -18,23 +18,23 @@ {{- end }} {{- end }} {{- else if contains "NodePort" .Values.service.type }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "phpbb.fullname" . }}) + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "common.names.fullname" . }}) export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") echo "phpBB URL: http://$NODE_IP:$NODE_PORT/" {{- else if contains "LoadBalancer" .Values.service.type }} -** Please ensure an external IP is associated to the {{ template "phpbb.fullname" . }} service before proceeding ** -** Watch the status using: kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "phpbb.fullname" . }} ** +** Please ensure an external IP is associated to the {{ template "common.names.fullname" . }} service before proceeding ** +** Watch the status using: kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "common.names.fullname" . }} ** - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "phpbb.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "common.names.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") {{- $port:=.Values.service.port | toString }} echo "phpBB URL: http://$SERVICE_IP{{- if ne $port "80" }}:{{ .Values.service.port }}{{ end }}/" {{- else if contains "ClusterIP" .Values.service.type }} - kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ template "phpbb.fullname" . }} 8080:{{ .Values.service.port }} + kubectl port-forward --namespace {{ .Release.Namespace }} svc/{{ template "common.names.fullname" . }} 8080:{{ .Values.service.port }} echo "phpBB URL: http://127.0.0.1:8080/" {{- end }} @@ -61,22 +61,25 @@ host. To configure phpBB to use and external database host: {{- include "phpbb.checkRollingTags" . }} -{{- $passwordErrors := list -}} +{{- $passwordValidationErrors := list -}} {{- $secretName := include "phpbb.secretName" . -}} {{- if not .Values.existingSecret -}} {{- $requiredphpBBPassword := dict "valueKey" "phpbbPassword" "secret" $secretName "field" "phpbb-password" "context" $ -}} {{- $requiredphpBBPasswordError := include "common.validations.values.single.empty" $requiredphpBBPassword -}} - {{- $passwordErrors = append $passwordErrors $requiredphpBBPasswordError -}} + {{- $passwordValidationErrors = append $passwordValidationErrors $requiredphpBBPasswordError -}} {{- end -}} -{{- $passwordMysqlErrors := include "common.validations.values.mariadb.passwords" (dict "secretName" (include "phpbb.mariadb.fullname" .) "context" $) -}} -{{- $passwordErrors = append $passwordErrors $passwordMysqlErrors -}} +{{- $databaseSecretName := include "phpbb.databaseSecretName" . -}} -{{- include "common.errors.upgrade.passwords.empty" (dict "validationErrors" $passwordErrors "context" $) -}} +{{- if .Values.mariadb.enabled }} + {{- $mariadbPasswordValidationErrors := include "common.validations.values.mariadb.passwords" (dict "secret" $databaseSecretName "subchart" true "context" $) -}} + {{- $passwordValidationErrors = append $passwordValidationErrors $mariadbPasswordValidationErrors -}} +{{- end }} + +{{- include "common.errors.upgrade.passwords.empty" (dict "validationErrors" $passwordValidationErrors "context" $) -}} {{- if and (not .Values.mariadb.enabled) .Release.IsUpgrade -}} - {{- $databaseSecretName := printf "%s-%s" .Release.Name "externaldb" -}} {{- $requiredExternalPassword := dict "valueKey" "externalDatabase.password" "secret" $databaseSecretName "field" "db-password" -}} WARNING: Review values for the following password in the command, if they are correct please ignore this notice. diff --git a/bitnami/phpbb/templates/_helpers.tpl b/bitnami/phpbb/templates/_helpers.tpl index 0e284bc5e..7a5484d95 100644 --- a/bitnami/phpbb/templates/_helpers.tpl +++ b/bitnami/phpbb/templates/_helpers.tpl @@ -1,11 +1,3 @@ -{{/* -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 "phpbb.fullname" -}} -{{- include "common.names.fullname" . -}} -{{- 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). @@ -51,7 +43,7 @@ Return the proper Storage Class {{/* phpBB credential secret name */}} {{- define "phpbb.secretName" -}} -{{- coalesce .Values.existingSecret (include "phpbb.fullname" .) -}} +{{- coalesce .Values.existingSecret (include "common.names.fullname" .) -}} {{- end -}} {{/* Check if there are rolling tags in the images */}} @@ -59,3 +51,64 @@ Return the proper Storage Class {{- include "common.warnings.rollingTag" .Values.image -}} {{- include "common.warnings.rollingTag" .Values.metrics.image -}} {{- end -}} + +{{/* +Return the MariaDB Hostname +*/}} +{{- define "phpbb.databaseHost" -}} +{{- if .Values.mariadb.enabled }} + {{- if eq .Values.mariadb.architecture "replication" }} + {{- printf "%s-%s" (include "phpbb.mariadb.fullname" .) "primary" | trunc 63 | trimSuffix "-" -}} + {{- else -}} + {{- printf "%s" (include "phpbb.mariadb.fullname" .) -}} + {{- end -}} +{{- else -}} + {{- printf "%s" .Values.externalDatabase.host -}} +{{- end -}} +{{- end -}} + +{{/* +Return the MariaDB Port +*/}} +{{- define "phpbb.databasePort" -}} +{{- if .Values.mariadb.enabled }} + {{- printf "3306" -}} +{{- else -}} + {{- printf "%d" (.Values.externalDatabase.port | int ) -}} +{{- end -}} +{{- end -}} + +{{/* +Return the MariaDB Database Name +*/}} +{{- define "phpbb.databaseName" -}} +{{- if .Values.mariadb.enabled }} + {{- printf "%s" .Values.mariadb.auth.database -}} +{{- else -}} + {{- printf "%s" .Values.externalDatabase.database -}} +{{- end -}} +{{- end -}} + +{{/* +Return the MariaDB User +*/}} +{{- define "phpbb.databaseUser" -}} +{{- if .Values.mariadb.enabled }} + {{- printf "%s" .Values.mariadb.auth.username -}} +{{- else -}} + {{- printf "%s" .Values.externalDatabase.user -}} +{{- end -}} +{{- end -}} + +{{/* +Return the MariaDB Secret Name +*/}} +{{- define "phpbb.databaseSecretName" -}} +{{- if .Values.mariadb.enabled }} + {{- printf "%s" (include "phpbb.mariadb.fullname" .) -}} +{{- else if .Values.externalDatabase.existingSecret -}} + {{- printf "%s" .Values.externalDatabase.existingSecret -}} +{{- else -}} + {{- printf "%s-%s" .Release.Name "externaldb" -}} +{{- end -}} +{{- end -}} diff --git a/bitnami/phpbb/templates/deployment.yaml b/bitnami/phpbb/templates/deployment.yaml index 9b6c6d4fb..55f9e029f 100644 --- a/bitnami/phpbb/templates/deployment.yaml +++ b/bitnami/phpbb/templates/deployment.yaml @@ -1,8 +1,9 @@ apiVersion: {{ include "common.capabilities.deployment.apiVersion" . }} kind: Deployment metadata: - name: {{ template "phpbb.fullname" . }} + name: {{ template "common.names.fullname" . }} labels: {{- include "common.labels.standard" . | nindent 4 }} + app.kubernetes.io/component: phpbb {{- if .Values.commonLabels }} {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} {{- end }} @@ -19,6 +20,7 @@ spec: template: metadata: labels: {{- include "common.labels.standard" . | nindent 8 }} + app.kubernetes.io/component: phpbb {{- if .Values.commonLabels }} {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 8 }} {{- end }} @@ -39,6 +41,11 @@ spec: {{- end }} {{- if .Values.affinity }} affinity: {{- include "common.tplvalues.render" (dict "value" .Values.affinity "context" $) | nindent 8 }} + {{- else }} + affinity: + podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "context" $) | nindent 10 }} + podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "context" $) | nindent 10 }} + nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.nodeAffinityPreset.type "key" .Values.nodeAffinityPreset.key "values" .Values.nodeAffinityPreset.values) | nindent 10 }} {{- end }} {{- if .Values.nodeSelector }} nodeSelector: {{- include "common.tplvalues.render" (dict "value" .Values.nodeSelector "context" $) | nindent 8 }} @@ -46,6 +53,9 @@ spec: {{- if .Values.tolerations }} tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" $) | nindent 8 }} {{- end }} + {{- if .Values.priorityClassName }} + priorityClassName: {{ .Values.priorityClassName | quote }} + {{- end }} hostAliases: - ip: "127.0.0.1" hostnames: @@ -94,35 +104,19 @@ spec: value: {{ .Values.containerPorts.http | quote }} - name: APACHE_HTTPS_PORT_NUMBER value: {{ .Values.containerPorts.https | quote }} - {{- if .Values.mariadb.enabled }} - name: PHPBB_DATABASE_HOST - value: {{ template "phpbb.mariadb.fullname" . }} + value: {{ include "phpbb.databaseHost" . | quote }} - name: PHPBB_DATABASE_PORT_NUMBER - value: "3306" + value: {{ include "phpbb.databasePort" . | quote }} - name: PHPBB_DATABASE_NAME - value: {{ .Values.mariadb.db.name | quote }} + value: {{ include "phpbb.databaseName" . | quote }} - name: PHPBB_DATABASE_USER - value: {{ .Values.mariadb.db.user | quote }} + value: {{ include "phpbb.databaseUser" . | quote }} - name: PHPBB_DATABASE_PASSWORD valueFrom: secretKeyRef: - name: {{ template "phpbb.mariadb.fullname" . }} + name: {{ include "phpbb.databaseSecretName" . }} key: mariadb-password - {{- else }} - - name: PHPBB_DATABASE_HOST - value: {{ .Values.externalDatabase.host | quote }} - - name: PHPBB_DATABASE_PORT_NUMBER - value: {{ .Values.externalDatabase.port | quote }} - - name: PHPBB_DATABASE_NAME - value: {{ .Values.externalDatabase.database | quote }} - - name: PHPBB_DATABASE_USER - value: {{ .Values.externalDatabase.user | quote }} - - name: PHPBB_DATABASE_PASSWORD - valueFrom: - secretKeyRef: - name: {{ printf "%s-%s" .Release.Name "externaldb" }} - key: db-password - {{- end }} - name: PHPBB_SKIP_BOOTSTRAP value: {{ default "no" .Values.phpbbSkipInstall | quote }} - name: PHPBB_USERNAME @@ -233,7 +227,7 @@ spec: - name: phpbb-data {{- if .Values.persistence.enabled }} persistentVolumeClaim: - claimName: {{ .Values.persistence.existingClaim | default (include "phpbb.fullname" . ) }} + claimName: {{ .Values.persistence.existingClaim | default (include "common.names.fullname" . ) }} {{- else }} emptyDir: {} {{- end }} diff --git a/bitnami/phpbb/templates/externaldb-secrets.yaml b/bitnami/phpbb/templates/externaldb-secrets.yaml index f89f7be79..06e77fb46 100644 --- a/bitnami/phpbb/templates/externaldb-secrets.yaml +++ b/bitnami/phpbb/templates/externaldb-secrets.yaml @@ -4,7 +4,14 @@ kind: Secret metadata: name: {{ printf "%s-%s" .Release.Name "externaldb" }} labels: {{- include "common.labels.standard" . | nindent 4 }} + app.kubernetes.io/component: phpbb + {{- if .Values.commonLabels }} + {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} + {{- end }} + {{- if .Values.commonAnnotations }} + annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }} + {{- end }} type: Opaque data: - db-password: {{ default "" .Values.externalDatabase.password | b64enc | quote }} + mariadb-password: {{ default "" .Values.externalDatabase.password | b64enc | quote }} {{- end }} diff --git a/bitnami/phpbb/templates/ingress.yaml b/bitnami/phpbb/templates/ingress.yaml index 321006412..db353bbdb 100644 --- a/bitnami/phpbb/templates/ingress.yaml +++ b/bitnami/phpbb/templates/ingress.yaml @@ -1,9 +1,10 @@ {{- if .Values.ingress.enabled }} -apiVersion: extensions/v1beta1 +apiVersion: {{ include "common.capabilities.ingress.apiVersion" . }} kind: Ingress metadata: - name: {{ include "phpbb.fullname" . }} + name: {{ include "common.names.fullname" . }} labels: {{- include "common.labels.standard" . | nindent 4 }} + app.kubernetes.io/component: phpbb {{- if .Values.commonLabels }} {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} {{- end }} @@ -24,7 +25,7 @@ spec: paths: - path: {{ default "/" .path }} backend: - serviceName: {{ include "phpbb.fullname" $ }} + serviceName: {{ include "common.names.fullname" $ }} servicePort: 80 {{- range .Values.ingress.hosts }} - host: {{ .name }} @@ -32,7 +33,7 @@ spec: paths: - path: {{ default "/" .path }} backend: - serviceName: {{ include "phpbb.fullname" $ }} + serviceName: {{ include "common.names.fullname" $ }} servicePort: http {{- end }} {{- if .Values.ingress.tls }} diff --git a/bitnami/phpbb/templates/phpbb-pvc.yaml b/bitnami/phpbb/templates/phpbb-pvc.yaml index 4b994d496..3bbb6d34c 100644 --- a/bitnami/phpbb/templates/phpbb-pvc.yaml +++ b/bitnami/phpbb/templates/phpbb-pvc.yaml @@ -2,8 +2,9 @@ kind: PersistentVolumeClaim apiVersion: v1 metadata: - name: {{ template "phpbb.fullname" . }} + name: {{ template "common.names.fullname" . }} labels: {{- include "common.labels.standard" . | nindent 4 }} + app.kubernetes.io/component: phpbb {{- if .Values.commonLabels }} {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} {{- end }} diff --git a/bitnami/phpbb/templates/secrets.yaml b/bitnami/phpbb/templates/secrets.yaml index d6bb192b8..a74e15d2d 100644 --- a/bitnami/phpbb/templates/secrets.yaml +++ b/bitnami/phpbb/templates/secrets.yaml @@ -2,8 +2,9 @@ apiVersion: v1 kind: Secret metadata: - name: {{ template "phpbb.fullname" . }} + name: {{ template "common.names.fullname" . }} labels: {{- include "common.labels.standard" . | nindent 4 }} + app.kubernetes.io/component: phpbb {{- if .Values.commonLabels }} {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} {{- end }} diff --git a/bitnami/phpbb/templates/svc.yaml b/bitnami/phpbb/templates/svc.yaml index 32aef7921..320e700ba 100644 --- a/bitnami/phpbb/templates/svc.yaml +++ b/bitnami/phpbb/templates/svc.yaml @@ -1,8 +1,9 @@ apiVersion: v1 kind: Service metadata: - name: {{ template "phpbb.fullname" . }} + name: {{ template "common.names.fullname" . }} labels: {{- include "common.labels.standard" . | nindent 4 }} + app.kubernetes.io/component: phpbb {{- if .Values.commonLabels }} {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }} {{- end }} @@ -11,6 +12,9 @@ metadata: {{- end }} spec: type: {{ .Values.service.type }} + {{- if (and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerIP))) }} + loadBalancerIP: {{ .Values.service.loadBalancerIP }} + {{- end }} {{- if (or (eq .Values.service.type "LoadBalancer") (eq .Values.service.type "NodePort")) }} externalTrafficPolicy: {{ .Values.service.externalTrafficPolicy | quote }} {{- end }} diff --git a/bitnami/phpbb/templates/tls-secrets.yaml b/bitnami/phpbb/templates/tls-secrets.yaml index 36742a979..059161846 100644 --- a/bitnami/phpbb/templates/tls-secrets.yaml +++ b/bitnami/phpbb/templates/tls-secrets.yaml @@ -5,6 +5,7 @@ kind: Secret metadata: name: {{ .name }} labels: {{- include "common.labels.standard" $ | nindent 4 }} + app.kubernetes.io/component: phpbb {{- if $.Values.commonLabels }} {{- include "common.tplvalues.render" ( dict "value" $.Values.commonLabels "context" $ ) | nindent 4 }} {{- end }} diff --git a/bitnami/phpbb/values.yaml b/bitnami/phpbb/values.yaml index 8102ae17c..14957ff33 100644 --- a/bitnami/phpbb/values.yaml +++ b/bitnami/phpbb/values.yaml @@ -14,7 +14,7 @@ image: registry: docker.io repository: bitnami/phpbb - tag: 3.3.2-debian-10-r0 + tag: 3.3.2-debian-10-r13 ## 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 @@ -32,11 +32,11 @@ image: ## debug: false -## String to partially override phpbb.fullname template (will maintain the release name) +## String to partially override common.names.fullname template (will maintain the release name) ## nameOverride: -## String to fully override phpbb.fullname template +## String to fully override common.names.fullname template ## fullnameOverride: @@ -57,7 +57,7 @@ phpbbDisableSessionValidation: "yes" ## User of the application ## ref: https://github.com/bitnami/bitnami-docker-phpbb#configuration ## -phpbbUser: user +phpbbUsername: user ## Application password ## Defaults to a random 10-character alphanumeric string if not set @@ -173,6 +173,11 @@ volumePermissions: ## External database configuration ## externalDatabase: + ## Use existing secret (ignores previous password) + ## must contain key `mariadb-password` + ## NOTE: When it's set, the `externalDatabase.password` parameter is ignored + # existingSecret: + ## Database host ## host: "" @@ -210,31 +215,30 @@ mariadb: ## Whether to deploy a mariadb server to satisfy the applications database requirements. To use an external database set this to false and configure the externalDatabase parameters ## enabled: true - ## Disable MariaDB replication - ## - replication: - enabled: false - ## Create a database and a database user - ## ref: https://github.com/bitnami/bitnami-docker-mariadb/blob/master/README.md#creating-a-database-user-on-first-run + ## MariaDB architecture. Allowed values: standalone or replication ## - db: - name: bitnami_phpbb - user: bn_phpbb - ## If the password is not specified, mariadb will generates a random password + architecture: standalone + + ## MariaDB Authentication parameters + ## + auth: + ## MariaDB root password + ## ref: https://github.com/bitnami/bitnami-docker-mariadb#setting-the-root-password-on-first-run ## + rootPassword: "" + ## MariaDB custom user and database + ## ref: https://github.com/bitnami/bitnami-docker-mariadb/blob/master/README.md#creating-a-database-on-first-run + ## ref: https://github.com/bitnami/bitnami-docker-mariadb/blob/master/README.md#creating-a-database-user-on-first-run + ## + database: bitnami_phpbb + username: bn_phpbb password: "" - ## MariaDB admin password - ## ref: https://github.com/bitnami/bitnami-docker-mariadb/blob/master/README.md#setting-the-root-password-on-first-run - ## - rootUser: - password: "" - - ## Enable persistence using Persistent Volume Claims - ## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ - ## - master: + primary: + ## Enable persistence using Persistent Volume Claims + ## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ + ## persistence: enabled: true ## mariadb data Persistent Volume Storage Class @@ -270,6 +274,10 @@ service: port: 80 # HTTPS Port httpsPort: 443 + ## loadBalancerIP for the phpBB Service (optional, cloud specific) + ## ref: http://kubernetes.io/docs/user-guide/services/#type-loadbalancer + ## + ## loadBalancerIP: ## ## nodePorts: ## http: @@ -370,7 +378,40 @@ persistence: ## hostPath: -## Affinity for pod assignment +## Pod affinity preset +## ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity +## Allowed values: soft, hard +## +podAffinityPreset: "" + +## Pod anti-affinity preset +## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#inter-pod-affinity-and-anti-affinity +## Allowed values: soft, hard +## +podAntiAffinityPreset: soft + +## Node affinity preset +## Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#node-affinity +## Allowed values: soft, hard +## +nodeAffinityPreset: + ## Node affinity type + ## Allowed values: soft, hard + type: "" + ## Node label key to match + ## E.g. + ## key: "kubernetes.io/e2e-az-name" + ## + key: "" + ## Node label values to match + ## E.g. + ## values: + ## - e2e-az1 + ## - e2e-az2 + ## + values: [] + +## Affinity for pod assignment. Evaluated as a template. ## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity ## affinity: {} @@ -424,6 +465,11 @@ customLivenessProbe: {} customReadinessProbe: {} +## phpBB pods' priority. +## ref: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/ +## +# priorityClassName: "" + ## lifecycleHooks for the container to automate configuration before or after startup. ## lifecycleHooks: @@ -445,7 +491,7 @@ metrics: image: registry: docker.io repository: bitnami/apache-exporter - tag: 0.8.0-debian-10-r203 + tag: 0.8.0-debian-10-r217 pullPolicy: IfNotPresent ## Optionally specify an array of imagePullSecrets. ## Secrets must be manually created in the namespace.