Skip to content

Commit

Permalink
keep processing partial discovery result when failure occurs
Browse files Browse the repository at this point in the history
  • Loading branch information
roycaihw committed Jul 23, 2020
1 parent acf6eff commit 529382c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pkg/trigger/discovery_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"k8s.io/apimachinery/pkg/runtime/schema"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/client-go/discovery"
"k8s.io/klog"

migrationv1alpha1 "sigs.k8s.io/kube-storage-version-migrator/pkg/apis/migration/v1alpha1"
Expand All @@ -44,8 +45,13 @@ func (mt *MigrationTrigger) processDiscovery(ctx context.Context) {
return true, nil
})
if err != nil {
utilruntime.HandleError(fmt.Errorf("Abort processing discovery document: %v", err))
return
if discovery.IsGroupDiscoveryFailedError(err2) {
// process the partial discovery result, and update the heartbeat for
// resources that do have a valid discovery document
klog.Warningf("failed to discover some groups: %v; processing partial result", err2.(*discovery.ErrGroupDiscoveryFailed).Groups)
} else {
klog.Warningf("failed to discover preferred resources: %v", err2)
}
}
mt.heartbeat = metav1.Now()
for _, l := range resources {
Expand Down

0 comments on commit 529382c

Please sign in to comment.