func()

in cmd/node-cache/app/cache_app.go [236:261]


func (c *CacheApp) runPeriodic() {
	// if a pidfile is defined in flags, setup iptables as soon as it's created
	if c.params.Pidfile != "" {
		for {
			if isFileExists(c.params.Pidfile) {
				break
			}
			clog.Infof("waiting for coredns pidfile '%s'", c.params.Pidfile)
			time.Sleep(time.Second * 1)
		}
		// we found the pidfile, coreDNS is running, we can setup networking early
		c.setupNetworking()
	}

	c.exitChan = make(chan struct{}, 1)
	tick := time.NewTicker(c.params.Interval * time.Second)
	for {
		select {
		case <-tick.C:
			c.setupNetworking()
		case <-c.exitChan:
			clog.Warningf("Exiting iptables/interface check goroutine")
			return
		}
	}
}