@@ -122,7 +122,7 @@ func (r *ClaimReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ct
122
122
123
123
// Fetch the IPAddressClaim
124
124
claim := & ipamv1.IPAddressClaim {}
125
- if err := r .Client . Get (ctx , req .NamespacedName , claim ); err != nil {
125
+ if err := r .Get (ctx , req .NamespacedName , claim ); err != nil {
126
126
if apierrors .IsNotFound (err ) {
127
127
return ctrl.Result {}, nil
128
128
}
@@ -139,13 +139,13 @@ func (r *ClaimReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ct
139
139
}
140
140
if err != nil {
141
141
if apierrors .IsNotFound (err ) {
142
- if ! claim .ObjectMeta . DeletionTimestamp .IsZero () {
142
+ if ! claim .DeletionTimestamp .IsZero () {
143
143
patch := client .MergeFrom (claim .DeepCopy ())
144
144
if err := r .reconcileDelete (ctx , claim ); err != nil {
145
145
return ctrl.Result {}, fmt .Errorf ("reconcile delete: %w" , err )
146
146
}
147
147
// we'll need to explicitly patch the claim here since we haven't set up a patch helper yet.
148
- if err := r .Client . Patch (ctx , claim , patch ); err != nil {
148
+ if err := r .Patch (ctx , claim , patch ); err != nil {
149
149
return ctrl.Result {}, fmt .Errorf ("patch after reconciling delete: %w" , err )
150
150
}
151
151
return ctrl.Result {}, nil
@@ -187,7 +187,7 @@ func (r *ClaimReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ct
187
187
if apierrors .IsNotFound (err ) {
188
188
err := errors .New ("pool not found" )
189
189
log .Error (err , "the referenced pool could not be found" )
190
- if ! claim .ObjectMeta . DeletionTimestamp .IsZero () {
190
+ if ! claim .DeletionTimestamp .IsZero () {
191
191
return ctrl.Result {}, r .reconcileDelete (ctx , claim )
192
192
}
193
193
return ctrl.Result {}, nil
@@ -207,7 +207,7 @@ func (r *ClaimReconciler) Reconcile(ctx context.Context, req ctrl.Request) (_ ct
207
207
}
208
208
209
209
// If the claim is marked for deletion, release the address.
210
- if ! claim .ObjectMeta . DeletionTimestamp .IsZero () {
210
+ if ! claim .DeletionTimestamp .IsZero () {
211
211
if res , err := handler .ReleaseAddress (ctx ); err != nil {
212
212
return unwrapResult (res ), err
213
213
}
@@ -267,21 +267,21 @@ func (r *ClaimReconciler) reconcileDelete(ctx context.Context, claim *ipamv1.IPA
267
267
Namespace : claim .Namespace ,
268
268
Name : claim .Name ,
269
269
}
270
- if err := r .Client . Get (ctx , namespacedName , address ); err != nil && ! apierrors .IsNotFound (err ) {
270
+ if err := r .Get (ctx , namespacedName , address ); err != nil && ! apierrors .IsNotFound (err ) {
271
271
return errors .Wrap (err , "failed to fetch address" )
272
272
}
273
273
274
274
if address .Name != "" {
275
275
var err error
276
276
patch := client .MergeFrom (address .DeepCopy ())
277
277
if controllerutil .RemoveFinalizer (address , ProtectAddressFinalizer ) {
278
- if err = r .Client . Patch (ctx , address , patch ); err != nil && ! apierrors .IsNotFound (err ) {
278
+ if err = r .Patch (ctx , address , patch ); err != nil && ! apierrors .IsNotFound (err ) {
279
279
return errors .Wrap (err , "failed to remove address finalizer" )
280
280
}
281
281
}
282
282
283
283
if err == nil {
284
- if err := r .Client . Delete (ctx , address ); err != nil && ! apierrors .IsNotFound (err ) {
284
+ if err := r .Delete (ctx , address ); err != nil && ! apierrors .IsNotFound (err ) {
285
285
return err
286
286
}
287
287
}
@@ -294,7 +294,7 @@ func (r *ClaimReconciler) reconcileDelete(ctx context.Context, claim *ipamv1.IPA
294
294
func (r * ClaimReconciler ) clusterToIPClaims (_ context.Context , a client.Object ) []reconcile.Request {
295
295
requests := []reconcile.Request {}
296
296
claims := & ipamv1.IPAddressClaimList {}
297
- if err := r .Client . List (context .Background (), claims , client.MatchingFields {"clusterName" : a .GetName ()}); err != nil {
297
+ if err := r .List (context .Background (), claims , client.MatchingFields {"clusterName" : a .GetName ()}); err != nil {
298
298
return requests
299
299
}
300
300
for _ , c := range claims .Items {
0 commit comments