Skip to content

Commit

Permalink
seperate php.ini into own configmap, allow config.php to be replaced …
Browse files Browse the repository at this point in the history
…with existing by chart values
  • Loading branch information
JannikBadenhop committed Nov 13, 2024
1 parent 8e8d3a6 commit b75d9a4
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: moodle-php-ini
namespace: {{ .Release.Namespace }}
data:
php.ini: |
{{- .Files.Get "scripts/php.ini" | nindent 4 }}
7 changes: 4 additions & 3 deletions charts/dbp-moodle/templates/secrets/moodle-config-secret.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{{ if not .Values.dbpMoodle.existingConfig -}}
apiVersion: v1
kind: Secret
type: Opaque
metadata:
name: moodle-config
name: moodle-php-config
namespace: {{ .Release.Namespace }}
data:
php.ini: {{ .Files.Get "scripts/php.ini" | b64enc }}
config.php: {{ tpl (.Files.Get "scripts/config.php") . | b64enc }}
config.php: {{ tpl (.Files.Get "scripts/config.php") . | b64enc }}
{{- end -}}
27 changes: 19 additions & 8 deletions charts/dbp-moodle/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ dbpMoodle:
debug: false
# -- Any additional text to be included into the config.php
additional: ""
# -- Provide an existing secret containing the config.php instead of generating it from chart
# -- Remember to adjust moodle.extraVolumes & moodle.extraVolumeMounts when setting this.
existingConfig: ""

# -- Configurations for the optional redis
redis:
Expand Down Expand Up @@ -300,20 +303,28 @@ moodle:
cpu: 200m
memory: 256Mi
extraVolumeMounts:
- name: moodle-config
- name: moodle-php-ini
readOnly: true
mountPath: /moodleconfig
mountPath: /moodleconfig/php-ini
- name: moodle-php-config
readOnly: true
mountPath: /moodleconfig/config-php
extraVolumes:
- name: moodle-config
# -- The php.ini which installs the php-redis extension to enable the use for redis
- name: moodle-php-ini
configMap:
name: moodle-php-ini
items:
- key: php.ini
path: php.ini
defaultMode: 0644
# -- The custom config.php file that is used to configure moodle to use the database and redis (if activated)
- name: moodle-php-config
secret:
secretName: moodle-config
secretName: moodle-php-config
items:
# -- The custom config.php file that is used to configure moodle to use the database and redis (if activated)
- key: config.php
path: config.php
# -- The php.ini which installs the php-redis extension to enable the use for redis
- key: php.ini
path: php.ini
defaultMode: 0644
podAnnotations:
moodle/image: '{{- .Values.image.repository -}}:{{- .Values.image.tag -}}'
Expand Down
4 changes: 2 additions & 2 deletions moodle/scripts/init/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ MODULE=dbp info "Start Bitnami setup script after checking for proper version"
upgrade_if_pending

MODULE=dbp info "Replacing config files with ours"
/bin/cp -p /moodleconfig/config.php /bitnami/moodle/config.php
/bin/cp /moodleconfig/php.ini /opt/bitnami/php/etc/conf.d/php.ini
/bin/cp -p /moodleconfig/config-php/config.php /bitnami/moodle/config.php
/bin/cp /moodleconfig/php-ini/php.ini /opt/bitnami/php/etc/conf.d/php.ini

if [ -f "/tmp/de.zip" ] && [ ! -d /bitnami/moodledata/lang/de ]; then \
MODULE=dbp info "Installing german language pack"
Expand Down

0 comments on commit b75d9a4

Please sign in to comment.