Skip to content

Commit

Permalink
- (#1431)
Browse files Browse the repository at this point in the history
Signed-off-by: 刘硕 <liushuo@zetyun.com>
Co-authored-by: 刘硕 <liushuo@zetyun.com>
  • Loading branch information
ls-2018 and 刘硕 committed Dec 11, 2023
1 parent 28c0a72 commit fa9a9a0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/controller/nodepodprobe/node_pod_probe_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,9 @@ var (
// Add creates a new NodePodProbe 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(controllerKind) || !utilfeature.DefaultFeatureGate.Enabled(features.PodProbeMarkerGate) {
if !utildiscovery.DiscoverGVK(controllerKind) ||
!utilfeature.DefaultFeatureGate.Enabled(features.PodProbeMarkerGate) ||
!utilfeature.DefaultFeatureGate.Enabled(features.KruiseDaemon) {
return nil
}
return add(mgr, newReconciler(mgr))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ import (
"regexp"
"strings"

"github.com/openkruise/kruise/pkg/features"
utilfeature "github.com/openkruise/kruise/pkg/util/feature"

"github.com/openkruise/kruise/apis/apps/pub"
appsv1alpha1 "github.com/openkruise/kruise/apis/apps/v1alpha1"
admissionv1 "k8s.io/api/admission/v1"
Expand Down Expand Up @@ -68,6 +71,12 @@ func (h *PodProbeMarkerCreateUpdateHandler) Handle(ctx context.Context, req admi
if err != nil {
return admission.Errored(http.StatusBadRequest, err)
}
if !utilfeature.DefaultFeatureGate.Enabled(features.PodProbeMarkerGate) {
return admission.Errored(http.StatusForbidden, fmt.Errorf("feature-gate %s is not enabled", features.PodProbeMarkerGate))
}
if !utilfeature.DefaultFeatureGate.Enabled(features.KruiseDaemon) {
return admission.Errored(http.StatusForbidden, fmt.Errorf("feature-gate %s is not enabled", features.KruiseDaemon))
}
var old *appsv1alpha1.PodProbeMarker
//when Operation is update, decode older object
if req.AdmissionRequest.Operation == admissionv1.Update {
Expand Down

0 comments on commit fa9a9a0

Please sign in to comment.