diff --git a/horizon/README.md b/horizon/README.md index 6069574..45c3591 100644 --- a/horizon/README.md +++ b/horizon/README.md @@ -64,11 +64,11 @@ For information on requirements, installation, manual configuration, and trouble | core.configuration.storage.mibs | string | `nil` | | | core.configuration.storage.rrd | string | `"1000Gi"` | | | core.configuration.tolerations | string | `nil` | | -| core.etcOverlayConfigMaps | list | `[]` | | | core.image.pullPolicy | string | `"IfNotPresent"` | | | core.image.repository | string | `"opennms/horizon"` | | | core.image.tag | string | `""` | | | core.inspector.enabled | bool | `false` | | +| core.overlayConfigMaps | list | `[]` | | | core.postConfigJob.ttlSecondsAfterFinished | int | `300` | | | core.resources.limits.cpu | string | `"2"` | | | core.resources.limits.memory | string | `"8Gi"` | | diff --git a/horizon/scripts/onms-core-init.sh b/horizon/scripts/onms-core-init.sh index 63a3da3..e144cf8 100644 --- a/horizon/scripts/onms-core-init.sh +++ b/horizon/scripts/onms-core-init.sh @@ -138,7 +138,7 @@ DEPLOY_DIR="/opennms-deploy" # Mounted Externally CONFIG_DIR_OVERLAY=${OVERLAY_DIR}/etc -ETC_CONFIG_MAPS="/opennms-etc-overlay-configmaps" # Mounted externally +OVERLAY_CONFIG_MAPS="/opennms-overlay-configmaps" # Mounted externally KARAF_FILES=( \ "config.properties" \ @@ -604,22 +604,22 @@ else exit 1 fi -if [ -d ${ETC_CONFIG_MAPS} ]; then - echo "Processing etc overlay config maps because /opennms-etc-overlay-configmaps exists ..." +if [ -d ${OVERLAY_CONFIG_MAPS} ]; then + echo "Processing overlay config maps ..." # We need to make sure the directories are numerically sorted to match the configured configmap order. - for dir in $(ls -1d ${ETC_CONFIG_MAPS}/* | sort -n); do + for dir in $(ls -1d ${OVERLAY_CONFIG_MAPS}/* | sort -n); do # When we first copy off of the configmap volume, we copy symlinks as files and ignore Kubernetes configmap volume ".." files. # See: https://github.com/spring-projects/spring-boot/issues/23232 - if [ -f $dir/.uncompress ]; then - echo " Copying etc files from $dir to ${CONFIG_DIR}/ (and uncompressing .gz files) ..." + if [[ $(basename $dir) =~ .*-uncompress ]]; then + echo " Copying files from $dir to ${OVERLAY_DIR}/ (and uncompressing .gz files) ..." mkdir /tmp/uncompress rsync -arO -L --exclude='..*' --no-perms --no-owner --no-group $dir/ /tmp/uncompress # don't bother outputting files copied yet find /tmp/uncompress -name '*.gz' | xargs gzip -d -v 2>&1 | sed 's/^/ /' - rsync -arO --exclude=.uncompress --no-perms --no-owner --no-group --out-format="%n %C" /tmp/uncompress/ ${CONFIG_DIR}/ | sed 's/^/ /' + rsync -arO --no-perms --no-owner --no-group --out-format="%n %C" /tmp/uncompress/ ${OVERLAY_DIR}/ | sed 's/^/ /' rm -rf /tmp/uncompress else - echo " Copying etc files from $dir to ${CONFIG_DIR}/ ..." - rsync -arO -L --exclude='..*' --no-perms --no-owner --no-group --out-format="%n %C" $dir/ ${CONFIG_DIR}/ | sed 's/^/ /' + echo " Copying files from $dir to ${OVERLAY_DIR}/ ..." + rsync -arO -L --exclude='..*' --no-perms --no-owner --no-group --out-format="%n %C" $dir/ ${OVERLAY_DIR}/ | sed 's/^/ /' fi done fi diff --git a/horizon/templates/opennms-core.statefulset.yaml b/horizon/templates/opennms-core.statefulset.yaml index 836184d..3f17aa6 100644 --- a/horizon/templates/opennms-core.statefulset.yaml +++ b/horizon/templates/opennms-core.statefulset.yaml @@ -127,9 +127,9 @@ spec: mountPath: /opt/opennms-overlay # Required by the script - OVERLAY_DIR - name: scripts mountPath: /scripts # Required by the script - {{- range $i, $configMap := .Values.core.etcOverlayConfigMaps }} - - name: etc-overlay-configmap-{{ $i }} - mountPath: /opennms-etc-overlay-configmaps/{{ $i }} + {{- range $k, $r := .Values.core.overlayConfigMaps }} + - name: overlay-configmap-{{ $k }} + mountPath: /opennms-overlay-configmaps/{{ $k }}{{- if $r.uncompress }}-uncompress{{ end }}/{{ $r.path | default "etc" }} {{- end }} nodeSelector: {{- toYaml .Values.core.configuration.nodeSelector | nindent 8 }} @@ -292,8 +292,8 @@ spec: claimName: onms-mibs-pvc readOnly: false {{- end }} - {{- range $i, $configMap := .Values.core.etcOverlayConfigMaps }} - - name: etc-overlay-configmap-{{ $i }} + {{- range $k, $r := .Values.core.overlayConfigMaps }} + - name: overlay-configmap-{{ $k }} configMap: - name: {{ $configMap | quote }} + name: {{ $r.name | quote }} {{- end }} diff --git a/horizon/values.yaml b/horizon/values.yaml index a1550ea..9c39260 100644 --- a/horizon/values.yaml +++ b/horizon/values.yaml @@ -108,7 +108,7 @@ ingress: core: inspector: enabled: false - etcOverlayConfigMaps: [] + overlayConfigMaps: [] terminationGracePeriodSeconds: 120 image: repository: opennms/horizon