Update ceph-osd to be able to use tini

Sometimes the pod fails to terminate correctly,
leaving zombie processes. Add option to use tini
to handle processes correctly. Additionally update
log-tail script to handle sigterm and sigint.

Change-Id: I96af2f3bef5f6c48858f1248ba85abdf7740279c
This commit is contained in:
SPEARS, DUSTIN (ds443n) 2024-11-05 16:16:48 -05:00
parent f706586123
commit 09f1ccc64c
5 changed files with 28 additions and 8 deletions

View File

@ -15,6 +15,6 @@ apiVersion: v1
appVersion: v1.0.0
description: OpenStack-Helm Ceph OSD
name: ceph-osd
version: 0.1.52
version: 0.1.53
home: https://github.com/ceph/ceph
...

View File

@ -18,14 +18,20 @@ wait_for_file "${osd_id_file}" "${WAIT_FOR_OSD_ID_TIMEOUT}"
log_file="/var/log/ceph/${DAEMON_NAME}.$(cat "${osd_id_file}").log"
wait_for_file "${log_file}" "${WAIT_FOR_OSD_ID_TIMEOUT}"
trap "exit" SIGTERM SIGINT
keep_running=true
function tail_file () {
while true; do
tail --retry -f "${log_file}"
while $keep_running; do
tail --retry -f "${log_file}" &
tail_pid=$!
wait $tail_pid
sleep 1
done
}
function truncate_log () {
while true; do
while $keep_running; do
sleep ${TRUNCATE_PERIOD}
if [[ -f ${log_file} ]] ; then
truncate -s "${TRUNCATE_SIZE}" "${log_file}"
@ -37,3 +43,5 @@ tail_file &
truncate_log &
wait -n
keep_running=false
wait

View File

@ -315,8 +315,11 @@ spec:
value: {{ .Values.logging.truncate.period | quote }}
- name: WAIT_FOR_OSD_ID_TIMEOUT
value: {{ .Values.logging.osd_id.timeout | quote }}
command:
- /tmp/log-tail.sh
{{- if .Values.conf.tini.log_runner.enabled }}
command: ["/usr/local/bin/tini", "--", "/tmp/log-tail.sh"]
{{- else }}
command: ["/tmp/log-tail.sh"]
{{- end }}
volumeMounts:
- name: pod-tmp
mountPath: /tmp
@ -357,8 +360,11 @@ spec:
value: {{ tuple "ceph_mon" "internal" "mon" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" | quote }}
- name: MON_PORT_V2
value: {{ tuple "ceph_mon" "internal" "mon_msgr2" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" | quote }}
command:
- /tmp/osd-start.sh
{{- if .Values.conf.tini.ceph_osd_default.enabled }}
command: ["/usr/local/bin/tini", "--", "/tmp/osd-start.sh"]
{{- else }}
command: ["/tmp/osd-start.sh"]
{{- end }}
lifecycle:
preStop:
exec:

View File

@ -179,6 +179,11 @@ jobs:
startingDeadlineSecs: 60
conf:
tini:
log_runner:
enabled: false
ceph_osd_default:
enabled: false
ceph:
global:
# auth

View File

@ -53,4 +53,5 @@ ceph-osd:
- 0.1.50 Allow lvcreate to wipe existing LV metadata
- 0.1.51 Update Ceph images to patched 18.2.2 and restore debian-reef repo
- 0.1.52 Use quay.io/airshipit/kubernetes-entrypoint:latest-ubuntu_focal by default
- 0.1.53 Update ceph-daemon to be able to use tini init system
...