Skip to content

Commit

Permalink
fix readiness for kindnet controller
Browse files Browse the repository at this point in the history
  • Loading branch information
aojea committed Jun 10, 2024
1 parent d4bdb17 commit 7212689
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions cmd/kindnet-controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,8 @@ func main() {
func() error { return createOrUpdateDaemonset(ctx, clientset, ds) })
if err != nil {
klog.Infof("error trying to update daemonset: %v", err)
ready.Store(false)
return
}
ready.Store(true)
},
UpdateFunc: func(old, new interface{}) {
oldCfg := old.(*v1alpha1.Configuration)
Expand All @@ -234,10 +232,8 @@ func main() {
func() error { return createOrUpdateDaemonset(ctx, clientset, ds) })
if err != nil {
klog.Infof("error trying to update daemonset: %v", err)
ready.Store(false)
return
}
ready.Store(true)
},
DeleteFunc: func(obj interface{}) {
err := clientset.AppsV1().DaemonSets("kube-system").Delete(ctx, dsKindnetd, metav1.DeleteOptions{})
Expand All @@ -252,13 +248,14 @@ func main() {
if ok := cache.WaitForCacheSync(ctx.Done(), configInfomer.Informer().HasSynced); !ok {
klog.Fatalf("caches not synced waiting for Kindnet Configuration")
}
klog.Infof("kindnet-controller correctly started")
ready.Store(true)

err = waitForDaemonset(ctx, clientset)
if err != nil {
panic(err.Error())
}
ready.Store(true)
klog.Infof("kindnetd correctly started")
klog.Infof("kindnetd daemonset correctly started")

select {
case <-signalCh:
Expand Down

0 comments on commit 7212689

Please sign in to comment.