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 5ab9e1e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion 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,7 +45,16 @@ func (mt *MigrationTrigger) processDiscovery(ctx context.Context) {
return true, nil
})
if err != nil {
utilruntime.HandleError(fmt.Errorf("Abort processing discovery document: %v", err))
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)
}
}
// skip updating heartbeat if we failed to discover anything (e.g. lost connection)
if resources == nil {
return
}
mt.heartbeat = metav1.Now()
Expand Down

0 comments on commit 5ab9e1e

Please sign in to comment.