diff --git a/test/wg-easy/1.0.0/templates/deployment.yaml b/test/wg-easy/1.0.0/templates/deployment.yaml index 4359ff2b65..1af55d2699 100644 --- a/test/wg-easy/1.0.0/templates/deployment.yaml +++ b/test/wg-easy/1.0.0/templates/deployment.yaml @@ -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 }}