Skip to content

Commit

Permalink
add discoverGVK for workloadspread (#795)
Browse files Browse the repository at this point in the history
Signed-off-by: veophi <[email protected]>
  • Loading branch information
veophi authored and FillZpp committed Nov 12, 2021
1 parent 24e86f4 commit 50802e6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/controller/workloadspread/workloadspread_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import (
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
"github.com/openkruise/kruise/pkg/util"
"github.com/openkruise/kruise/pkg/util/controllerfinder"
utildiscovery "github.com/openkruise/kruise/pkg/util/discovery"
"github.com/openkruise/kruise/pkg/util/fieldindex"
"github.com/openkruise/kruise/pkg/util/ratelimiter"
"github.com/openkruise/kruise/pkg/util/requeueduration"
Expand Down Expand Up @@ -74,6 +75,7 @@ const (
)

var (
controllerKruiseKindWS = appsv1alpha1.SchemeGroupVersion.WithKind("WorkloadSpread")
controllerKruiseKindCS = appsv1alpha1.SchemeGroupVersion.WithKind("CloneSet")
controllerKindRS = appsv1.SchemeGroupVersion.WithKind("ReplicaSet")
controllerKindDep = appsv1.SchemeGroupVersion.WithKind("Deployment")
Expand All @@ -86,6 +88,9 @@ var durationStore = requeueduration.DurationStore{}
// Add creates a new WorkloadSpread Controller and adds it to the Manager with default RBAC. The Manager will set fields on the Controller
// and Start it when the Manager is Started.
func Add(mgr manager.Manager) error {
if !utildiscovery.DiscoverGVK(controllerKruiseKindWS) {
return nil
}
return add(mgr, newReconciler(mgr))
}

Expand Down

0 comments on commit 50802e6

Please sign in to comment.