@@ -32,6 +32,7 @@ import (
3232 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3333 utilerrors "k8s.io/apimachinery/pkg/util/errors"
3434 "k8s.io/client-go/tools/record"
35+ "k8s.io/client-go/util/retry"
3536 clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
3637 kutil "sigs.k8s.io/cluster-api/util"
3738 conditions "sigs.k8s.io/cluster-api/util/conditions/v1beta2"
@@ -209,7 +210,9 @@ func (r *LinodeMachineReconciler) reconcileFirewallLabel(ctx context.Context, lo
209210 }
210211 labels [clusterv1 .ClusterNameLabel ] = machineScope .Machine .Labels [clusterv1 .ClusterNameLabel ]
211212 linodeFW .SetLabels (labels )
212- return machineScope .Client .Update (ctx , & linodeFW )
213+ return retry .RetryOnConflict (retry .DefaultRetry , func () error {
214+ return machineScope .Client .Update (ctx , & linodeFW )
215+ })
213216}
214217
215218// reconcilePGLabel adds the cluster-name label to placement group referenced in the machineScope if it does not already exist
@@ -236,7 +239,9 @@ func (r *LinodeMachineReconciler) reconcilePGLabel(ctx context.Context, logger l
236239 }
237240 labels [clusterv1 .ClusterNameLabel ] = machineScope .Machine .Labels [clusterv1 .ClusterNameLabel ]
238241 linodePG .ObjectMeta .SetLabels (labels )
239- return machineScope .Client .Update (ctx , & linodePG )
242+ return retry .RetryOnConflict (retry .DefaultRetry , func () error {
243+ return machineScope .Client .Update (ctx , & linodePG )
244+ })
240245}
241246
242247// reconcileLabel adds the cluster-name label to placement groups and firewalls that are difference in the machine spec
0 commit comments