@@ -31,6 +31,7 @@ import (
3131 "github.com/ironcore-dev/boot-operator/internal/registry"
3232 apimeta "k8s.io/apimachinery/pkg/api/meta"
3333 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
34+ "k8s.io/client-go/util/retry"
3435 "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
3536
3637 "github.com/go-logr/logr"
@@ -172,33 +173,35 @@ func (r *ServerBootConfigurationPXEReconciler) reconcile(ctx context.Context, lo
172173
173174func (r * ServerBootConfigurationPXEReconciler ) patchIPXEBootReadyConditionFromIPXEState (ctx context.Context , config * v1alpha1.IPXEBootConfig , bootConfig * metalv1alpha1.ServerBootConfiguration ) error {
174175 key := types.NamespacedName {Name : bootConfig .Name , Namespace : bootConfig .Namespace }
175- var cur metalv1alpha1.ServerBootConfiguration
176- if err := r .Get (ctx , key , & cur ); err != nil {
177- return err
178- }
179- base := cur .DeepCopy ()
176+ return retry .RetryOnConflict (retry .DefaultRetry , func () error {
177+ var cur metalv1alpha1.ServerBootConfiguration
178+ if err := r .Get (ctx , key , & cur ); err != nil {
179+ return err
180+ }
181+ base := cur .DeepCopy ()
180182
181- cond := metav1.Condition {
182- Type : IPXEBootReadyConditionType ,
183- ObservedGeneration : cur .Generation ,
184- }
185- switch config .Status .State {
186- case v1alpha1 .IPXEBootConfigStateReady :
187- cond .Status = metav1 .ConditionTrue
188- cond .Reason = "BootConfigReady"
189- cond .Message = "IPXE boot configuration is ready."
190- case v1alpha1 .IPXEBootConfigStateError :
191- cond .Status = metav1 .ConditionFalse
192- cond .Reason = "BootConfigError"
193- cond .Message = "IPXEBootConfig reported an error."
194- default :
195- cond .Status = metav1 .ConditionUnknown
196- cond .Reason = "BootConfigPending"
197- cond .Message = "Waiting for IPXEBootConfig to become Ready."
198- }
183+ cond := metav1.Condition {
184+ Type : IPXEBootReadyConditionType ,
185+ ObservedGeneration : cur .Generation ,
186+ }
187+ switch config .Status .State {
188+ case v1alpha1 .IPXEBootConfigStateReady :
189+ cond .Status = metav1 .ConditionTrue
190+ cond .Reason = "BootConfigReady"
191+ cond .Message = "IPXE boot configuration is ready."
192+ case v1alpha1 .IPXEBootConfigStateError :
193+ cond .Status = metav1 .ConditionFalse
194+ cond .Reason = "BootConfigError"
195+ cond .Message = "IPXEBootConfig reported an error."
196+ default :
197+ cond .Status = metav1 .ConditionUnknown
198+ cond .Reason = "BootConfigPending"
199+ cond .Message = "Waiting for IPXEBootConfig to become Ready."
200+ }
199201
200- apimeta .SetStatusCondition (& cur .Status .Conditions , cond )
201- return r .Status ().Patch (ctx , & cur , client .MergeFrom (base ))
202+ apimeta .SetStatusCondition (& cur .Status .Conditions , cond )
203+ return r .Status ().Patch (ctx , & cur , client .MergeFrom (base ))
204+ })
202205}
203206
204207func (r * ServerBootConfigurationPXEReconciler ) getSystemUUIDFromBootConfig (ctx context.Context , config * metalv1alpha1.ServerBootConfiguration ) (string , error ) {
0 commit comments