mirror of
https://github.com/truenas/charts.git
synced 2026-02-12 06:46:32 +08:00
add preStop hook to cleanup routes
This commit is contained in:
@@ -87,6 +87,20 @@ spec:
|
||||
initialDelaySeconds: 5
|
||||
failureThreshold: 40
|
||||
periodSeconds: 15
|
||||
lifecycle:
|
||||
preStop:
|
||||
exec:
|
||||
command:
|
||||
- /bin/bash
|
||||
- -c
|
||||
- |
|
||||
echo "Deleting routes created by the app..."
|
||||
netmask=$(ip route | grep {{ $ip }})
|
||||
netmask=$(echo $netmask | grep -o -E '/.\d*')
|
||||
netmask=${netmask#/}
|
||||
echo "Matched routes to delete... {{ $ip }}/$netmask"
|
||||
ip route del {{ $ip }}/$netmask || echo "Route deletion failed..."
|
||||
echo "Routes deleted..."
|
||||
{{ include "common.networking.dnsConfiguration" .Values | nindent 6 }}
|
||||
volumes: {{ include "common.storage.configureAppVolumes" .Values | nindent 8 }}
|
||||
{{ range $index, $hostPathConfiguration := .Values.extraAppVolumeMounts }}
|
||||
|
||||
Reference in New Issue
Block a user