From e003915db39056061e4016c87a915bb3bba677eb Mon Sep 17 00:00:00 2001 From: Tom Wieczorek Date: Fri, 5 Jan 2024 12:26:02 +0100 Subject: [PATCH] Use reflect.DeepEqual for CoreDNS config comparison Since k0s uses a PDB for CoreDNS, the simple double equals equality check wasn't appropriate to check if the CoreDNS configuration has changed. The struct now contains a pointer which is always different for newly constructed structs. This caused a useless manifest regeneration every ten seconds. Fixes: c802ffd86 ("Add a PodDisruptionBudget for CoreDNS") Signed-off-by: Tom Wieczorek --- pkg/component/controller/coredns.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pkg/component/controller/coredns.go b/pkg/component/controller/coredns.go index c900123ad0a5..abed2121b3d4 100644 --- a/pkg/component/controller/coredns.go +++ b/pkg/component/controller/coredns.go @@ -22,6 +22,7 @@ import ( "math" "path" "path/filepath" + "reflect" "time" "github.com/k0sproject/k0s/pkg/component/manager" @@ -429,7 +430,7 @@ func (c *CoreDNS) Reconcile(ctx context.Context, clusterConfig *v1beta1.ClusterC if err != nil { return fmt.Errorf("error calculating coredns configs: %v. will retry", err) } - if cfg == c.previousConfig { + if reflect.DeepEqual(c.previousConfig, cfg) { c.log.Infof("current cfg matches existing, not gonna do anything") return nil }