Skip to content

Commit

Permalink
fix: error compare
Browse files Browse the repository at this point in the history
  • Loading branch information
aslakknutsen committed Sep 4, 2024
1 parent 27b984e commit c8de23b
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 2 additions & 2 deletions controllers/routingctrl/delete_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ func (r *Controller) removeUnusedRoutingResources(ctx context.Context, target *u
func (r *Controller) handleResourceDeletion(ctx context.Context, sourceRes *unstructured.Unstructured) error {
exportModes := r.extractExportModes(sourceRes)
if len(exportModes) == 0 {
r.log.Info("No export modes found, skipping deletion logic", "sourceRes", sourceRes)
r.log.Info("no export modes found, skipping deletion logic", "sourceRes", sourceRes)

return nil
}

r.log.Info("Handling deletion of dependent resources", "sourceRes", sourceRes)
r.log.Info("handling deletion of dependent resources", "sourceRes", sourceRes)

gvks := routingResourceGVKs(exportModes...)

Expand Down
5 changes: 5 additions & 0 deletions controllers/routingctrl/exported_svc_locator.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ func (e *ExportedServiceNotFoundError) Error() string {
return fmt.Sprintf("no exported services found for target %s/%s (%s)", e.target.GetNamespace(), e.target.GetName(), e.target.GetObjectKind().GroupVersionKind().String())
}

func (e *ExportedServiceNotFoundError) Is(target error) bool {
_, ok := target.(*ExportedServiceNotFoundError)
return ok

Check failure on line 53 in controllers/routingctrl/exported_svc_locator.go

View workflow job for this annotation

GitHub Actions / golangci-lint

return with no blank line before (nlreturn)
}

func isExportedServiceNotFoundError(err error) bool {
return errors.Is(err, &ExportedServiceNotFoundError{})
}
2 changes: 1 addition & 1 deletion controllers/routingctrl/reconcile_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (r *Controller) createRoutingResources(ctx context.Context, target *unstruc
return r.propagateHostsToWatchedCR(ctx, target, nil, nil)
}

r.log.Info("Reconciling resources for target", "target", target)
r.log.Info("reconciling resources for target", "target", target)

renderedSelectors, errLables := config.ResolveSelectors(r.component.ServiceSelector, target)
if errLables != nil {
Expand Down

0 comments on commit c8de23b

Please sign in to comment.