Skip to content

Commit

Permalink
merge, keeping both value changes
Browse files Browse the repository at this point in the history
  • Loading branch information
JannikBadenhop committed Nov 11, 2024
2 parents 92cd8c0 + be3d94e commit e17db98
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 22 deletions.
10 changes: 6 additions & 4 deletions charts/dbp-moodle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ The Chart can be deployed without any modification but it is advised to set own
| dbpMoodle.backup.retention_time | string | `"6M"` | Defines the maximum age of a backup before it is deleted |
| dbpMoodle.backup.secrets | object | `{"existingSecret":"","s3_access_key":"","s3_access_secret":"","s3_endpoint_url":""}` | Either provide an existing secret, or set each secret value here. If both are set the existingSecret is used |
| dbpMoodle.backup.secrets.existingSecret | string | `""` | Existing secret for s3 endpoint |
| dbpMoodle.debug | bool | `false` | Moodle debugging is not safe for production |
| dbpMoodle.external_pvc.accessModes[0] | string | `"ReadWriteMany"` | |
| dbpMoodle.external_pvc.annotations."helm.sh/resource-policy" | string | `"keep"` | |
| dbpMoodle.external_pvc.enabled | bool | `true` | |
Expand All @@ -102,7 +101,6 @@ The Chart can be deployed without any modification but it is advised to set own
| dbpMoodle.hpa.scaledown_value | int | `25` | The max amount in percent to scale down in one step per cooldown period |
| dbpMoodle.hpa.scaleup_cooldown | int | `15` | How many seconds to wait between upscaling adjustments |
| dbpMoodle.hpa.scaleup_value | int | `50` | The max amount in percent to scale up in one step per cooldown period |
| dbpMoodle.logging | bool | `false` | Extended php logging |
| dbpMoodle.moodleUpdatePreparationHook.rules[0].apiGroups[0] | string | `"apps"` | |
| dbpMoodle.moodleUpdatePreparationHook.rules[0].resources[0] | string | `"deployments"` | |
| dbpMoodle.moodleUpdatePreparationHook.rules[0].verbs[0] | string | `"get"` | |
Expand All @@ -119,6 +117,9 @@ The Chart can be deployed without any modification but it is advised to set own
| dbpMoodle.moodleUpdatePreparationJob.kubectlImage | string | `"bitnami/kubectl:1.30.4-debian-12-r3"` | Which kubectl image to use |
| dbpMoodle.moodlecronjob | object | `{"rules":[{"apiGroups":[""],"resources":["pods","pods/exec"],"verbs":["get","list","create","watch"]}],"wait_timeout":"15m"}` | Configuration for the moodle-cronjob which runs moodles cron.php. This is required since moodle does not run as root |
| dbpMoodle.name | string | `"infra"` | |
| dbpMoodle.phpConfig.additional | string | `""` | Any additional text to be included into the config.php |
| dbpMoodle.phpConfig.debug | bool | `false` | Moodle debugging is not safe for production |
| dbpMoodle.phpConfig.extendedLogging | bool | `false` | Extended php logging |
| dbpMoodle.redis | object | `{"host":"moodle-redis-master","password":"","port":6379}` | Configurations for the optional redis |
| dbpMoodle.restore | object | `{"affinity":{},"enabled":false,"existingSecretDatabase":"moodle","existingSecretGPG":"","existingSecretKeyDatabase":"","existingSecretKeyS3Access":"","existingSecretKeyS3Secret":"","existingSecretS3":"","image":"ghcr.io/dbildungsplattform/moodle-tools:1.0.7","resources":{"limits":{"cpu":"2000m","memory":"16Gi"},"requests":{"cpu":"1000m","memory":"8Gi"}},"rules":[{"apiGroups":["apps"],"resources":["deployments/scale","deployments"],"verbs":["get","list","scale","patch"]}],"tolerations":[]}` | This restores moodle to the latest snapshot. Requires an existing s3 backup. ONLY USE FOR ROLLBACK |
| dbpMoodle.secrets | object | `{"etherpad_api_key":"","etherpad_postgresql_password":"","mariadb_password":"","mariadb_root_password":"","moodle_password":"","pgsql_admin_password":"","useChartSecret":true}` | Creates a secret with all relevant credentials for moodle -- Set useChartSecret: false to provide your own secret -- If you create your own secret, also set moodle.existingSecret (and moodle.externalDatabase.existingSecret if you bring your own DB) |
Expand Down Expand Up @@ -178,7 +179,7 @@ The Chart can be deployed without any modification but it is advised to set own
| etherpadlite.volumes[0].secret.items[0].path | string | `"APIKEY.txt"` | |
| etherpadlite.volumes[0].secret.secretName | string | `"moodle"` | |
| global.kubectl_version | string | `"1.28.7"` | |
| global.moodlePlugins | object | `{"adaptable":{"enabled":false},"booking":{"enabled":false},"boost_magnific":{"enabled":false},"boost_union":{"enabled":false},"certificate":{"enabled":false},"choicegroup":{"enabled":false},"coursecertificate":{"enabled":false},"dash":{"enabled":false},"etherpadlite":{"enabled":false},"geogebra":{"enabled":false},"groupselect":{"enabled":false},"heartbeat":{"enabled":false},"hvp":{"enabled":false},"jitsi":{"enabled":false},"kaltura":{"enabled":false},"oidc":{"enabled":false},"pdfannotator":{"enabled":false},"reengagement":{"enabled":false},"remuiformat":{"enabled":false},"saml2":{"enabled":false},"sharing_cart":{"enabled":false},"skype":{"enabled":false},"snap":{"enabled":false},"staticpage":{"enabled":false},"tiles":{"enabled":false},"topcoll":{"enabled":false},"unilabel":{"enabled":false},"xp":{"enabled":false},"zoom":{"enabled":false}}` | All plugins are disabled by default. if enabled, the plugin is installed on image startup |
| global.moodlePlugins | object | `{"adaptable":{"enabled":false},"booking":{"enabled":false},"boost_magnific":{"enabled":false},"boost_union":{"enabled":false},"certificate":{"enabled":false},"choicegroup":{"enabled":false},"coursecertificate":{"enabled":false},"dash":{"enabled":false},"etherpadlite":{"enabled":false},"flexsections":{"enabled":false},"geogebra":{"enabled":false},"groupselect":{"enabled":false},"heartbeat":{"enabled":false},"hvp":{"enabled":false},"jitsi":{"enabled":false},"kaltura":{"enabled":false},"multitopic":{"enabled":false},"oidc":{"enabled":false},"pdfannotator":{"enabled":false},"reengagement":{"enabled":false},"remuiformat":{"enabled":false},"saml2":{"enabled":false},"sharing_cart":{"enabled":false},"skype":{"enabled":false},"snap":{"enabled":false},"staticpage":{"enabled":false},"tiles":{"enabled":false},"topcoll":{"enabled":false},"unilabel":{"enabled":false},"xp":{"enabled":false},"zoom":{"enabled":false}}` | All plugins are disabled by default. if enabled, the plugin is installed on image startup |
| global.storageClass | string | `"nfs-client"` | Default storage class, should support ReadWriteMany |
| mariadb.auth.database | string | `"moodle"` | |
| mariadb.auth.existingSecret | string | `"moodle"` | |
Expand Down Expand Up @@ -239,6 +240,7 @@ The Chart can be deployed without any modification but it is advised to set own
| moodle.ingress.annotations."nginx.ingress.kubernetes.io/proxy-connect-timeout" | string | `"30s"` | |
| moodle.ingress.annotations."nginx.ingress.kubernetes.io/proxy-read-timeout" | string | `"20s"` | |
| moodle.ingress.enabled | bool | `true` | |
| moodle.ingress.extraHosts | list | `[]` | Any additional hostnames, needs to be "name: URL" value pairs |
| moodle.ingress.hostname | string | `"example.de"` | The hostname of the moodle application |
| moodle.ingress.tls | bool | `true` | |
| moodle.mariadb | object | `{"enabled":false}` | The mariadb included in bitnami/moodle chart. For this chart usage of mariadb.enabled with moodle.externalDatabase.type="mariadb" is recommended |
Expand Down Expand Up @@ -315,7 +317,7 @@ The Chart can be deployed without any modification but it is advised to set own
| redis.auth.existingSecret | string | `"moodle"` | |
| redis.auth.existingSecretPasswordKey | string | `"redis-password"` | |
| redis.auth.usePasswordFileFromSecret | bool | `true` | |
| redis.enabled | bool | `true` | |
| redis.enabled | bool | `false` | |
| redis.master.affinity | object | `{}` | |
| redis.master.resources | object | `{}` | |
| redis.master.tolerations | list | `[]` | |
Expand Down
20 changes: 11 additions & 9 deletions charts/dbp-moodle/scripts/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,29 @@

require_once(__DIR__ . '/lib/setup.php');

{{ if .Values.dbpMoodle.logging }}
define('MDL_PERF' , true);
define('MDL_PERFDB' , true);
define('MDL_PERFTOLOG' , true); //OK for production
{{ end }}

{{- if .Values.dbpMoodle.phpConfig.extendedLogging }}
define('MDL_PERF' , true);
define('MDL_PERFDB' , true);
define('MDL_PERFTOLOG' , true); //OK for production
{{- end }}

{{ if .Values.dbpMoodle.debug }}
{{ if .Values.dbpMoodle.phpConfig.debug -}}
@error_reporting(E_ALL | E_STRICT); // NOT FOR PRODUCTION SERVERS!
@ini_set('display_errors', '1'); // NOT FOR PRODUCTION SERVERS!
$CFG->debug = 32767; // === DEBUG_DEVELOPER - NOT FOR PRODUCTION SERVERS!
$CFG->debugdisplay = 1; // NOT FOR PRODUCTION SERVERS!
$CFG->debugpageinfo = 1;
$CFG->perfdebug = 7;
{{ else }}
{{- else -}}
$CFG->debug = 0;
$CFG->debugdisplay = 0;
$CFG->debugpageinfo = 0;
$CFG->perfdebug = 7;
$CFG->debugsqltrace = 0;
{{ end }}
{{- end }}

{{ with .Values.dbpMoodle.phpConfig.additional -}}
{{- . }}
{{- end }}
// There is no php closing tag in this file,
// it is intentional because it prevents trailing whitespace problems!
4 changes: 4 additions & 0 deletions charts/dbp-moodle/scripts/hook/moodle-update-preparation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@ set -o errexit
set -o nounset
set -o pipefail

health_file="/tmp/healthy"

get_current_deployment_image() {
kubectl get "deploy/{{ .Release.Name }}" -n "{{ .Release.Namespace }}" -o jsonpath='{..image}' |\
tr -s '[:space:]' '\n' |\
grep '{{- .Values.moodle.image.repository -}}'
}

touch "${health_file}"

printf "Checking if update preparations are needed\n"

new_image="{{- .Values.moodle.image.registry -}}/{{- .Values.moodle.image.repository -}}:{{- .Values.moodle.image.tag -}}"
Expand Down
3 changes: 2 additions & 1 deletion charts/dbp-moodle/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,6 @@ adaptable:theme_adaptable:theme/adaptable: {{- .Values.glob
boost_union:theme_boost_union:theme/boost_union: {{- .Values.global.moodlePlugins.boost_union.enabled }}{{"\n"}}
boost_magnific:theme_boost_magnific:theme/boost_magnific: {{- .Values.global.moodlePlugins.boost_magnific.enabled }}{{"\n"}}
snap:theme_snap:theme/snap: {{- .Values.global.moodlePlugins.snap.enabled }}{{"\n"}}

flexsections:format_flexsections:format/flexsections: {{- .Values.global.moodlePlugins.flexsections.enabled }}{{"\n"}}
multitopic:format_multitopic:format/multitopic: {{- .Values.global.moodlePlugins.multitopic.enabled }}{{"\n"}}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{ if not .Values.dbpMoodle.restore.enabled }}
{{ if and .Values.dbpMoodle.update_migration.enabled (not .Values.dbpMoodle.restore.enabled) }}
apiVersion: batch/v1
kind: Job
metadata:
Expand All @@ -24,6 +24,13 @@ spec:
- name: script-volume
mountPath: /moodle-update-preparation.sh
subPath: moodle-update-preparation.sh
livenessProbe:
exec:
command:
- cat
- /tmp/healthy
initialDelaySeconds: 10
periodSeconds: 10
affinity: {{ .Values.dbpMoodle.moodleUpdatePreparationJob.affinity | toYaml }}
tolerations: {{ .Values.dbpMoodle.moodleUpdatePreparationJob.tolerations | toYaml }}
serviceAccountName: "{{ .Release.Name }}-moodle-update-preparation-hook-serviceaccount"
Expand Down
2 changes: 1 addition & 1 deletion charts/dbp-moodle/templates/secrets/moodle-secret.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: "{{ .Release.Name }}"
name: "moodle"
namespace: "{{ .Release.Namespace }}"
stringData:
moodle-password: {{ include "dbpMoodle.secrets.moodle_password" . }}
Expand Down
20 changes: 15 additions & 5 deletions charts/dbp-moodle/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,29 @@ global:
enabled: false
snap:
enabled: false
flexsections:
enabled: false
multitopic:
enabled: false

dbpMoodle:
name: infra
stage: infra
# -- Extended php logging
logging: false
# -- Moodle debugging is not safe for production
debug: false

# -- The dbp update process to migrate moodle data when moodle versions are increased
update_migration:
enabled: false

# -- disallows all egress from the namespace for the moodle deployment
allowInternalNetworkingOnly: false

phpConfig:
# -- Extended php logging
extendedLogging: false
# -- Moodle debugging is not safe for production
debug: false
# -- Any additional text to be included into the config.php
additional: ""

# -- Configurations for the optional redis
redis:
Expand Down Expand Up @@ -271,6 +279,8 @@ moodle:
enabled: true
# -- The hostname of the moodle application
hostname: "example.de"
# -- Any additional hostnames, needs to be "name: URL" value pairs
extraHosts: []
tls: true
annotations:
cert-manager.io/cluster-issuer: sc-cert-manager-clusterissuer-letsencrypt
Expand Down Expand Up @@ -381,7 +391,7 @@ postgresql:

# redis helm chart values
redis:
enabled: true
enabled: false
architecture: "standalone"
auth:
enabled: true
Expand Down
4 changes: 3 additions & 1 deletion moodle/scripts/install/downloadPlugins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,6 @@ moosh plugin-download -v "$major_minor" mod_coursecertificate
moosh plugin-download -v "$major_minor" theme_adaptable
moosh plugin-download -v "$major_minor" theme_boost_union
moosh plugin-download -v "$major_minor" theme_boost_magnific
moosh plugin-download -v "$major_minor" theme_snap
moosh plugin-download -v "$major_minor" theme_snap
moosh plugin-download -v "$major_minor" theme_flexsections
moosh plugin-download -v "$major_minor" theme_multitopic
2 changes: 2 additions & 0 deletions moodle/scripts/test/test-plugin-install-uninstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ adaptable:theme_adaptable:theme/adaptable
boost_union:theme_boost_union:theme/boost_union
boost_magnific:theme_boost_magnific:theme/boost_magnific
snap:theme_snap:theme/snap
flexsections:format_flexsections:format/flexsections
multitopic:format_multitopic:format/multitopic
EOF
)

Expand Down

0 comments on commit e17db98

Please sign in to comment.