Skip to content

Commit

Permalink
add a switch for persistentPodState controller (#1002)
Browse files Browse the repository at this point in the history
Signed-off-by: mingzhou.swx <[email protected]>

Co-authored-by: mingzhou.swx <[email protected]>
  • Loading branch information
veophi and mingzhou.swx authored Jun 20, 2022
1 parent ddd87f0 commit 345c292
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
appsv1beta1 "github.com/openkruise/kruise/apis/apps/v1beta1"
"github.com/openkruise/kruise/pkg/util"
"github.com/openkruise/kruise/pkg/util/controllerfinder"
"github.com/openkruise/kruise/pkg/util/discovery"
"github.com/openkruise/kruise/pkg/util/ratelimiter"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
Expand Down Expand Up @@ -58,6 +59,7 @@ var (
KindSts = appsv1.SchemeGroupVersion.WithKind("StatefulSet")
// kruise
KruiseKindSts = appsv1beta1.SchemeGroupVersion.WithKind("StatefulSet")
KruiseKindPps = appsv1alpha1.SchemeGroupVersion.WithKind("PersistentPodState")
// AutoGeneratePersistentPodStatePrefix auto generate PersistentPodState crd
AutoGeneratePersistentPodStatePrefix = "generate#"
)
Expand All @@ -70,6 +72,9 @@ var (
// Add creates a new PersistentPodState 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 !discovery.DiscoverGVK(KruiseKindPps) {
return nil
}
return add(mgr, newReconciler(mgr))
}

Expand Down

0 comments on commit 345c292

Please sign in to comment.