diff --git a/library/ix-dev/community/wordpress/Chart.lock b/library/ix-dev/community/wordpress/Chart.lock index 489124382a..de47750105 100644 --- a/library/ix-dev/community/wordpress/Chart.lock +++ b/library/ix-dev/community/wordpress/Chart.lock @@ -1,6 +1,6 @@ dependencies: - name: common repository: file://../../../common - version: 1.1.0 -digest: sha256:752ce76025f5b61094bd2b18ca11693eb9d26d0dde4eb2e63cd2330cbffe9e73 -generated: "2023-08-28T16:58:06.402626788+03:00" + version: 1.1.1 +digest: sha256:a7dbe3e4d42dbcd4325776e5e01a1d630c7f185f79e7ebf22b1b9cc80f56eed7 +generated: "2023-09-13T17:06:07.150719489+03:00" diff --git a/library/ix-dev/community/wordpress/Chart.yaml b/library/ix-dev/community/wordpress/Chart.yaml index 52723a964b..aed7c36621 100644 --- a/library/ix-dev/community/wordpress/Chart.yaml +++ b/library/ix-dev/community/wordpress/Chart.yaml @@ -3,7 +3,7 @@ description: Wordpress is a web content management system annotations: title: Wordpress type: application -version: 1.0.7 +version: 1.0.8 apiVersion: v2 appVersion: 6.3.1 kubeVersion: '>=1.16.0-0' @@ -14,7 +14,7 @@ maintainers: dependencies: - name: common repository: file://../../../common - version: 1.1.0 + version: 1.1.1 home: https://wordpress.org icon: https://github.com/WordPress/WordPress/blob/master/wp-admin/images/wordpress-logo.png?raw=true sources: diff --git a/library/ix-dev/community/wordpress/charts/common-1.1.0.tgz b/library/ix-dev/community/wordpress/charts/common-1.1.0.tgz deleted file mode 100644 index bb43c56ce2..0000000000 Binary files a/library/ix-dev/community/wordpress/charts/common-1.1.0.tgz and /dev/null differ diff --git a/library/ix-dev/community/wordpress/charts/common-1.1.1.tgz b/library/ix-dev/community/wordpress/charts/common-1.1.1.tgz new file mode 100644 index 0000000000..706a8a8c5d Binary files /dev/null and b/library/ix-dev/community/wordpress/charts/common-1.1.1.tgz differ diff --git a/library/ix-dev/community/wordpress/ci/cron-values.yaml b/library/ix-dev/community/wordpress/ci/cron-values.yaml new file mode 100644 index 0000000000..a595138e40 --- /dev/null +++ b/library/ix-dev/community/wordpress/ci/cron-values.yaml @@ -0,0 +1,14 @@ +wpConfig: + enableCronJob: true + cronSchedule: "*/1 * * * *" + +wpStorage: + data: + type: hostPath + hostPath: /mnt/{{ .Release.Name }}/data + mariadbData: + type: hostPath + hostPath: /mnt/{{ .Release.Name }}/mariadbData + mariadbBackup: + type: hostPath + hostPath: /mnt/{{ .Release.Name }}/mariadbBackup diff --git a/library/ix-dev/community/wordpress/questions.yaml b/library/ix-dev/community/wordpress/questions.yaml index f94d1b5e97..ffc65917ef 100644 --- a/library/ix-dev/community/wordpress/questions.yaml +++ b/library/ix-dev/community/wordpress/questions.yaml @@ -33,6 +33,22 @@ questions: schema: type: dict attrs: + - variable: enableCronJob + label: Enable CronJob + description: | + Enable CronJob for Wordpress executed by Kubernetes scheduler.
+ This will also disable running cron on page load. + schema: + type: boolean + default: false + - variable: cronSchedule + label: Cron Schedule + description: Cron schedule for Wordpress CronJob. + schema: + type: string + default: "*/15 * * * *" + show_if: [["enableCronJob", "=", true]] + required: true - variable: additionalEnvs label: Additional Environment Variables description: Configure additional environment variables for Wordpress. diff --git a/library/ix-dev/community/wordpress/templates/_configuration.tpl b/library/ix-dev/community/wordpress/templates/_configuration.tpl index 9fa4e00672..55b967645c 100644 --- a/library/ix-dev/community/wordpress/templates/_configuration.tpl +++ b/library/ix-dev/community/wordpress/templates/_configuration.tpl @@ -30,4 +30,9 @@ secret: WORDPRESS_DB_NAME: {{ $dbName }} WORDPRESS_DB_USER: {{ $dbUser }} WORDPRESS_DB_PASSWORD: {{ $dbPass }} + {{/* Disable On Page Load Cron when k8s CronJob is enabled */}} + {{- if .Values.wpConfig.enableCronJob }} + WORDPRESS_CONFIG_EXTRA: | + define( 'DISABLE_WP_CRON', true ); + {{- end -}} {{- end -}} diff --git a/library/ix-dev/community/wordpress/templates/_cron.tpl b/library/ix-dev/community/wordpress/templates/_cron.tpl new file mode 100644 index 0000000000..7f1675b3c1 --- /dev/null +++ b/library/ix-dev/community/wordpress/templates/_cron.tpl @@ -0,0 +1,39 @@ +{{- define "wordpress.cron" -}} +workload: + wordpress-cron: + enabled: true + type: CronJob + schedule: {{ .Values.wpConfig.cronSchedule | quote }} + podSpec: + hostNetwork: false + restartPolicy: Never + containers: + wordpress-cron: + enabled: true + primary: true + imageSelector: image + securityContext: + runAsUser: 33 + runAsGroup: 33 + command: + - /usr/local/bin/php + args: + - /var/www/html/wp-cron.php + envFrom: + - secretRef: + name: wordpress-creds + {{ with .Values.wpConfig.additionalEnvs }} + envList: + {{ range $env := . }} + - name: {{ $env.name }} + value: {{ $env.value }} + {{ end }} + {{ end }} + probes: + liveness: + enabled: false + readiness: + enabled: false + startup: + enabled: false +{{- end -}} diff --git a/library/ix-dev/community/wordpress/templates/_mariadb.tpl b/library/ix-dev/community/wordpress/templates/_mariadb.tpl index a5a91b2bb7..4944007ec3 100644 --- a/library/ix-dev/community/wordpress/templates/_mariadb.tpl +++ b/library/ix-dev/community/wordpress/templates/_mariadb.tpl @@ -3,48 +3,4 @@ workload: {{- include "ix.v1.common.app.mariadb" (dict "secretName" "mariadb-creds" "resources" .Values.resources "ixChartContext" .Values.ixChartContext) | nindent 2 }} -{{/* Service */}} -service: - mariadb: - enabled: true - type: ClusterIP - targetSelector: mariadb - ports: - mariadb: - enabled: true - primary: true - port: 3306 - targetPort: 3306 - targetSelector: mariadb - -{{/* Persistence */}} -persistence: - mariadbdata: - enabled: true - type: {{ .Values.wpStorage.mariadbData.type }} - datasetName: {{ .Values.wpStorage.mariadbData.datasetName | default "" }} - hostPath: {{ .Values.wpStorage.mariadbData.hostPath | default "" }} - targetSelector: - # MariaDB pod - mariadb: - # MariaDB container - mariadb: - mountPath: /var/lib/mysql - # MariaDB - Permissions container - permissions: - mountPath: /mnt/directories/mariadb_data - mariadbbackup: - enabled: true - type: {{ .Values.wpStorage.mariadbBackup.type }} - datasetName: {{ .Values.wpStorage.mariadbBackup.datasetName | default "" }} - hostPath: {{ .Values.wpStorage.mariadbBackup.hostPath | default "" }} - targetSelector: - # MariaDB backup pod - mariadbbackup: - # MariaDB backup container - mariadbbackup: - mountPath: /mariadb_backup - # MariaDB - Permissions container - permissions: - mountPath: /mnt/directories/mariadb_backup {{- end -}} diff --git a/library/ix-dev/community/wordpress/templates/_persistence.tpl b/library/ix-dev/community/wordpress/templates/_persistence.tpl new file mode 100644 index 0000000000..3a6caa9f1d --- /dev/null +++ b/library/ix-dev/community/wordpress/templates/_persistence.tpl @@ -0,0 +1,72 @@ +{{- define "wordpress.persistence" -}} +persistence: + data: + enabled: true + type: {{ .Values.wpStorage.data.type }} + datasetName: {{ .Values.wpStorage.data.datasetName | default "" }} + hostPath: {{ .Values.wpStorage.data.hostPath | default "" }} + targetSelector: + wordpress: + wordpress: + mountPath: /var/www/html + 01-permissions: + mountPath: /mnt/directories/data + wordpress-cron: + wordpress-cron: + mountPath: /var/www/html + {{- range $idx, $storage := .Values.wpStorage.additionalStorages }} + {{ printf "wp-%v" (int $idx) }}: + enabled: true + type: {{ $storage.type }} + datasetName: {{ $storage.datasetName | default "" }} + hostPath: {{ $storage.hostPath | default "" }} + targetSelector: + wordpress: + wordpress: + mountPath: {{ $storage.mountPath }} + 01-permissions: + mountPath: /mnt/directories{{ $storage.mountPath }} + {{- end }} + tmp: + enabled: true + type: emptyDir + targetSelector: + wordpress: + wordpress: + mountPath: /tmp + varrun: + enabled: true + type: emptyDir + targetSelector: + wordpress: + wordpress: + mountPath: /var/run + mariadbdata: + enabled: true + type: {{ .Values.wpStorage.mariadbData.type }} + datasetName: {{ .Values.wpStorage.mariadbData.datasetName | default "" }} + hostPath: {{ .Values.wpStorage.mariadbData.hostPath | default "" }} + targetSelector: + # MariaDB pod + mariadb: + # MariaDB container + mariadb: + mountPath: /var/lib/mysql + # MariaDB - Permissions container + permissions: + mountPath: /mnt/directories/mariadb_data + mariadbbackup: + enabled: true + type: {{ .Values.wpStorage.mariadbBackup.type }} + datasetName: {{ .Values.wpStorage.mariadbBackup.datasetName | default "" }} + hostPath: {{ .Values.wpStorage.mariadbBackup.hostPath | default "" }} + targetSelector: + # MariaDB backup pod + mariadbbackup: + # MariaDB backup container + mariadbbackup: + mountPath: /mariadb_backup + # MariaDB - Permissions container + permissions: + mountPath: /mnt/directories/mariadb_backup +{{- end -}} diff --git a/library/ix-dev/community/wordpress/templates/_service.tpl b/library/ix-dev/community/wordpress/templates/_service.tpl new file mode 100644 index 0000000000..8a99db3461 --- /dev/null +++ b/library/ix-dev/community/wordpress/templates/_service.tpl @@ -0,0 +1,27 @@ +{{- define "wordpress.service" -}} +service: + wordpress: + enabled: true + primary: true + type: NodePort + targetSelector: wordpress + ports: + webui: + enabled: true + primary: true + port: {{ .Values.wpNetwork.webPort }} + nodePort: {{ .Values.wpNetwork.webPort }} + targetPort: 80 + targetSelector: wordpress + mariadb: + enabled: true + type: ClusterIP + targetSelector: mariadb + ports: + mariadb: + enabled: true + primary: true + port: 3306 + targetPort: 3306 + targetSelector: mariadb +{{- end -}} diff --git a/library/ix-dev/community/wordpress/templates/_wordpress.tpl b/library/ix-dev/community/wordpress/templates/_wordpress.tpl index 42b9d333ca..d20112659c 100644 --- a/library/ix-dev/community/wordpress/templates/_wordpress.tpl +++ b/library/ix-dev/community/wordpress/templates/_wordpress.tpl @@ -47,60 +47,4 @@ workload: "type" "install") | nindent 8 }} {{- include "ix.v1.common.app.mariadbWait" (dict "name" "mariadb-wait" "secretName" "mariadb-creds") | nindent 8 }} -{{/* Service */}} -service: - wordpress: - enabled: true - primary: true - type: NodePort - targetSelector: wordpress - ports: - webui: - enabled: true - primary: true - port: {{ .Values.wpNetwork.webPort }} - nodePort: {{ .Values.wpNetwork.webPort }} - targetPort: 80 - targetSelector: wordpress - -{{/* Persistence */}} -persistence: - data: - enabled: true - type: {{ .Values.wpStorage.data.type }} - datasetName: {{ .Values.wpStorage.data.datasetName | default "" }} - hostPath: {{ .Values.wpStorage.data.hostPath | default "" }} - targetSelector: - wordpress: - wordpress: - mountPath: /var/www/html - 01-permissions: - mountPath: /mnt/directories/data - {{- range $idx, $storage := .Values.wpStorage.additionalStorages }} - {{ printf "wp-%v" (int $idx) }}: - enabled: true - type: {{ $storage.type }} - datasetName: {{ $storage.datasetName | default "" }} - hostPath: {{ $storage.hostPath | default "" }} - targetSelector: - wordpress: - wordpress: - mountPath: {{ $storage.mountPath }} - 01-permissions: - mountPath: /mnt/directories{{ $storage.mountPath }} - {{- end }} - tmp: - enabled: true - type: emptyDir - targetSelector: - wordpress: - wordpress: - mountPath: /tmp - varrun: - enabled: true - type: emptyDir - targetSelector: - wordpress: - wordpress: - mountPath: /var/run {{- end -}} diff --git a/library/ix-dev/community/wordpress/templates/common.yaml b/library/ix-dev/community/wordpress/templates/common.yaml index 8dfa28ebdf..ffd71be980 100644 --- a/library/ix-dev/community/wordpress/templates/common.yaml +++ b/library/ix-dev/community/wordpress/templates/common.yaml @@ -2,8 +2,13 @@ {{/* Merge the templates with Values */}} {{- $_ := mustMergeOverwrite .Values (include "wordpress.configuration" $ | fromYaml) -}} +{{- $_ := mustMergeOverwrite .Values (include "wordpress.persistence" $ | fromYaml) -}} +{{- $_ := mustMergeOverwrite .Values (include "wordpress.service" $ | fromYaml) -}} {{- $_ := mustMergeOverwrite .Values (include "wordpress.workload" $ | fromYaml) -}} {{- $_ := mustMergeOverwrite .Values (include "wordpress.mariadb.workload" $ | fromYaml) -}} +{{- if .Values.wpConfig.enableCronJob -}} + {{- $_ := mustMergeOverwrite .Values (include "wordpress.cron" $ | fromYaml) -}} +{{- end -}} {{/* Create the configmap for portal manually*/}} {{- include "wordpress.portal" $ -}} diff --git a/library/ix-dev/community/wordpress/values.yaml b/library/ix-dev/community/wordpress/values.yaml index 08138a77dc..94275230bd 100644 --- a/library/ix-dev/community/wordpress/values.yaml +++ b/library/ix-dev/community/wordpress/values.yaml @@ -9,6 +9,8 @@ resources: memory: 8Gi wpConfig: + enableCronJob: true + cronSchedule: "*/15 * * * *" additionalEnvs: [] wpNetwork: