From a042fb22cc73ed6465b31c4bade779b6bd635dc4 Mon Sep 17 00:00:00 2001 From: Jian Qiu Date: Wed, 23 Mar 2022 11:16:31 +0800 Subject: [PATCH] Disable apf in webhook (#120) Signed-off-by: Jian Qiu --- deploy/webhook/deployment.yaml | 2 ++ pkg/cmd/webhook/webhook.go | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/deploy/webhook/deployment.yaml b/deploy/webhook/deployment.yaml index 4b44e6c43..d2025aa7c 100644 --- a/deploy/webhook/deployment.yaml +++ b/deploy/webhook/deployment.yaml @@ -24,6 +24,8 @@ spec: - "webhook" - "--cert-dir=/tmp" - "--secure-port=6443" + # webhook is not hosting any k8s api resource, so it is not subjected to APF feature + - "--feature-gates=APIPriorityAndFairness=false" securityContext: allowPrivilegeEscalation: false capabilities: diff --git a/pkg/cmd/webhook/webhook.go b/pkg/cmd/webhook/webhook.go index 7ce104349..39e26a3ad 100644 --- a/pkg/cmd/webhook/webhook.go +++ b/pkg/cmd/webhook/webhook.go @@ -6,6 +6,7 @@ import ( admissionserver "github.com/openshift/generic-admission-server/pkg/cmd/server" "github.com/spf13/cobra" genericapiserver "k8s.io/apiserver/pkg/server" + utilfeature "k8s.io/apiserver/pkg/util/feature" "open-cluster-management.io/work/pkg/webhook" ) @@ -31,6 +32,11 @@ func NewAdmissionHook() *cobra.Command { }, } + flags := cmd.Flags() + featureGate := utilfeature.DefaultMutableFeatureGate + featureGate.AddFlag(flags) + o.RecommendedOptions.FeatureGate = featureGate + o.RecommendedOptions.AddFlags(cmd.Flags()) return cmd