From 7fd2c7663a21178aaeb4d510bf711ead3a35d4b3 Mon Sep 17 00:00:00 2001 From: daimaxiaxie Date: Sat, 3 Aug 2024 18:43:01 +0800 Subject: [PATCH] replace daemonset in kruise daemonset controller --- pkg/controllers/state/cluster.go | 5 +++++ pkg/controllers/state/informer/kruisedaemonset.go | 8 +++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/pkg/controllers/state/cluster.go b/pkg/controllers/state/cluster.go index e2fd03381a..6f842e0e95 100644 --- a/pkg/controllers/state/cluster.go +++ b/pkg/controllers/state/cluster.go @@ -19,6 +19,7 @@ package state import ( "context" "fmt" + kruise "github.com/openkruise/kruise/apis/apps/v1alpha1" "sort" "sync" "time" @@ -376,6 +377,10 @@ func (c *Cluster) UpdateDaemonSet(ctx context.Context, daemonset *appsv1.DaemonS return nil } +func (c *Cluster) UpdateKruiseDaemonSet(ctx context.Context, daemonset *kruise.DaemonSet) error { + return nil +} + func (c *Cluster) DeleteDaemonSet(key types.NamespacedName) { c.daemonSetPods.Delete(key) } diff --git a/pkg/controllers/state/informer/kruisedaemonset.go b/pkg/controllers/state/informer/kruisedaemonset.go index 927bf7430a..e7ae3bac7f 100644 --- a/pkg/controllers/state/informer/kruisedaemonset.go +++ b/pkg/controllers/state/informer/kruisedaemonset.go @@ -21,7 +21,6 @@ import ( "time" kruise "github.com/openkruise/kruise/apis/apps/v1alpha1" - appsv1 "k8s.io/api/apps/v1" "k8s.io/apimachinery/pkg/api/errors" controllerruntime "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" @@ -47,10 +46,9 @@ func NewKruiseDaemonSetController(kubeClient client.Client, cluster *state.Clust } func (c *KruiseDaemonSetController) Reconcile(ctx context.Context, req reconcile.Request) (reconcile.Result, error) { - ctx = injection.WithControllerName(ctx, "state.daemonset") + ctx = injection.WithControllerName(ctx, "state.kruise-daemonset") - // TODO replace - daemonSet := appsv1.DaemonSet{} + daemonSet := kruise.DaemonSet{} if err := c.kubeClient.Get(ctx, req.NamespacedName, &daemonSet); err != nil { if errors.IsNotFound(err) { // notify cluster state of the daemonset deletion @@ -58,7 +56,7 @@ func (c *KruiseDaemonSetController) Reconcile(ctx context.Context, req reconcile } return reconcile.Result{}, client.IgnoreNotFound(err) } - if err := c.cluster.UpdateDaemonSet(ctx, &daemonSet); err != nil { + if err := c.cluster.UpdateKruiseDaemonSet(ctx, &daemonSet); err != nil { return reconcile.Result{}, err } return reconcile.Result{RequeueAfter: time.Minute}, nil