@@ -164,7 +164,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
164164 }
165165 // Mark the ServiceExport as invalid.
166166 klog .V (2 ).InfoS ("Mark service export as invalid (service ineligible)" , "service" , svcRef )
167- err = r .markServiceExportAsInvalidSvcIneligible (ctx , & svcExport , & svc )
167+ err = r .markServiceExportAsInvalidSvcIneligible (ctx , & svcExport )
168168 if err != nil {
169169 klog .ErrorS (err , "Failed to mark service export as invalid (service ineligible)" , "service" , svcRef )
170170 }
@@ -234,7 +234,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
234234
235235 // Mark the ServiceExport as valid.
236236 klog .V (2 ).InfoS ("Mark service export as valid" , "service" , svcRef )
237- if err = r .markServiceExportAsValid (ctx , & svcExport , & svc ); err != nil {
237+ if err = r .markServiceExportAsValid (ctx , & svcExport ); err != nil {
238238 klog .ErrorS (err , "Failed to mark service export as valid" , "service" , svcRef )
239239 return ctrl.Result {}, err
240240 }
@@ -478,11 +478,11 @@ func (r *Reconciler) removeServiceExportCleanupFinalizer(ctx context.Context, sv
478478func (r * Reconciler ) markServiceExportAsInvalidNotFound (ctx context.Context , svcExport * fleetnetv1alpha1.ServiceExport ) error {
479479 validCond := meta .FindStatusCondition (svcExport .Status .Conditions , string (fleetnetv1alpha1 .ServiceExportValid ))
480480 expectedValidCond := & metav1.Condition {
481- Type : string (fleetnetv1alpha1 .ServiceExportValid ),
482- Status : metav1 .ConditionFalse ,
483- // The Service is not found, therefore the observedGeneration field is ignored.
484- Reason : svcExportInvalidNotFoundCondReason ,
485- Message : fmt .Sprintf ("service %s/%s is not found" , svcExport .Namespace , svcExport .Name ),
481+ Type : string (fleetnetv1alpha1 .ServiceExportValid ),
482+ Status : metav1 .ConditionFalse ,
483+ Reason : svcExportInvalidNotFoundCondReason ,
484+ ObservedGeneration : svcExport . Generation ,
485+ Message : fmt .Sprintf ("service %s/%s is not found" , svcExport .Namespace , svcExport .Name ),
486486 }
487487 if condition .EqualCondition (validCond , expectedValidCond ) {
488488 // A stable state has been reached; no further action is needed.
@@ -494,13 +494,13 @@ func (r *Reconciler) markServiceExportAsInvalidNotFound(ctx context.Context, svc
494494}
495495
496496// markServiceExportAsInvalidSvcIneligible marks a ServiceExport as invalid.
497- func (r * Reconciler ) markServiceExportAsInvalidSvcIneligible (ctx context.Context , svcExport * fleetnetv1alpha1.ServiceExport , svc * corev1. Service ) error {
497+ func (r * Reconciler ) markServiceExportAsInvalidSvcIneligible (ctx context.Context , svcExport * fleetnetv1alpha1.ServiceExport ) error {
498498 validCond := meta .FindStatusCondition (svcExport .Status .Conditions , string (fleetnetv1alpha1 .ServiceExportValid ))
499499 expectedValidCond := & metav1.Condition {
500500 Type : string (fleetnetv1alpha1 .ServiceExportValid ),
501501 Status : metav1 .ConditionFalse ,
502502 Reason : svcExportInvalidIneligibleCondReason ,
503- ObservedGeneration : svc .Generation ,
503+ ObservedGeneration : svcExport .Generation ,
504504 Message : fmt .Sprintf ("service %s/%s is not eligible for export" , svcExport .Namespace , svcExport .Name ),
505505 }
506506 if condition .EqualCondition (validCond , expectedValidCond ) {
@@ -520,13 +520,13 @@ func (r *Reconciler) addServiceExportCleanupFinalizer(ctx context.Context, svcEx
520520
521521// markServiceExportAsValid marks a ServiceExport as valid; if no conflict condition has been added, the
522522// ServiceExport will be marked as pending conflict resolution as well.
523- func (r * Reconciler ) markServiceExportAsValid (ctx context.Context , svcExport * fleetnetv1alpha1.ServiceExport , svc * corev1. Service ) error {
523+ func (r * Reconciler ) markServiceExportAsValid (ctx context.Context , svcExport * fleetnetv1alpha1.ServiceExport ) error {
524524 validCond := meta .FindStatusCondition (svcExport .Status .Conditions , string (fleetnetv1alpha1 .ServiceExportValid ))
525525 expectedValidCond := & metav1.Condition {
526526 Type : string (fleetnetv1alpha1 .ServiceExportValid ),
527527 Status : metav1 .ConditionTrue ,
528528 Reason : svcExportValidCondReason ,
529- ObservedGeneration : svc .Generation ,
529+ ObservedGeneration : svcExport .Generation ,
530530 Message : fmt .Sprintf ("service %s/%s is valid for export" , svcExport .Namespace , svcExport .Name ),
531531 }
532532 conflictCond := meta .FindStatusCondition (svcExport .Status .Conditions , string (fleetnetv1alpha1 .ServiceExportConflict ))
@@ -549,7 +549,7 @@ func (r *Reconciler) markServiceExportAsValid(ctx context.Context, svcExport *fl
549549 meta .SetStatusCondition (& svcExport .Status .Conditions , metav1.Condition {
550550 Type : string (fleetnetv1alpha1 .ServiceExportConflict ),
551551 Status : metav1 .ConditionUnknown ,
552- ObservedGeneration : svc .Generation ,
552+ ObservedGeneration : svcExport .Generation ,
553553 Reason : svcExportPendingConflictResolutionReason ,
554554 Message : fmt .Sprintf ("service %s/%s is pending export conflict resolution" , svcExport .Namespace , svcExport .Name ),
555555 })
0 commit comments