-
Feature Request
-
Resolution: Unresolved
-
Normal
-
None
-
None
-
False
-
None
-
False
-
Not Selected
Proposed title of this feature request
Lifecycle hook inside containers
What is the nature and description of the request?
# Container specific changes
spec:
containers:
# lifecycle hook that will wait for up to 24h for connections to drain. The configuration that is fronted by an F5 also includes postStart blocks to add itself to add/enable itself as a pool member and the preStop hook will include a script to disable itself
lifecycle:
preStop:
exec:
command:
- bash
- -c
- |-
WAIT_FOR_EXISTING_CONNECTIONS_DEADLINE=$[ $SECONDS + 60 * 60 * 24 ] #wait up to 24 hours for connections to go away
while [[ $SECONDS -lt $WAIT_FOR_EXISTING_CONNECTIONS_DEADLINE && $(echo 'show info' | socat - UNIX-CONNECT:/var/lib/haproxy/run/haproxy.sock | grep -Po '(?<=CurrConns: ).+' ) -gt 0 ]];
do sleep 60s;
done
# It's possible for the HAProxy pods to be killed due to failing healhchecks if the pod runs out of MAX_CONN since the default /healthz check opens a new connection to verify health and will fail to return in time
# This is not ideal, but we'd rather have current connections stay alive and queue any new connections rather than fail a healthcheck and kill the pod and all connections
livenessProbe:
failureThreshold: 3
exec:
command:
- /bin/sh
- -c
- echo show info | socat - UNIX-CONNECT:/var/lib/haproxy/run/haproxy.sock | grep -q "^Name:\s*HAProxy"
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
readinessProbe:
failureThreshold: 3
exec:
command:
- /bin/sh
- -c
- echo show info | socat - UNIX-CONNECT:/var/lib/haproxy/run/haproxy.sock | grep -q "^Name:\s*HAProxy"
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
# termination Grace Period must be higher than the preStop timeout
terminationGracePeriodSeconds: 86460
Why does the customer need this? (List the business requirements here)
Customer used to have 3.x days lifecycle hooks specific to haproxy timeout.
Customer has VOIP workload served out of OpenShift and has requirement to keep the haproxy connections to stay 24 hours before draining them.
List any affected packages or components.
HAProxy
- account is impacted by
-
RFE-3047 HAProxy volumeMounts support to run custom scripts
- Backlog