mirror of
https://github.com/truenas/charts.git
synced 2026-04-04 19:29:22 +08:00
NAS-124089 / 24.04 / Adds cron pod for wordpress (#1536)
This commit is contained in:
@@ -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"
|
||||
|
||||
@@ -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:
|
||||
|
||||
Binary file not shown.
BIN
library/ix-dev/community/wordpress/charts/common-1.1.1.tgz
Normal file
BIN
library/ix-dev/community/wordpress/charts/common-1.1.1.tgz
Normal file
Binary file not shown.
14
library/ix-dev/community/wordpress/ci/cron-values.yaml
Normal file
14
library/ix-dev/community/wordpress/ci/cron-values.yaml
Normal file
@@ -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
|
||||
@@ -33,6 +33,22 @@ questions:
|
||||
schema:
|
||||
type: dict
|
||||
attrs:
|
||||
- variable: enableCronJob
|
||||
label: Enable CronJob
|
||||
description: |
|
||||
Enable CronJob for Wordpress executed by Kubernetes scheduler.</br>
|
||||
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.
|
||||
|
||||
@@ -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 -}}
|
||||
|
||||
39
library/ix-dev/community/wordpress/templates/_cron.tpl
Normal file
39
library/ix-dev/community/wordpress/templates/_cron.tpl
Normal file
@@ -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 -}}
|
||||
@@ -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 -}}
|
||||
|
||||
@@ -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 -}}
|
||||
27
library/ix-dev/community/wordpress/templates/_service.tpl
Normal file
27
library/ix-dev/community/wordpress/templates/_service.tpl
Normal file
@@ -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 -}}
|
||||
@@ -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 -}}
|
||||
|
||||
@@ -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" $ -}}
|
||||
|
||||
@@ -9,6 +9,8 @@ resources:
|
||||
memory: 8Gi
|
||||
|
||||
wpConfig:
|
||||
enableCronJob: true
|
||||
cronSchedule: "*/15 * * * *"
|
||||
additionalEnvs: []
|
||||
|
||||
wpNetwork:
|
||||
|
||||
Reference in New Issue
Block a user