feat: power-cycle

This commit is contained in:
Harivansh Rathi 2026-04-11 18:54:16 +00:00
parent 0e5e989192
commit d0f0530ca2
7 changed files with 242 additions and 18 deletions

16
main.go
View file

@ -10,6 +10,7 @@ import (
"os/signal"
"path/filepath"
"syscall"
"time"
"golang.org/x/sync/errgroup"
@ -100,6 +101,21 @@ func main() {
}
return nil
})
group.Go(func() error {
ticker := time.NewTicker(cfg.ReconcileInterval)
defer ticker.Stop()
for {
select {
case <-groupCtx.Done():
return nil
case <-ticker.C:
if err := hostDaemon.Reconcile(groupCtx); err != nil && groupCtx.Err() == nil {
fmt.Fprintf(os.Stderr, "warning: firecracker-host reconcile failed: %v\n", err)
}
}
}
})
if err := group.Wait(); err != nil {
exit(err)