@@ -260,7 +260,7 @@ func (r *APIReconciler) upsertOneIngress(
260260 return changed , err
261261 }
262262 if ic .Annotations [k ] != * route .Id {
263- setAnnotation (ic , k , * route .Id )
263+ util . SetAnnotation (ic , k , * route .Id )
264264 }
265265 changed = changed || changedRoute
266266 }
@@ -332,7 +332,7 @@ func (r *APIReconciler) syncOneSecret(
332332 if err != nil {
333333 return false , err
334334 } else if changed {
335- setAnnotation (secret , apiKeyPairIDAnnotation , keyPair .GetId ())
335+ util . SetAnnotation (secret , apiKeyPairIDAnnotation , keyPair .GetId ())
336336 controllerutil .AddFinalizer (secret , apiFinalizer )
337337 err = r .k8sClient .Patch (ctx , secret , client .MergeFrom (originalSecret ))
338338 }
@@ -502,7 +502,7 @@ func (r *APIReconciler) SetGatewayConfig(
502502 }
503503 changes = changes || routeChanged
504504 if gr .Annotations [k ] != * route .Id {
505- setAnnotation (gr , k , * route .Id )
505+ util . SetAnnotation (gr , k , * route .Id )
506506 }
507507 }
508508 controllerutil .AddFinalizer (gr , apiFinalizer )
@@ -570,7 +570,7 @@ func (r *APIReconciler) syncGatewayPolicies(
570570 return changes , nil , err
571571 } else if changedPolicy {
572572 changes = true
573- setAnnotation (obj , apiPolicyIDAnnotation , policy .GetId ())
573+ util . SetAnnotation (obj , apiPolicyIDAnnotation , policy .GetId ())
574574 controllerutil .AddFinalizer (obj , apiFinalizer )
575575 }
576576
@@ -770,7 +770,7 @@ func (r *APIReconciler) syncIngressPolicy(
770770 return false , "" , fmt .Errorf ("couldn't update ingress policy: %w" , err )
771771 }
772772 updatedPolicyID = apiPolicy .GetId ()
773- setAnnotation (ingress , apiPolicyIDAnnotation , updatedPolicyID )
773+ util . SetAnnotation (ingress , apiPolicyIDAnnotation , updatedPolicyID )
774774 return changed , updatedPolicyID , nil
775775}
776776
@@ -1040,15 +1040,6 @@ func convertProto[Dst, Src proto.Message](msg Src) (Dst, error) {
10401040 return newMsg , err
10411041}
10421042
1043- func setAnnotation (object client.Object , key , value string ) {
1044- m := object .GetAnnotations ()
1045- if m == nil {
1046- m = make (map [string ]string )
1047- }
1048- m [key ] = value
1049- object .SetAnnotations (m )
1050- }
1051-
10521043func falseToNil (x * bool ) * bool {
10531044 if x != nil && ! * x {
10541045 return nil
0 commit comments