mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 15:25:57 +00:00
apiserver: update apf tests to use v1beta3
This commit is contained in:
parent
6ac0e87979
commit
6edc251686
@ -19,7 +19,7 @@ package apihelpers
|
||||
import (
|
||||
"sort"
|
||||
|
||||
flowcontrol "k8s.io/api/flowcontrol/v1beta2"
|
||||
flowcontrol "k8s.io/api/flowcontrol/v1beta3"
|
||||
)
|
||||
|
||||
// SetFlowSchemaCondition sets conditions.
|
||||
|
@ -31,7 +31,7 @@ import (
|
||||
"github.com/prometheus/common/expfmt"
|
||||
"github.com/prometheus/common/model"
|
||||
|
||||
flowcontrol "k8s.io/api/flowcontrol/v1beta2"
|
||||
flowcontrol "k8s.io/api/flowcontrol/v1beta3"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
"k8s.io/apiserver/pkg/util/apihelpers"
|
||||
@ -257,7 +257,7 @@ var _ = SIGDescribe("API priority and fairness", func() {
|
||||
// createPriorityLevel creates a priority level with the provided assured
|
||||
// concurrency share.
|
||||
func createPriorityLevel(f *framework.Framework, priorityLevelName string, assuredConcurrencyShares int32) (*flowcontrol.PriorityLevelConfiguration, func()) {
|
||||
createdPriorityLevel, err := f.ClientSet.FlowcontrolV1beta2().PriorityLevelConfigurations().Create(
|
||||
createdPriorityLevel, err := f.ClientSet.FlowcontrolV1beta3().PriorityLevelConfigurations().Create(
|
||||
context.TODO(),
|
||||
&flowcontrol.PriorityLevelConfiguration{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
@ -276,7 +276,7 @@ func createPriorityLevel(f *framework.Framework, priorityLevelName string, assur
|
||||
metav1.CreateOptions{})
|
||||
framework.ExpectNoError(err)
|
||||
return createdPriorityLevel, func() {
|
||||
framework.ExpectNoError(f.ClientSet.FlowcontrolV1beta2().PriorityLevelConfigurations().Delete(context.TODO(), priorityLevelName, metav1.DeleteOptions{}))
|
||||
framework.ExpectNoError(f.ClientSet.FlowcontrolV1beta3().PriorityLevelConfigurations().Delete(context.TODO(), priorityLevelName, metav1.DeleteOptions{}))
|
||||
}
|
||||
}
|
||||
|
||||
@ -324,7 +324,7 @@ func createFlowSchema(f *framework.Framework, flowSchemaName string, matchingPre
|
||||
})
|
||||
}
|
||||
|
||||
createdFlowSchema, err := f.ClientSet.FlowcontrolV1beta2().FlowSchemas().Create(
|
||||
createdFlowSchema, err := f.ClientSet.FlowcontrolV1beta3().FlowSchemas().Create(
|
||||
context.TODO(),
|
||||
&flowcontrol.FlowSchema{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
@ -354,7 +354,7 @@ func createFlowSchema(f *framework.Framework, flowSchemaName string, matchingPre
|
||||
metav1.CreateOptions{})
|
||||
framework.ExpectNoError(err)
|
||||
return createdFlowSchema, func() {
|
||||
framework.ExpectNoError(f.ClientSet.FlowcontrolV1beta2().FlowSchemas().Delete(context.TODO(), flowSchemaName, metav1.DeleteOptions{}))
|
||||
framework.ExpectNoError(f.ClientSet.FlowcontrolV1beta3().FlowSchemas().Delete(context.TODO(), flowSchemaName, metav1.DeleteOptions{}))
|
||||
}
|
||||
}
|
||||
|
||||
@ -364,7 +364,7 @@ func createFlowSchema(f *framework.Framework, flowSchemaName string, matchingPre
|
||||
// schema status, and (2) metrics. The function times out after 30 seconds.
|
||||
func waitForSteadyState(f *framework.Framework, flowSchemaName string, priorityLevelName string) {
|
||||
framework.ExpectNoError(wait.Poll(time.Second, 30*time.Second, func() (bool, error) {
|
||||
fs, err := f.ClientSet.FlowcontrolV1beta2().FlowSchemas().Get(context.TODO(), flowSchemaName, metav1.GetOptions{})
|
||||
fs, err := f.ClientSet.FlowcontrolV1beta3().FlowSchemas().Get(context.TODO(), flowSchemaName, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ import (
|
||||
"github.com/prometheus/common/expfmt"
|
||||
"github.com/prometheus/common/model"
|
||||
|
||||
flowcontrol "k8s.io/api/flowcontrol/v1beta2"
|
||||
flowcontrol "k8s.io/api/flowcontrol/v1beta3"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
genericfeatures "k8s.io/apiserver/pkg/features"
|
||||
@ -230,7 +230,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) {
|
||||
pl, err := c.FlowcontrolV1beta2().PriorityLevelConfigurations().Create(context.Background(), &flowcontrol.PriorityLevelConfiguration{
|
||||
pl, err := c.FlowcontrolV1beta3().PriorityLevelConfigurations().Create(context.Background(), &flowcontrol.PriorityLevelConfiguration{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: username,
|
||||
},
|
||||
@ -252,7 +252,7 @@ func createPriorityLevelAndBindingFlowSchemaForUser(c clientset.Interface, usern
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
fs, err := c.FlowcontrolV1beta2().FlowSchemas().Create(context.TODO(), &flowcontrol.FlowSchema{
|
||||
fs, err := c.FlowcontrolV1beta3().FlowSchemas().Create(context.TODO(), &flowcontrol.FlowSchema{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: username,
|
||||
},
|
||||
@ -292,7 +292,7 @@ func createPriorityLevelAndBindingFlowSchemaForUser(c clientset.Interface, usern
|
||||
}
|
||||
|
||||
return pl, fs, wait.Poll(time.Second, timeout, func() (bool, error) {
|
||||
fs, err := c.FlowcontrolV1beta2().FlowSchemas().Get(context.TODO(), username, metav1.GetOptions{})
|
||||
fs, err := c.FlowcontrolV1beta3().FlowSchemas().Get(context.TODO(), username, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
flowcontrol "k8s.io/api/flowcontrol/v1beta2"
|
||||
flowcontrol "k8s.io/api/flowcontrol/v1beta3"
|
||||
genericfeatures "k8s.io/apiserver/pkg/features"
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
utilfc "k8s.io/apiserver/pkg/util/flowcontrol"
|
||||
@ -98,7 +98,7 @@ func (ft *fightTest) createMainInformer() {
|
||||
myConfig = rest.AddUserAgent(myConfig, "audience")
|
||||
myClientset := clientset.NewForConfigOrDie(myConfig)
|
||||
informerFactory := informers.NewSharedInformerFactory(myClientset, 0)
|
||||
inf := informerFactory.Flowcontrol().V1beta2().FlowSchemas().Informer()
|
||||
inf := informerFactory.Flowcontrol().V1beta3().FlowSchemas().Informer()
|
||||
inf.AddEventHandler(cache.ResourceEventHandlerFuncs{
|
||||
AddFunc: func(obj interface{}) {
|
||||
fs := obj.(*flowcontrol.FlowSchema)
|
||||
@ -126,7 +126,7 @@ func (ft *fightTest) createController(invert bool, i int) {
|
||||
myConfig := rest.CopyConfig(ft.loopbackConfig)
|
||||
myConfig = rest.AddUserAgent(myConfig, fieldMgr)
|
||||
myClientset := clientset.NewForConfigOrDie(myConfig)
|
||||
fcIfc := myClientset.FlowcontrolV1beta2()
|
||||
fcIfc := myClientset.FlowcontrolV1beta3()
|
||||
informerFactory := informers.NewSharedInformerFactory(myClientset, 0)
|
||||
foundToDangling := func(found bool) bool { return !found }
|
||||
if invert {
|
||||
|
@ -22,14 +22,14 @@ import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
flowcontrol "k8s.io/api/flowcontrol/v1beta2"
|
||||
flowcontrol "k8s.io/api/flowcontrol/v1beta3"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
machinerytypes "k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
fcboot "k8s.io/apiserver/pkg/apis/flowcontrol/bootstrap"
|
||||
genericfeatures "k8s.io/apiserver/pkg/features"
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
flowcontrolapply "k8s.io/client-go/applyconfigurations/flowcontrol/v1beta2"
|
||||
flowcontrolapply "k8s.io/client-go/applyconfigurations/flowcontrol/v1beta3"
|
||||
clientset "k8s.io/client-go/kubernetes"
|
||||
featuregatetesting "k8s.io/component-base/featuregate/testing"
|
||||
"k8s.io/klog/v2"
|
||||
@ -49,7 +49,7 @@ func TestConditionIsolation(t *testing.T) {
|
||||
|
||||
fsOrig := fcboot.SuggestedFlowSchemas[0]
|
||||
t.Logf("Testing Status Condition isolation in FlowSchema %q", fsOrig.Name)
|
||||
fsClient := loopbackClient.FlowcontrolV1beta2().FlowSchemas()
|
||||
fsClient := loopbackClient.FlowcontrolV1beta3().FlowSchemas()
|
||||
var dangleOrig *flowcontrol.FlowSchemaCondition
|
||||
|
||||
wait.PollUntil(time.Second, func() (bool, error) {
|
||||
|
Loading…
Reference in New Issue
Block a user