signal-sidecar-script

This commit is contained in:
miwr 2025-04-02 13:32:15 +02:00
parent 1a85de6cda
commit c754dc80bc
2 changed files with 31 additions and 16 deletions

View file

@ -0,0 +1,15 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: signal-sidecar-script
namespace: openbao
data:
sidecar.sh: |
#!/bin/sh
echo "Starting sidecar listener on port 8080..."
while true; do
# Listen for an HTTP request (basic netcat-based server)
echo -e "HTTP/1.1 200 OK\n\nSIGHUP sent to OpenBAO" | nc -l -p 8080 -q 1
# Send SIGHUP signal
kill -SIGHUP $(pidof bao) || echo "OpenBAO process not found"
done

View file

@ -23,22 +23,18 @@ server:
mountPath: /etc/passwd
subPath: passwd
- name: logrotate2
image: imroc/logrotate:latest
imagePullPolicy: IfNotPresent
env:
- name: LOGROTATE_FILE_PATTERN
value: "/openbao/logs/openbao/*.log"
- name: LOGROTATE_FILESIZE
value: "1M"
- name: LOGROTATE_FILENUM
value: "10"
- name: CRON_EXPR
value: "*/1 * * * *"
- name: CROND_LOGLEVEL
value: "7"
image: apline:latest
command: ["/bin/sh", "-c", "chmod +x /app/sidecar.sh && /app/sidecar.sh"]
securityContext:
runAsUser: 100
ports:
- containerPort: 8080
volumeMounts:
- name: host-log-storage
mountPath: /openbao/logs
- name: passwd-volume
mountPath: /etc/passwd
subPath: passwd
- name: sidecar-script
mountPath: /app
volumes:
- name: logrotate-config-volume
configMap:
@ -52,6 +48,10 @@ server:
hostPath:
path: /var/log
type: Directory
- name: sidecar-script
configMap:
name: signal-sidecar-script
defaultMode: 0755
volumeMounts:
- mountPath: /openbao/logs