def Controller.start

bend-kube-runtime@0.2.0.0 · src/runtime.bend:614

import bend-kube-runtime@0.2.0.0/src/runtime.bend as Runtime
import Base
import bend-kube-runtime@0.2.0.0/src/json.bend as J
import bend-kube-runtime@0.2.0.0/src/core.bend as C
import bend-kube-runtime@0.2.0.0/src/config.bend as K
import bend-kube-runtime@0.2.0.0/src/queue.bend as Q

614# Runs a controller (kube-runtime's Controller::new(..).owns(..).run(..)):
615# primary is watched (only objects matching the label selector, "" for
616# all) and reconciled, each of owned is watched and mapped to
617# its owners of primary's kind; at most max reconciles run at once. rec
618# answers what to do next for the object, as kube-runtime's Action. chan
619# is the controller's inbox (Controller.inbox); status receives a snapshot
620# after every step (Keeper.start).
621def Controller.start(~rec: J.Json -> K.Config -> IO(Q.Action), +cfg: K.Config, +primary: C.Api,
622  label: String, owned: List<&2, C.Api>, +max: U32, +chan: Chan(Msg), +status: Chan(SMsg)) ->
623  IO(Unit):
624  do IO<Unit>:
625    Ctl.watch(cfg, primary, label, 0, chan)
626    Ctl.watch_all(owned, 1, cfg, chan)
627    Ctl.loop(~(i => o => c => rec(o, c)), cfg, primary, max, chan, status, 0)

Uses (16)

Used by (1)