Merge pull request #112306 from tkashem/v1beta3

add v1beta3 for Priority And Fairness

Kubernetes-commit: 9720af2ba3f0d792c873bfa6e4d54e60736fb7a0
This commit is contained in:
Kubernetes Publisher 2022-10-03 10:06:14 -07:00
commit 2f09ce5f22
15 changed files with 56 additions and 56 deletions

8
go.mod
View File

@ -39,9 +39,9 @@ require (
google.golang.org/grpc v1.49.0 google.golang.org/grpc v1.49.0
gopkg.in/natefinch/lumberjack.v2 v2.0.0 gopkg.in/natefinch/lumberjack.v2 v2.0.0
gopkg.in/square/go-jose.v2 v2.2.2 gopkg.in/square/go-jose.v2 v2.2.2
k8s.io/api v0.0.0-20220929222634-381423603350 k8s.io/api v0.0.0-20221003194454-3cedfadbe658
k8s.io/apimachinery v0.0.0-20220929193440-66e26ac34f07 k8s.io/apimachinery v0.0.0-20220929193440-66e26ac34f07
k8s.io/client-go v0.0.0-20220929222931-ebc7cd4b2d67 k8s.io/client-go v0.0.0-20221003194729-f24bd6967c44
k8s.io/component-base v0.0.0-20220930234846-815a25776f41 k8s.io/component-base v0.0.0-20220930234846-815a25776f41
k8s.io/klog/v2 v2.80.1 k8s.io/klog/v2 v2.80.1
k8s.io/kms v0.0.0-20220927064431-aef5f8fcd82d k8s.io/kms v0.0.0-20220927064431-aef5f8fcd82d
@ -119,9 +119,9 @@ require (
) )
replace ( replace (
k8s.io/api => k8s.io/api v0.0.0-20220929222634-381423603350 k8s.io/api => k8s.io/api v0.0.0-20221003194454-3cedfadbe658
k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20220929193440-66e26ac34f07 k8s.io/apimachinery => k8s.io/apimachinery v0.0.0-20220929193440-66e26ac34f07
k8s.io/client-go => k8s.io/client-go v0.0.0-20220929222931-ebc7cd4b2d67 k8s.io/client-go => k8s.io/client-go v0.0.0-20221003194729-f24bd6967c44
k8s.io/component-base => k8s.io/component-base v0.0.0-20220930234846-815a25776f41 k8s.io/component-base => k8s.io/component-base v0.0.0-20220930234846-815a25776f41
k8s.io/kms => k8s.io/kms v0.0.0-20220927064431-aef5f8fcd82d k8s.io/kms => k8s.io/kms v0.0.0-20220927064431-aef5f8fcd82d
) )

8
go.sum
View File

@ -976,12 +976,12 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
k8s.io/api v0.0.0-20220929222634-381423603350 h1:CET8gjFI/0oNdcEBB/qAu5lYh250fXpqcyCYigdfT0M= k8s.io/api v0.0.0-20221003194454-3cedfadbe658 h1:0xWYwVNLchx3hp1Y16uO8/UacSN04D5n7y3/mRWMv+Q=
k8s.io/api v0.0.0-20220929222634-381423603350/go.mod h1:55a/w41XyLRGlOX8Myq7ywr3hPPuPMvA3EzNcy7Xq3w= k8s.io/api v0.0.0-20221003194454-3cedfadbe658/go.mod h1:55a/w41XyLRGlOX8Myq7ywr3hPPuPMvA3EzNcy7Xq3w=
k8s.io/apimachinery v0.0.0-20220929193440-66e26ac34f07 h1:AvRAbH6TxNfcKjK4Fs4celvuGprlNrafnWm651nHHdc= k8s.io/apimachinery v0.0.0-20220929193440-66e26ac34f07 h1:AvRAbH6TxNfcKjK4Fs4celvuGprlNrafnWm651nHHdc=
k8s.io/apimachinery v0.0.0-20220929193440-66e26ac34f07/go.mod h1:zdDPkAEkslrVOG1IzqRpqLwHlA/W9IhQ6nE1h5IJ7ME= k8s.io/apimachinery v0.0.0-20220929193440-66e26ac34f07/go.mod h1:zdDPkAEkslrVOG1IzqRpqLwHlA/W9IhQ6nE1h5IJ7ME=
k8s.io/client-go v0.0.0-20220929222931-ebc7cd4b2d67 h1:Hr3/dqsvMWxtylLzCwFyze/nirr3H7nIXRwpnubFiMw= k8s.io/client-go v0.0.0-20221003194729-f24bd6967c44 h1:7QcyPPeWqMzvUb48tUKFdfa4EQRBM7ejPASNuq41IOg=
k8s.io/client-go v0.0.0-20220929222931-ebc7cd4b2d67/go.mod h1:e1vgGAdKoHGOh0KJu7+o0b3jXbUrcaArSi+Eyh635IU= k8s.io/client-go v0.0.0-20221003194729-f24bd6967c44/go.mod h1:L8bGeaYpjNdKbWOEKSpYJz92KWxN9pe2ZDmx7yJ0/lM=
k8s.io/component-base v0.0.0-20220930234846-815a25776f41 h1:XFeMqZOIXqOSMqUTYwVhASgeqxazuquZPn+dDwAU6Ww= k8s.io/component-base v0.0.0-20220930234846-815a25776f41 h1:XFeMqZOIXqOSMqUTYwVhASgeqxazuquZPn+dDwAU6Ww=
k8s.io/component-base v0.0.0-20220930234846-815a25776f41/go.mod h1:egwjwf+X9WyTBARCdV9R9B//zOsdCui/5972ysTANp0= k8s.io/component-base v0.0.0-20220930234846-815a25776f41/go.mod h1:egwjwf+X9WyTBARCdV9R9B//zOsdCui/5972ysTANp0=
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4= k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=

View File

@ -19,7 +19,7 @@ package bootstrap
import ( import (
coordinationv1 "k8s.io/api/coordination/v1" coordinationv1 "k8s.io/api/coordination/v1"
corev1 "k8s.io/api/core/v1" corev1 "k8s.io/api/core/v1"
flowcontrol "k8s.io/api/flowcontrol/v1beta2" flowcontrol "k8s.io/api/flowcontrol/v1beta3"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apiserver/pkg/authentication/serviceaccount" "k8s.io/apiserver/pkg/authentication/serviceaccount"
"k8s.io/apiserver/pkg/authentication/user" "k8s.io/apiserver/pkg/authentication/user"
@ -95,7 +95,7 @@ var (
flowcontrol.PriorityLevelConfigurationSpec{ flowcontrol.PriorityLevelConfigurationSpec{
Type: flowcontrol.PriorityLevelEnablementLimited, Type: flowcontrol.PriorityLevelEnablementLimited,
Limited: &flowcontrol.LimitedPriorityLevelConfiguration{ Limited: &flowcontrol.LimitedPriorityLevelConfiguration{
AssuredConcurrencyShares: 5, NominalConcurrencyShares: 5,
LimitResponse: flowcontrol.LimitResponse{ LimitResponse: flowcontrol.LimitResponse{
Type: flowcontrol.LimitResponseTypeReject, Type: flowcontrol.LimitResponseTypeReject,
}, },
@ -167,7 +167,7 @@ var (
flowcontrol.PriorityLevelConfigurationSpec{ flowcontrol.PriorityLevelConfigurationSpec{
Type: flowcontrol.PriorityLevelEnablementLimited, Type: flowcontrol.PriorityLevelEnablementLimited,
Limited: &flowcontrol.LimitedPriorityLevelConfiguration{ Limited: &flowcontrol.LimitedPriorityLevelConfiguration{
AssuredConcurrencyShares: 30, NominalConcurrencyShares: 30,
LimitResponse: flowcontrol.LimitResponse{ LimitResponse: flowcontrol.LimitResponse{
Type: flowcontrol.LimitResponseTypeQueue, Type: flowcontrol.LimitResponseTypeQueue,
Queuing: &flowcontrol.QueuingConfiguration{ Queuing: &flowcontrol.QueuingConfiguration{
@ -183,7 +183,7 @@ var (
flowcontrol.PriorityLevelConfigurationSpec{ flowcontrol.PriorityLevelConfigurationSpec{
Type: flowcontrol.PriorityLevelEnablementLimited, Type: flowcontrol.PriorityLevelEnablementLimited,
Limited: &flowcontrol.LimitedPriorityLevelConfiguration{ Limited: &flowcontrol.LimitedPriorityLevelConfiguration{
AssuredConcurrencyShares: 40, NominalConcurrencyShares: 40,
LimitResponse: flowcontrol.LimitResponse{ LimitResponse: flowcontrol.LimitResponse{
Type: flowcontrol.LimitResponseTypeQueue, Type: flowcontrol.LimitResponseTypeQueue,
Queuing: &flowcontrol.QueuingConfiguration{ Queuing: &flowcontrol.QueuingConfiguration{
@ -200,7 +200,7 @@ var (
flowcontrol.PriorityLevelConfigurationSpec{ flowcontrol.PriorityLevelConfigurationSpec{
Type: flowcontrol.PriorityLevelEnablementLimited, Type: flowcontrol.PriorityLevelEnablementLimited,
Limited: &flowcontrol.LimitedPriorityLevelConfiguration{ Limited: &flowcontrol.LimitedPriorityLevelConfiguration{
AssuredConcurrencyShares: 10, NominalConcurrencyShares: 10,
LimitResponse: flowcontrol.LimitResponse{ LimitResponse: flowcontrol.LimitResponse{
Type: flowcontrol.LimitResponseTypeQueue, Type: flowcontrol.LimitResponseTypeQueue,
Queuing: &flowcontrol.QueuingConfiguration{ Queuing: &flowcontrol.QueuingConfiguration{
@ -217,7 +217,7 @@ var (
flowcontrol.PriorityLevelConfigurationSpec{ flowcontrol.PriorityLevelConfigurationSpec{
Type: flowcontrol.PriorityLevelEnablementLimited, Type: flowcontrol.PriorityLevelEnablementLimited,
Limited: &flowcontrol.LimitedPriorityLevelConfiguration{ Limited: &flowcontrol.LimitedPriorityLevelConfiguration{
AssuredConcurrencyShares: 40, NominalConcurrencyShares: 40,
LimitResponse: flowcontrol.LimitResponse{ LimitResponse: flowcontrol.LimitResponse{
Type: flowcontrol.LimitResponseTypeQueue, Type: flowcontrol.LimitResponseTypeQueue,
Queuing: &flowcontrol.QueuingConfiguration{ Queuing: &flowcontrol.QueuingConfiguration{
@ -234,7 +234,7 @@ var (
flowcontrol.PriorityLevelConfigurationSpec{ flowcontrol.PriorityLevelConfigurationSpec{
Type: flowcontrol.PriorityLevelEnablementLimited, Type: flowcontrol.PriorityLevelEnablementLimited,
Limited: &flowcontrol.LimitedPriorityLevelConfiguration{ Limited: &flowcontrol.LimitedPriorityLevelConfiguration{
AssuredConcurrencyShares: 100, NominalConcurrencyShares: 100,
LimitResponse: flowcontrol.LimitResponse{ LimitResponse: flowcontrol.LimitResponse{
Type: flowcontrol.LimitResponseTypeQueue, Type: flowcontrol.LimitResponseTypeQueue,
Queuing: &flowcontrol.QueuingConfiguration{ Queuing: &flowcontrol.QueuingConfiguration{
@ -251,7 +251,7 @@ var (
flowcontrol.PriorityLevelConfigurationSpec{ flowcontrol.PriorityLevelConfigurationSpec{
Type: flowcontrol.PriorityLevelEnablementLimited, Type: flowcontrol.PriorityLevelEnablementLimited,
Limited: &flowcontrol.LimitedPriorityLevelConfiguration{ Limited: &flowcontrol.LimitedPriorityLevelConfiguration{
AssuredConcurrencyShares: 20, NominalConcurrencyShares: 20,
LimitResponse: flowcontrol.LimitResponse{ LimitResponse: flowcontrol.LimitResponse{
Type: flowcontrol.LimitResponseTypeQueue, Type: flowcontrol.LimitResponseTypeQueue,
Queuing: &flowcontrol.QueuingConfiguration{ Queuing: &flowcontrol.QueuingConfiguration{

View File

@ -25,7 +25,7 @@ import (
"sync/atomic" "sync/atomic"
"time" "time"
flowcontrol "k8s.io/api/flowcontrol/v1beta2" flowcontrol "k8s.io/api/flowcontrol/v1beta3"
apitypes "k8s.io/apimachinery/pkg/types" apitypes "k8s.io/apimachinery/pkg/types"
epmetrics "k8s.io/apiserver/pkg/endpoints/metrics" epmetrics "k8s.io/apiserver/pkg/endpoints/metrics"
apirequest "k8s.io/apiserver/pkg/endpoints/request" apirequest "k8s.io/apiserver/pkg/endpoints/request"

View File

@ -29,7 +29,7 @@ import (
"testing" "testing"
"time" "time"
flowcontrol "k8s.io/api/flowcontrol/v1beta2" flowcontrol "k8s.io/api/flowcontrol/v1beta3"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/types"
@ -1090,7 +1090,7 @@ func startAPFController(t *testing.T, stopCh <-chan struct{}, apfConfiguration [
clientset := newClientset(t, apfConfiguration...) clientset := newClientset(t, apfConfiguration...)
// this test does not rely on resync, so resync period is set to zero // this test does not rely on resync, so resync period is set to zero
factory := informers.NewSharedInformerFactory(clientset, 0) factory := informers.NewSharedInformerFactory(clientset, 0)
controller := utilflowcontrol.New(factory, clientset.FlowcontrolV1beta2(), serverConcurrency, requestWaitLimit) controller := utilflowcontrol.New(factory, clientset.FlowcontrolV1beta3(), serverConcurrency, requestWaitLimit)
factory.Start(stopCh) factory.Start(stopCh)
@ -1268,7 +1268,7 @@ func newConfiguration(fsName, plName, user string, concurrency int32, queueLengt
Spec: flowcontrol.PriorityLevelConfigurationSpec{ Spec: flowcontrol.PriorityLevelConfigurationSpec{
Type: flowcontrol.PriorityLevelEnablementLimited, Type: flowcontrol.PriorityLevelEnablementLimited,
Limited: &flowcontrol.LimitedPriorityLevelConfiguration{ Limited: &flowcontrol.LimitedPriorityLevelConfiguration{
AssuredConcurrencyShares: concurrency, NominalConcurrencyShares: concurrency,
LimitResponse: flowcontrol.LimitResponse{ LimitResponse: flowcontrol.LimitResponse{
Type: responseType, Type: responseType,
Queuing: qcfg, Queuing: qcfg,

View File

@ -141,7 +141,7 @@ func (o *RecommendedOptions) ApplyTo(config *server.RecommendedConfig) error {
} }
config.FlowControl = utilflowcontrol.New( config.FlowControl = utilflowcontrol.New(
config.SharedInformerFactory, config.SharedInformerFactory,
kubernetes.NewForConfigOrDie(config.ClientConfig).FlowcontrolV1beta2(), kubernetes.NewForConfigOrDie(config.ClientConfig).FlowcontrolV1beta3(),
config.MaxRequestsInFlight+config.MaxMutatingRequestsInFlight, config.MaxRequestsInFlight+config.MaxMutatingRequestsInFlight,
config.RequestTimeout/4, config.RequestTimeout/4,
) )

View File

@ -19,7 +19,7 @@ package apihelpers
import ( import (
"sort" "sort"
flowcontrol "k8s.io/api/flowcontrol/v1beta2" flowcontrol "k8s.io/api/flowcontrol/v1beta3"
) )
// SetFlowSchemaCondition sets conditions. // SetFlowSchemaCondition sets conditions.

View File

@ -52,9 +52,9 @@ import (
"k8s.io/klog/v2" "k8s.io/klog/v2"
"k8s.io/utils/clock" "k8s.io/utils/clock"
flowcontrol "k8s.io/api/flowcontrol/v1beta2" flowcontrol "k8s.io/api/flowcontrol/v1beta3"
flowcontrolclient "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2" flowcontrolclient "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta3"
flowcontrollister "k8s.io/client-go/listers/flowcontrol/v1beta2" flowcontrollister "k8s.io/client-go/listers/flowcontrol/v1beta3"
) )
const timeFmt = "2006-01-02T15:04:05.999" const timeFmt = "2006-01-02T15:04:05.999"
@ -123,7 +123,7 @@ type configController struct {
fsLister flowcontrollister.FlowSchemaLister fsLister flowcontrollister.FlowSchemaLister
fsInformerSynced cache.InformerSynced fsInformerSynced cache.InformerSynced
flowcontrolClient flowcontrolclient.FlowcontrolV1beta2Interface flowcontrolClient flowcontrolclient.FlowcontrolV1beta3Interface
// serverConcurrencyLimit is the limit on the server's total // serverConcurrencyLimit is the limit on the server's total
// number of non-exempt requests being served at once. This comes // number of non-exempt requests being served at once. This comes
@ -221,7 +221,7 @@ func newTestableController(config TestableConfig) *configController {
cfgCtlr.configQueue = workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(200*time.Millisecond, 8*time.Hour), "priority_and_fairness_config_queue") cfgCtlr.configQueue = workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(200*time.Millisecond, 8*time.Hour), "priority_and_fairness_config_queue")
// ensure the data structure reflects the mandatory config // ensure the data structure reflects the mandatory config
cfgCtlr.lockAndDigestConfigObjects(nil, nil) cfgCtlr.lockAndDigestConfigObjects(nil, nil)
fci := config.InformerFactory.Flowcontrol().V1beta2() fci := config.InformerFactory.Flowcontrol().V1beta3()
pli := fci.PriorityLevelConfigurations() pli := fci.PriorityLevelConfigurations()
fsi := fci.FlowSchemas() fsi := fci.FlowSchemas()
cfgCtlr.plLister = pli.Lister() cfgCtlr.plLister = pli.Lister()
@ -545,7 +545,7 @@ func (meal *cfgMeal) digestNewPLsLocked(newPLs []*flowcontrol.PriorityLevelConfi
state.quiescing = false state.quiescing = false
} }
if state.pl.Spec.Limited != nil { if state.pl.Spec.Limited != nil {
meal.shareSum += float64(state.pl.Spec.Limited.AssuredConcurrencyShares) meal.shareSum += float64(state.pl.Spec.Limited.NominalConcurrencyShares)
} }
meal.haveExemptPL = meal.haveExemptPL || pl.Name == flowcontrol.PriorityLevelConfigurationNameExempt meal.haveExemptPL = meal.haveExemptPL || pl.Name == flowcontrol.PriorityLevelConfigurationNameExempt
meal.haveCatchAllPL = meal.haveCatchAllPL || pl.Name == flowcontrol.PriorityLevelConfigurationNameCatchAll meal.haveCatchAllPL = meal.haveCatchAllPL || pl.Name == flowcontrol.PriorityLevelConfigurationNameCatchAll
@ -648,7 +648,7 @@ func (meal *cfgMeal) processOldPLsLocked() {
// priority level continues to get a concurrency // priority level continues to get a concurrency
// allocation determined by all the share values in the // allocation determined by all the share values in the
// regular way. // regular way.
meal.shareSum += float64(plState.pl.Spec.Limited.AssuredConcurrencyShares) meal.shareSum += float64(plState.pl.Spec.Limited.NominalConcurrencyShares)
} }
meal.haveExemptPL = meal.haveExemptPL || plName == flowcontrol.PriorityLevelConfigurationNameExempt meal.haveExemptPL = meal.haveExemptPL || plName == flowcontrol.PriorityLevelConfigurationNameExempt
meal.haveCatchAllPL = meal.haveCatchAllPL || plName == flowcontrol.PriorityLevelConfigurationNameCatchAll meal.haveCatchAllPL = meal.haveCatchAllPL || plName == flowcontrol.PriorityLevelConfigurationNameCatchAll
@ -669,7 +669,7 @@ func (meal *cfgMeal) finishQueueSetReconfigsLocked() {
// The use of math.Ceil here means that the results might sum // The use of math.Ceil here means that the results might sum
// to a little more than serverConcurrencyLimit but the // to a little more than serverConcurrencyLimit but the
// difference will be negligible. // difference will be negligible.
concurrencyLimit := int(math.Ceil(float64(meal.cfgCtlr.serverConcurrencyLimit) * float64(plState.pl.Spec.Limited.AssuredConcurrencyShares) / meal.shareSum)) concurrencyLimit := int(math.Ceil(float64(meal.cfgCtlr.serverConcurrencyLimit) * float64(plState.pl.Spec.Limited.NominalConcurrencyShares) / meal.shareSum))
metrics.UpdateSharedConcurrencyLimit(plName, concurrencyLimit) metrics.UpdateSharedConcurrencyLimit(plName, concurrencyLimit)
meal.maxExecutingRequests += concurrencyLimit meal.maxExecutingRequests += concurrencyLimit
var waitLimit int var waitLimit int
@ -679,9 +679,9 @@ func (meal *cfgMeal) finishQueueSetReconfigsLocked() {
meal.maxWaitingRequests += waitLimit meal.maxWaitingRequests += waitLimit
if plState.queues == nil { if plState.queues == nil {
klog.V(5).Infof("Introducing queues for priority level %q: config=%s, concurrencyLimit=%d, quiescing=%v (shares=%v, shareSum=%v)", plName, fcfmt.Fmt(plState.pl.Spec), concurrencyLimit, plState.quiescing, plState.pl.Spec.Limited.AssuredConcurrencyShares, meal.shareSum) klog.V(5).Infof("Introducing queues for priority level %q: config=%s, concurrencyLimit=%d, quiescing=%v (shares=%v, shareSum=%v)", plName, fcfmt.Fmt(plState.pl.Spec), concurrencyLimit, plState.quiescing, plState.pl.Spec.Limited.NominalConcurrencyShares, meal.shareSum)
} else { } else {
klog.V(5).Infof("Retaining queues for priority level %q: config=%s, concurrencyLimit=%d, quiescing=%v, numPending=%d (shares=%v, shareSum=%v)", plName, fcfmt.Fmt(plState.pl.Spec), concurrencyLimit, plState.quiescing, plState.numPending, plState.pl.Spec.Limited.AssuredConcurrencyShares, meal.shareSum) klog.V(5).Infof("Retaining queues for priority level %q: config=%s, concurrencyLimit=%d, quiescing=%v, numPending=%d (shares=%v, shareSum=%v)", plName, fcfmt.Fmt(plState.pl.Spec), concurrencyLimit, plState.quiescing, plState.numPending, plState.pl.Spec.Limited.NominalConcurrencyShares, meal.shareSum)
} }
plState.queues = plState.qsCompleter.Complete(fq.DispatchingConfig{ConcurrencyLimit: concurrencyLimit}) plState.queues = plState.qsCompleter.Complete(fq.DispatchingConfig{ConcurrencyLimit: concurrencyLimit})
} }
@ -781,7 +781,7 @@ func (meal *cfgMeal) imaginePL(proto *flowcontrol.PriorityLevelConfiguration, re
execSeatsObs: execSeatsObs, execSeatsObs: execSeatsObs,
} }
if proto.Spec.Limited != nil { if proto.Spec.Limited != nil {
meal.shareSum += float64(proto.Spec.Limited.AssuredConcurrencyShares) meal.shareSum += float64(proto.Spec.Limited.NominalConcurrencyShares)
} }
} }

View File

@ -32,8 +32,8 @@ import (
"k8s.io/klog/v2" "k8s.io/klog/v2"
"k8s.io/utils/clock" "k8s.io/utils/clock"
flowcontrol "k8s.io/api/flowcontrol/v1beta2" flowcontrol "k8s.io/api/flowcontrol/v1beta3"
flowcontrolclient "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2" flowcontrolclient "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta3"
) )
// ConfigConsumerAsFieldManager is how the config consuminng // ConfigConsumerAsFieldManager is how the config consuminng
@ -83,7 +83,7 @@ type Interface interface {
// New creates a new instance to implement API priority and fairness // New creates a new instance to implement API priority and fairness
func New( func New(
informerFactory kubeinformers.SharedInformerFactory, informerFactory kubeinformers.SharedInformerFactory,
flowcontrolClient flowcontrolclient.FlowcontrolV1beta2Interface, flowcontrolClient flowcontrolclient.FlowcontrolV1beta3Interface,
serverConcurrencyLimit int, serverConcurrencyLimit int,
requestWaitLimit time.Duration, requestWaitLimit time.Duration,
) Interface { ) Interface {
@ -129,7 +129,7 @@ type TestableConfig struct {
InformerFactory kubeinformers.SharedInformerFactory InformerFactory kubeinformers.SharedInformerFactory
// FlowcontrolClient to use for manipulating config objects // FlowcontrolClient to use for manipulating config objects
FlowcontrolClient flowcontrolclient.FlowcontrolV1beta2Interface FlowcontrolClient flowcontrolclient.FlowcontrolV1beta3Interface
// ServerConcurrencyLimit for the controller to enforce // ServerConcurrencyLimit for the controller to enforce
ServerConcurrencyLimit int ServerConcurrencyLimit int

View File

@ -26,7 +26,7 @@ import (
"testing" "testing"
"time" "time"
flowcontrol "k8s.io/api/flowcontrol/v1beta2" flowcontrol "k8s.io/api/flowcontrol/v1beta3"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apimachinery/pkg/util/wait" "k8s.io/apimachinery/pkg/util/wait"
@ -38,7 +38,7 @@ import (
fcrequest "k8s.io/apiserver/pkg/util/flowcontrol/request" fcrequest "k8s.io/apiserver/pkg/util/flowcontrol/request"
"k8s.io/client-go/informers" "k8s.io/client-go/informers"
clientsetfake "k8s.io/client-go/kubernetes/fake" clientsetfake "k8s.io/client-go/kubernetes/fake"
fcclient "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta2" fcclient "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta3"
"k8s.io/klog/v2" "k8s.io/klog/v2"
"k8s.io/utils/clock" "k8s.io/utils/clock"
) )
@ -70,7 +70,7 @@ func (cfgCtlr *configController) hasPriorityLevelState(plName string) bool {
type ctlrTestState struct { type ctlrTestState struct {
t *testing.T t *testing.T
cfgCtlr *configController cfgCtlr *configController
fcIfc fcclient.FlowcontrolV1beta2Interface fcIfc fcclient.FlowcontrolV1beta3Interface
existingPLs map[string]*flowcontrol.PriorityLevelConfiguration existingPLs map[string]*flowcontrol.PriorityLevelConfiguration
existingFSs map[string]*flowcontrol.FlowSchema existingFSs map[string]*flowcontrol.FlowSchema
heldRequestsMap map[string][]heldRequest heldRequestsMap map[string][]heldRequest
@ -241,7 +241,7 @@ func TestConfigConsumer(t *testing.T) {
t.Run(fmt.Sprintf("trial%d:", i), func(t *testing.T) { t.Run(fmt.Sprintf("trial%d:", i), func(t *testing.T) {
clientset := clientsetfake.NewSimpleClientset() clientset := clientsetfake.NewSimpleClientset()
informerFactory := informers.NewSharedInformerFactory(clientset, 0) informerFactory := informers.NewSharedInformerFactory(clientset, 0)
flowcontrolClient := clientset.FlowcontrolV1beta2() flowcontrolClient := clientset.FlowcontrolV1beta3()
cts := &ctlrTestState{t: t, cts := &ctlrTestState{t: t,
fcIfc: flowcontrolClient, fcIfc: flowcontrolClient,
existingFSs: map[string]*flowcontrol.FlowSchema{}, existingFSs: map[string]*flowcontrol.FlowSchema{},
@ -363,7 +363,7 @@ func TestAPFControllerWithGracefulShutdown(t *testing.T) {
Spec: flowcontrol.PriorityLevelConfigurationSpec{ Spec: flowcontrol.PriorityLevelConfigurationSpec{
Type: flowcontrol.PriorityLevelEnablementLimited, Type: flowcontrol.PriorityLevelEnablementLimited,
Limited: &flowcontrol.LimitedPriorityLevelConfiguration{ Limited: &flowcontrol.LimitedPriorityLevelConfiguration{
AssuredConcurrencyShares: 10, NominalConcurrencyShares: 10,
LimitResponse: flowcontrol.LimitResponse{ LimitResponse: flowcontrol.LimitResponse{
Type: flowcontrol.LimitResponseTypeReject, Type: flowcontrol.LimitResponseTypeReject,
}, },
@ -373,7 +373,7 @@ func TestAPFControllerWithGracefulShutdown(t *testing.T) {
clientset := clientsetfake.NewSimpleClientset(fs, pl) clientset := clientsetfake.NewSimpleClientset(fs, pl)
informerFactory := informers.NewSharedInformerFactory(clientset, time.Second) informerFactory := informers.NewSharedInformerFactory(clientset, time.Second)
flowcontrolClient := clientset.FlowcontrolV1beta2() flowcontrolClient := clientset.FlowcontrolV1beta3()
cts := &ctlrTestState{t: t, cts := &ctlrTestState{t: t,
fcIfc: flowcontrolClient, fcIfc: flowcontrolClient,
existingFSs: map[string]*flowcontrol.FlowSchema{}, existingFSs: map[string]*flowcontrol.FlowSchema{},

View File

@ -21,7 +21,7 @@ import (
"encoding/json" "encoding/json"
"fmt" "fmt"
flowcontrol "k8s.io/api/flowcontrol/v1beta2" flowcontrol "k8s.io/api/flowcontrol/v1beta3"
"k8s.io/apiserver/pkg/authentication/user" "k8s.io/apiserver/pkg/authentication/user"
"k8s.io/apiserver/pkg/endpoints/request" "k8s.io/apiserver/pkg/endpoints/request"
) )
@ -93,7 +93,7 @@ func FmtPriorityLevelConfiguration(pl *flowcontrol.PriorityLevelConfiguration) s
return "nil" return "nil"
} }
var buf bytes.Buffer var buf bytes.Buffer
buf.WriteString(fmt.Sprintf("&flowcontrolv1beta1.PriorityLevelConfiguration{ObjectMeta: %#+v, Spec: ", buf.WriteString(fmt.Sprintf("&flowcontrolv1beta3.PriorityLevelConfiguration{ObjectMeta: %#+v, Spec: ",
pl.ObjectMeta)) pl.ObjectMeta))
BufferPriorityLevelConfigurationSpec(&buf, &pl.Spec) BufferPriorityLevelConfigurationSpec(&buf, &pl.Spec)
buf.WriteString(fmt.Sprintf(", Status: %#+v}", pl.Status)) buf.WriteString(fmt.Sprintf(", Status: %#+v}", pl.Status))
@ -111,9 +111,9 @@ func FmtPriorityLevelConfigurationSpec(plSpec *flowcontrol.PriorityLevelConfigur
// BufferPriorityLevelConfigurationSpec writes a golang source // BufferPriorityLevelConfigurationSpec writes a golang source
// expression for the given value to the given buffer // expression for the given value to the given buffer
func BufferPriorityLevelConfigurationSpec(buf *bytes.Buffer, plSpec *flowcontrol.PriorityLevelConfigurationSpec) { func BufferPriorityLevelConfigurationSpec(buf *bytes.Buffer, plSpec *flowcontrol.PriorityLevelConfigurationSpec) {
buf.WriteString(fmt.Sprintf("flowcontrolv1beta1.PriorityLevelConfigurationSpec{Type: %#v", plSpec.Type)) buf.WriteString(fmt.Sprintf("flowcontrolv1beta3.PriorityLevelConfigurationSpec{Type: %#v", plSpec.Type))
if plSpec.Limited != nil { if plSpec.Limited != nil {
buf.WriteString(fmt.Sprintf(", Limited: &flowcontrol.LimitedPriorityLevelConfiguration{AssuredConcurrencyShares:%d, LimitResponse:flowcontrol.LimitResponse{Type:%#v", plSpec.Limited.AssuredConcurrencyShares, plSpec.Limited.LimitResponse.Type)) buf.WriteString(fmt.Sprintf(", Limited: &flowcontrol.LimitedPriorityLevelConfiguration{NominalConcurrencyShares:%d, LimitResponse:flowcontrol.LimitResponse{Type:%#v", plSpec.Limited.NominalConcurrencyShares, plSpec.Limited.LimitResponse.Type))
if plSpec.Limited.LimitResponse.Queuing != nil { if plSpec.Limited.LimitResponse.Queuing != nil {
buf.WriteString(fmt.Sprintf(", Queuing:&%#+v", *plSpec.Limited.LimitResponse.Queuing)) buf.WriteString(fmt.Sprintf(", Queuing:&%#+v", *plSpec.Limited.LimitResponse.Queuing))
} }
@ -128,7 +128,7 @@ func FmtFlowSchema(fs *flowcontrol.FlowSchema) string {
return "nil" return "nil"
} }
var buf bytes.Buffer var buf bytes.Buffer
buf.WriteString(fmt.Sprintf("&flowcontrolv1beta1.FlowSchema{ObjectMeta: %#+v, Spec: ", buf.WriteString(fmt.Sprintf("&flowcontrolv1beta3.FlowSchema{ObjectMeta: %#+v, Spec: ",
fs.ObjectMeta)) fs.ObjectMeta))
BufferFlowSchemaSpec(&buf, &fs.Spec) BufferFlowSchemaSpec(&buf, &fs.Spec)
buf.WriteString(fmt.Sprintf(", Status: %#+v}", fs.Status)) buf.WriteString(fmt.Sprintf(", Status: %#+v}", fs.Status))
@ -146,7 +146,7 @@ func FmtFlowSchemaSpec(fsSpec *flowcontrol.FlowSchemaSpec) string {
// BufferFlowSchemaSpec writes a golang source expression for the // BufferFlowSchemaSpec writes a golang source expression for the
// given value to the given buffer // given value to the given buffer
func BufferFlowSchemaSpec(buf *bytes.Buffer, fsSpec *flowcontrol.FlowSchemaSpec) { func BufferFlowSchemaSpec(buf *bytes.Buffer, fsSpec *flowcontrol.FlowSchemaSpec) {
buf.WriteString(fmt.Sprintf("flowcontrolv1beta1.FlowSchemaSpec{PriorityLevelConfiguration: %#+v, MatchingPrecedence: %d, DistinguisherMethod: ", buf.WriteString(fmt.Sprintf("flowcontrolv1beta3.FlowSchemaSpec{PriorityLevelConfiguration: %#+v, MatchingPrecedence: %d, DistinguisherMethod: ",
fsSpec.PriorityLevelConfiguration, fsSpec.PriorityLevelConfiguration,
fsSpec.MatchingPrecedence)) fsSpec.MatchingPrecedence))
if fsSpec.DistinguisherMethod == nil { if fsSpec.DistinguisherMethod == nil {
@ -166,7 +166,7 @@ func BufferFlowSchemaSpec(buf *bytes.Buffer, fsSpec *flowcontrol.FlowSchemaSpec)
// FmtPolicyRulesWithSubjects produces a golang source expression of the value. // FmtPolicyRulesWithSubjects produces a golang source expression of the value.
func FmtPolicyRulesWithSubjects(rule flowcontrol.PolicyRulesWithSubjects) string { func FmtPolicyRulesWithSubjects(rule flowcontrol.PolicyRulesWithSubjects) string {
return "flowcontrolv1beta1.PolicyRulesWithSubjects" + FmtPolicyRulesWithSubjectsSlim(rule) return "flowcontrolv1beta3.PolicyRulesWithSubjects" + FmtPolicyRulesWithSubjectsSlim(rule)
} }
// FmtPolicyRulesWithSubjectsSlim produces a golang source expression // FmtPolicyRulesWithSubjectsSlim produces a golang source expression
@ -182,7 +182,7 @@ func FmtPolicyRulesWithSubjectsSlim(rule flowcontrol.PolicyRulesWithSubjects) st
// expression for the given value to the given buffer but excludes the // expression for the given value to the given buffer but excludes the
// leading type name // leading type name
func BufferFmtPolicyRulesWithSubjectsSlim(buf *bytes.Buffer, rule flowcontrol.PolicyRulesWithSubjects) { func BufferFmtPolicyRulesWithSubjectsSlim(buf *bytes.Buffer, rule flowcontrol.PolicyRulesWithSubjects) {
buf.WriteString("{Subjects: []flowcontrolv1beta1.Subject{") buf.WriteString("{Subjects: []flowcontrolv1beta3.Subject{")
for jdx, subj := range rule.Subjects { for jdx, subj := range rule.Subjects {
if jdx > 0 { if jdx > 0 {
buf.WriteString(", ") buf.WriteString(", ")

View File

@ -23,7 +23,7 @@ import (
"testing" "testing"
"time" "time"
flowcontrol "k8s.io/api/flowcontrol/v1beta2" flowcontrol "k8s.io/api/flowcontrol/v1beta3"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/sets"
fcboot "k8s.io/apiserver/pkg/apis/flowcontrol/bootstrap" fcboot "k8s.io/apiserver/pkg/apis/flowcontrol/bootstrap"
@ -45,7 +45,7 @@ func genPL(rng *rand.Rand, name string) *flowcontrol.PriorityLevelConfiguration
Spec: flowcontrol.PriorityLevelConfigurationSpec{ Spec: flowcontrol.PriorityLevelConfigurationSpec{
Type: flowcontrol.PriorityLevelEnablementLimited, Type: flowcontrol.PriorityLevelEnablementLimited,
Limited: &flowcontrol.LimitedPriorityLevelConfiguration{ Limited: &flowcontrol.LimitedPriorityLevelConfiguration{
AssuredConcurrencyShares: rng.Int31n(100) + 1, NominalConcurrencyShares: rng.Int31n(100) + 1,
LimitResponse: flowcontrol.LimitResponse{ LimitResponse: flowcontrol.LimitResponse{
Type: flowcontrol.LimitResponseTypeReject}}}} Type: flowcontrol.LimitResponseTypeReject}}}}
if rng.Float32() < 0.95 { if rng.Float32() < 0.95 {

View File

@ -21,7 +21,7 @@ import (
"math/rand" "math/rand"
"testing" "testing"
flowcontrol "k8s.io/api/flowcontrol/v1beta2" flowcontrol "k8s.io/api/flowcontrol/v1beta3"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/sets" "k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apiserver/pkg/authentication/user" "k8s.io/apiserver/pkg/authentication/user"

View File

@ -23,7 +23,7 @@ import (
"time" "time"
"github.com/google/go-cmp/cmp" "github.com/google/go-cmp/cmp"
flowcontrol "k8s.io/api/flowcontrol/v1beta2" flowcontrol "k8s.io/api/flowcontrol/v1beta3"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
) )

View File

@ -19,7 +19,7 @@ package flowcontrol
import ( import (
"strings" "strings"
flowcontrol "k8s.io/api/flowcontrol/v1beta2" flowcontrol "k8s.io/api/flowcontrol/v1beta3"
"k8s.io/apiserver/pkg/authentication/serviceaccount" "k8s.io/apiserver/pkg/authentication/serviceaccount"
"k8s.io/apiserver/pkg/authentication/user" "k8s.io/apiserver/pkg/authentication/user"
"k8s.io/apiserver/pkg/endpoints/request" "k8s.io/apiserver/pkg/endpoints/request"