Skip to content

Commit

Permalink
🐛 Add dependency
Browse files Browse the repository at this point in the history
Signed-off-by: 刘硕 <[email protected]>
  • Loading branch information
刘硕 committed Oct 9, 2023
1 parent 81b5d52 commit 70b8a6f
Show file tree
Hide file tree
Showing 2 changed files with 11 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 @@ -19,6 +19,8 @@ package validating
import (
"context"
"fmt"
"github.com/openkruise/kruise/pkg/features"

Check failure on line 22 in pkg/webhook/podprobemarker/validating/probe_create_update_handler.go

View workflow job for this annotation

GitHub Actions / golangci-lint

File is not `goimports`-ed (goimports)
utilfeature "github.com/openkruise/kruise/pkg/util/feature"
"net/http"
"reflect"
"regexp"
Expand Down Expand Up @@ -67,6 +69,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 70b8a6f

Please sign in to comment.