openstack-helm/neutron/templates/bin/_neutron-netns-cleanup-cron.py.tpl
Hemachandra Reddy 62db99d1d1 Add network namespace cleanup
Removes stale DHCP and L3 namespaces. The cron runs once in 12 hours.

Network namespace cleanup is implemented as a daemonset as Kubernetes
does not have a cronjob that works like daemonset-cronjob.
Network namespace cleanup should run on all nodes where DHCP and L3
agents run.

Change-Id: I7525e493067669026e0d57889a3e3238a2bd1308
2020-02-11 05:01:36 +00:00

25 lines
575 B
Smarty

#!/usr/bin/env python
import sys
import time
from oslo_config import cfg
from neutron.cmd.netns_cleanup import main
if __name__ == "__main__":
while True:
try:
main()
# Sleep for 12 hours
time.sleep(43200)
except Exception as ex:
sys.stderr.write(
"Cleaning network namespaces caught an exception %s"
% str(ex))
except:
sys.stderr.write(
"Cleaning network namespaces caught an exception")
finally:
cfg.CONF.clear()