From 7d6db14bcbf4c4ea26fe5944833acab47b3196a3 Mon Sep 17 00:00:00 2001 From: aaronfern Date: Mon, 17 Feb 2025 19:43:08 +0530 Subject: [PATCH] Add a nil check before trying to adding mc annotation --- pkg/controller/deployment.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/controller/deployment.go b/pkg/controller/deployment.go index ba4dd8d0b..862723d02 100644 --- a/pkg/controller/deployment.go +++ b/pkg/controller/deployment.go @@ -636,6 +636,9 @@ func (dc *controller) setMachinePriorityAnnotationAndUpdateTriggeredForDeletion( continue } mcAdjust := mc.DeepCopy() + if mcAdjust.Annotations == nil { + mcAdjust.Annotations = make(map[string]string) + } mcAdjust.Annotations[machineutils.MachinePriority] = "1" _, err = dc.controlMachineClient.Machines(mcAdjust.Namespace).Update(ctx, mcAdjust, metav1.UpdateOptions{}) if err != nil {