mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-28 05:57:25 +00:00
apf: update e2e test to use v1beta2
This commit is contained in:
parent
2f19f8c2df
commit
d99497ef6d
@ -19,7 +19,7 @@ package apihelpers
|
|||||||
import (
|
import (
|
||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
flowcontrol "k8s.io/api/flowcontrol/v1beta1"
|
flowcontrol "k8s.io/api/flowcontrol/v1beta2"
|
||||||
)
|
)
|
||||||
|
|
||||||
// SetFlowSchemaCondition sets conditions.
|
// SetFlowSchemaCondition sets conditions.
|
||||||
|
@ -31,7 +31,7 @@ import (
|
|||||||
"github.com/prometheus/common/expfmt"
|
"github.com/prometheus/common/expfmt"
|
||||||
"github.com/prometheus/common/model"
|
"github.com/prometheus/common/model"
|
||||||
|
|
||||||
flowcontrol "k8s.io/api/flowcontrol/v1beta1"
|
flowcontrol "k8s.io/api/flowcontrol/v1beta2"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
"k8s.io/apiserver/pkg/util/apihelpers"
|
"k8s.io/apiserver/pkg/util/apihelpers"
|
||||||
@ -255,7 +255,7 @@ var _ = SIGDescribe("API priority and fairness", func() {
|
|||||||
// createPriorityLevel creates a priority level with the provided assured
|
// createPriorityLevel creates a priority level with the provided assured
|
||||||
// concurrency share.
|
// concurrency share.
|
||||||
func createPriorityLevel(f *framework.Framework, priorityLevelName string, assuredConcurrencyShares int32) (*flowcontrol.PriorityLevelConfiguration, func()) {
|
func createPriorityLevel(f *framework.Framework, priorityLevelName string, assuredConcurrencyShares int32) (*flowcontrol.PriorityLevelConfiguration, func()) {
|
||||||
createdPriorityLevel, err := f.ClientSet.FlowcontrolV1beta1().PriorityLevelConfigurations().Create(
|
createdPriorityLevel, err := f.ClientSet.FlowcontrolV1beta2().PriorityLevelConfigurations().Create(
|
||||||
context.TODO(),
|
context.TODO(),
|
||||||
&flowcontrol.PriorityLevelConfiguration{
|
&flowcontrol.PriorityLevelConfiguration{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
@ -274,7 +274,7 @@ func createPriorityLevel(f *framework.Framework, priorityLevelName string, assur
|
|||||||
metav1.CreateOptions{})
|
metav1.CreateOptions{})
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
return createdPriorityLevel, func() {
|
return createdPriorityLevel, func() {
|
||||||
framework.ExpectNoError(f.ClientSet.FlowcontrolV1beta1().PriorityLevelConfigurations().Delete(context.TODO(), priorityLevelName, metav1.DeleteOptions{}))
|
framework.ExpectNoError(f.ClientSet.FlowcontrolV1beta2().PriorityLevelConfigurations().Delete(context.TODO(), priorityLevelName, metav1.DeleteOptions{}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -322,7 +322,7 @@ func createFlowSchema(f *framework.Framework, flowSchemaName string, matchingPre
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
createdFlowSchema, err := f.ClientSet.FlowcontrolV1beta1().FlowSchemas().Create(
|
createdFlowSchema, err := f.ClientSet.FlowcontrolV1beta2().FlowSchemas().Create(
|
||||||
context.TODO(),
|
context.TODO(),
|
||||||
&flowcontrol.FlowSchema{
|
&flowcontrol.FlowSchema{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
@ -352,7 +352,7 @@ func createFlowSchema(f *framework.Framework, flowSchemaName string, matchingPre
|
|||||||
metav1.CreateOptions{})
|
metav1.CreateOptions{})
|
||||||
framework.ExpectNoError(err)
|
framework.ExpectNoError(err)
|
||||||
return createdFlowSchema, func() {
|
return createdFlowSchema, func() {
|
||||||
framework.ExpectNoError(f.ClientSet.FlowcontrolV1beta1().FlowSchemas().Delete(context.TODO(), flowSchemaName, metav1.DeleteOptions{}))
|
framework.ExpectNoError(f.ClientSet.FlowcontrolV1beta2().FlowSchemas().Delete(context.TODO(), flowSchemaName, metav1.DeleteOptions{}))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -362,7 +362,7 @@ func createFlowSchema(f *framework.Framework, flowSchemaName string, matchingPre
|
|||||||
// schema status, and (2) metrics. The function times out after 30 seconds.
|
// schema status, and (2) metrics. The function times out after 30 seconds.
|
||||||
func waitForSteadyState(f *framework.Framework, flowSchemaName string, priorityLevelName string) {
|
func waitForSteadyState(f *framework.Framework, flowSchemaName string, priorityLevelName string) {
|
||||||
framework.ExpectNoError(wait.Poll(time.Second, 30*time.Second, func() (bool, error) {
|
framework.ExpectNoError(wait.Poll(time.Second, 30*time.Second, func() (bool, error) {
|
||||||
fs, err := f.ClientSet.FlowcontrolV1beta1().FlowSchemas().Get(context.TODO(), flowSchemaName, metav1.GetOptions{})
|
fs, err := f.ClientSet.FlowcontrolV1beta2().FlowSchemas().Get(context.TODO(), flowSchemaName, metav1.GetOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ import (
|
|||||||
"github.com/prometheus/common/expfmt"
|
"github.com/prometheus/common/expfmt"
|
||||||
"github.com/prometheus/common/model"
|
"github.com/prometheus/common/model"
|
||||||
|
|
||||||
flowcontrol "k8s.io/api/flowcontrol/v1beta1"
|
flowcontrol "k8s.io/api/flowcontrol/v1beta2"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
"k8s.io/apimachinery/pkg/util/wait"
|
"k8s.io/apimachinery/pkg/util/wait"
|
||||||
@ -235,7 +235,7 @@ func getRequestCountOfPriorityLevel(c clientset.Interface) (map[string]int, map[
|
|||||||
}
|
}
|
||||||
|
|
||||||
func createPriorityLevelAndBindingFlowSchemaForUser(c clientset.Interface, username string, concurrencyShares, queuelength int) (*flowcontrol.PriorityLevelConfiguration, *flowcontrol.FlowSchema, error) {
|
func createPriorityLevelAndBindingFlowSchemaForUser(c clientset.Interface, username string, concurrencyShares, queuelength int) (*flowcontrol.PriorityLevelConfiguration, *flowcontrol.FlowSchema, error) {
|
||||||
pl, err := c.FlowcontrolV1beta1().PriorityLevelConfigurations().Create(context.Background(), &flowcontrol.PriorityLevelConfiguration{
|
pl, err := c.FlowcontrolV1beta2().PriorityLevelConfigurations().Create(context.Background(), &flowcontrol.PriorityLevelConfiguration{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: username,
|
Name: username,
|
||||||
},
|
},
|
||||||
@ -257,7 +257,7 @@ func createPriorityLevelAndBindingFlowSchemaForUser(c clientset.Interface, usern
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
fs, err := c.FlowcontrolV1beta1().FlowSchemas().Create(context.TODO(), &flowcontrol.FlowSchema{
|
fs, err := c.FlowcontrolV1beta2().FlowSchemas().Create(context.TODO(), &flowcontrol.FlowSchema{
|
||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Name: username,
|
Name: username,
|
||||||
},
|
},
|
||||||
@ -297,7 +297,7 @@ func createPriorityLevelAndBindingFlowSchemaForUser(c clientset.Interface, usern
|
|||||||
}
|
}
|
||||||
|
|
||||||
return pl, fs, wait.Poll(time.Second, timeout, func() (bool, error) {
|
return pl, fs, wait.Poll(time.Second, timeout, func() (bool, error) {
|
||||||
fs, err := c.FlowcontrolV1beta1().FlowSchemas().Get(context.TODO(), username, metav1.GetOptions{})
|
fs, err := c.FlowcontrolV1beta2().FlowSchemas().Get(context.TODO(), username, metav1.GetOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
flowcontrol "k8s.io/api/flowcontrol/v1beta1"
|
flowcontrol "k8s.io/api/flowcontrol/v1beta2"
|
||||||
"k8s.io/apimachinery/pkg/util/clock"
|
"k8s.io/apimachinery/pkg/util/clock"
|
||||||
genericfeatures "k8s.io/apiserver/pkg/features"
|
genericfeatures "k8s.io/apiserver/pkg/features"
|
||||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||||
@ -95,7 +95,7 @@ func (ft *fightTest) createMainInformer() {
|
|||||||
myConfig = rest.AddUserAgent(myConfig, "audience")
|
myConfig = rest.AddUserAgent(myConfig, "audience")
|
||||||
myClientset := clientset.NewForConfigOrDie(myConfig)
|
myClientset := clientset.NewForConfigOrDie(myConfig)
|
||||||
informerFactory := informers.NewSharedInformerFactory(myClientset, 0)
|
informerFactory := informers.NewSharedInformerFactory(myClientset, 0)
|
||||||
inf := informerFactory.Flowcontrol().V1beta1().FlowSchemas().Informer()
|
inf := informerFactory.Flowcontrol().V1beta2().FlowSchemas().Informer()
|
||||||
inf.AddEventHandler(cache.ResourceEventHandlerFuncs{
|
inf.AddEventHandler(cache.ResourceEventHandlerFuncs{
|
||||||
AddFunc: func(obj interface{}) {
|
AddFunc: func(obj interface{}) {
|
||||||
fs := obj.(*flowcontrol.FlowSchema)
|
fs := obj.(*flowcontrol.FlowSchema)
|
||||||
@ -123,7 +123,7 @@ func (ft *fightTest) createController(invert bool, i int) {
|
|||||||
myConfig := rest.CopyConfig(ft.loopbackConfig)
|
myConfig := rest.CopyConfig(ft.loopbackConfig)
|
||||||
myConfig = rest.AddUserAgent(myConfig, fieldMgr)
|
myConfig = rest.AddUserAgent(myConfig, fieldMgr)
|
||||||
myClientset := clientset.NewForConfigOrDie(myConfig)
|
myClientset := clientset.NewForConfigOrDie(myConfig)
|
||||||
fcIfc := myClientset.FlowcontrolV1beta1()
|
fcIfc := myClientset.FlowcontrolV1beta2()
|
||||||
informerFactory := informers.NewSharedInformerFactory(myClientset, 0)
|
informerFactory := informers.NewSharedInformerFactory(myClientset, 0)
|
||||||
foundToDangling := func(found bool) bool { return !found }
|
foundToDangling := func(found bool) bool { return !found }
|
||||||
if invert {
|
if invert {
|
||||||
|
@ -199,7 +199,7 @@ func startAPIServerOrDie(controlPlaneConfig *controlplane.Config, incomingServer
|
|||||||
if utilfeature.DefaultFeatureGate.Enabled(genericfeatures.APIPriorityAndFairness) {
|
if utilfeature.DefaultFeatureGate.Enabled(genericfeatures.APIPriorityAndFairness) {
|
||||||
controlPlaneConfig.GenericConfig.FlowControl = utilflowcontrol.New(
|
controlPlaneConfig.GenericConfig.FlowControl = utilflowcontrol.New(
|
||||||
controlPlaneConfig.ExtraConfig.VersionedInformers,
|
controlPlaneConfig.ExtraConfig.VersionedInformers,
|
||||||
clientset.FlowcontrolV1beta1(),
|
clientset.FlowcontrolV1beta2(),
|
||||||
controlPlaneConfig.GenericConfig.MaxRequestsInFlight+controlPlaneConfig.GenericConfig.MaxMutatingRequestsInFlight,
|
controlPlaneConfig.GenericConfig.MaxRequestsInFlight+controlPlaneConfig.GenericConfig.MaxMutatingRequestsInFlight,
|
||||||
controlPlaneConfig.GenericConfig.RequestTimeout/4,
|
controlPlaneConfig.GenericConfig.RequestTimeout/4,
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user