Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions multicluster/cmd/service-mirror/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"os"
"os/signal"
"reflect"
"syscall"
"time"

Expand Down Expand Up @@ -164,17 +165,26 @@ func Main(args []string) {
}
}
},
UpdateFunc: func(_, obj interface{}) {
link, ok := obj.(*v1alpha2.Link)
UpdateFunc: func(oldObj, currentObj interface{}) {
oldLink, ok := oldObj.(*v1alpha2.Link)
if !ok {
log.Errorf("object is not a Link: %+v", obj)
log.Errorf("object is not a Link: %+v", oldObj)
return
}
if link.GetName() == linkName {
currentLink, ok := currentObj.(*v1alpha2.Link)
if !ok {
log.Errorf("object is not a Link: %+v", currentObj)
return
}
if reflect.DeepEqual(oldLink.Spec, currentLink.Spec) {
log.Infof("Link update ignored (only status changed): %s", currentLink.GetName())
Comment thread
alpeb marked this conversation as resolved.
Outdated
return
}
if currentLink.GetName() == linkName {
select {
case results <- link:
case results <- currentLink:
Comment thread
olix0r marked this conversation as resolved.
Outdated
default:
log.Errorf("Link update dropped (queue full): %s", link.GetName())
log.Errorf("Link update dropped (queue full): %s", currentLink.GetName())
}
}
},
Expand Down