coreos / container-linux-update-operator

A Kubernetes operator to manage updates of Container Linux by CoreOS
Apache License 2.0
209 stars 49 forks source link

Use controller pattern for update-agent #111

Closed dghubble closed 7 years ago

dghubble commented 7 years ago

Pass in a top-level stop channel to the agent operator to use when it launches goroutines or calls time.Sleep. In theory, if we trapped on signals in cmd, we'd see every goroutine stop and a clean "Stopping agent" log line.

A general controller:

New(config Config) (*Kontroller)

func (k *Kontroller) Run(stop <-chan struct{}) {
  // starting
  wait.Until(processLoop, period, stop)
  // stopping
}

func (k.Kontroller) process() {
  // reconciliation logic
}

Similar to #108

dghubble commented 7 years ago

Lemme add @euank's suggestion. Its non-essential as noted in the Twitter repo, but slightly nicer.