Adding the feature to launch Prometheus process with custom script

This change adds feature to launch Prometheus process using a custom script which should be stored in override values. Because the known issue https://github.com/prometheus/prometheus/issues/6934 is still open many years, we are going to struggle with growing WAL files using our custom downstream wrapper script which stops Prometheus process and deletes WALs.
This solution can not fit all customers because completely kills wal cached data but it is ok for our purposes. Such way I just added the feature to use another custom script to launch Prometheus and left original functionality by default. Default/custom mode are defined in 'values.yaml' as the body of the custom launcher script.

Change-Id: Ie02ea1d6a7de5c676e2e96f3dcd6aca172af4afb
This commit is contained in:
Terekhin, Alexey (at4945) 2022-12-29 11:51:31 -08:00
parent 0aad6d05f0
commit aa3efe9715
4 changed files with 30 additions and 10 deletions

View File

@ -15,7 +15,7 @@ apiVersion: v1
appVersion: v2.25.0
description: OpenStack-Helm Prometheus
name: prometheus
version: 0.1.13
version: 0.1.14
home: https://prometheus.io/
sources:
- https://github.com/prometheus/prometheus

View File

@ -15,15 +15,23 @@ limitations under the License.
*/}}
set -ex
COMMAND="${@:-start}"
function start () {
{{ $flags := include "prometheus.utils.command_line_flags" .Values.conf.prometheus.command_line_flags }}
exec /bin/prometheus --config.file=/etc/config/prometheus.yml {{ $flags }}
}
# Two ways how to launch init process in container: by default and custom (defined in override values).
{{ $deflaunch := .Values.proc_launch.prometheus.default }}
if [ "{{ $deflaunch }}" = true ]
then
COMMAND="${@:-start}"
function stop () {
kill -TERM 1
}
function start () {
{{ $flags := include "prometheus.utils.command_line_flags" .Values.conf.prometheus.command_line_flags }}
exec /bin/prometheus --config.file=/etc/config/prometheus.yml {{ $flags }}
}
$COMMAND
function stop () {
kill -TERM 1
}
$COMMAND
else
{{ tpl (.Values.proc_launch.prometheus.custom_launch) . }}
fi

View File

@ -271,6 +271,17 @@ network_policy:
egress:
- {}
proc_launch:
prometheus:
default: true
custom_launch: |
while true
do
echo "If 'proc_launch.prometheus.default: false'."
echo "Your custom shell script code you can put here."
sleep 10
done
secrets:
oci_image_registry:
prometheus: prometheus-oci-image-registry-key

View File

@ -14,4 +14,5 @@ prometheus:
- 0.1.11 Update htk requirements
- 0.1.12 Update default image value to Wallaby
- 0.1.13 Added OCI registry authentication
- 0.1.14 Added feature to launch Prometheus with custom script
...