disable APIPriorityAndFairness using config instead of feature flag

Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
This commit is contained in:
Tim Ramlot 2024-01-03 17:40:46 +01:00
parent 8111b43b10
commit 90dc8ccde0
No known key found for this signature in database
GPG Key ID: 47428728E0C2878D

View File

@ -23,11 +23,8 @@ import (
"github.com/spf13/cobra"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/apiserver/pkg/features"
genericapiserver "k8s.io/apiserver/pkg/server"
genericoptions "k8s.io/apiserver/pkg/server/options"
utilfeature "k8s.io/apiserver/pkg/util/feature"
"k8s.io/component-base/logs"
"github.com/cert-manager/cert-manager/pkg/acme/webhook"
@ -36,8 +33,6 @@ import (
logf "github.com/cert-manager/cert-manager/pkg/logs"
)
const defaultEtcdPathPrefix = "/registry/acme.cert-manager.io"
type WebhookServerOptions struct {
Logging *logs.Options
@ -54,9 +49,8 @@ func NewWebhookServerOptions(out, errOut io.Writer, groupName string, solvers ..
o := &WebhookServerOptions{
Logging: logs.NewOptions(),
// TODO we will nil out the etcd storage options. This requires a later level of k8s.io/apiserver
RecommendedOptions: genericoptions.NewRecommendedOptions(
defaultEtcdPathPrefix,
"<UNUSED>",
apiserver.Codecs.LegacyCodec(whapi.SchemeGroupVersion),
),
@ -68,6 +62,7 @@ func NewWebhookServerOptions(out, errOut io.Writer, groupName string, solvers ..
}
o.RecommendedOptions.Etcd = nil
o.RecommendedOptions.Admission = nil
o.RecommendedOptions.Features.EnablePriorityAndFairness = false
return o
}
@ -142,13 +137,6 @@ func (o WebhookServerOptions) Config() (*apiserver.Config, error) {
// RunWebhookServer creates a new apiserver, registers an API Group for each of
// the configured solvers and runs the new apiserver.
func (o WebhookServerOptions) RunWebhookServer(stopCh <-chan struct{}) error {
// extension apiserver does not need priority and fairness.
// TODO: this is a short term fix; when APF graduates we will need to
// find another way. Alternatives are either to find a way how to
// disable APF controller (without the feature gate), run the controller
// (create RBAC and ensure required resources are installed) or do some
// bigger refactor of this project that could solve the problem
utilruntime.Must(utilfeature.DefaultMutableFeatureGate.Set(fmt.Sprintf("%s=false", features.APIPriorityAndFairness)))
config, err := o.Config()
if err != nil {
return err