APF: graduate API and types to beta

Signed-off-by: Adhityaa Chandrasekar <adtac@google.com>
This commit is contained in:
yue9944882 2020-11-04 16:33:14 +08:00 committed by Adhityaa Chandrasekar
parent 5cfce4e5cb
commit 849be447f5
102 changed files with 13116 additions and 474 deletions

File diff suppressed because it is too large Load Diff

View File

@ -64,6 +64,7 @@ tags_values_pkgs = {"openapi-gen": {
"staging/src/k8s.io/api/events/v1beta1",
"staging/src/k8s.io/api/extensions/v1beta1",
"staging/src/k8s.io/api/flowcontrol/v1alpha1",
"staging/src/k8s.io/api/flowcontrol/v1beta1",
"staging/src/k8s.io/api/imagepolicy/v1alpha1",
"staging/src/k8s.io/api/networking/v1",
"staging/src/k8s.io/api/networking/v1beta1",
@ -150,6 +151,7 @@ tags_pkgs_values = {"openapi-gen": {
"staging/src/k8s.io/api/events/v1beta1": ["true"],
"staging/src/k8s.io/api/extensions/v1beta1": ["true"],
"staging/src/k8s.io/api/flowcontrol/v1alpha1": ["true"],
"staging/src/k8s.io/api/flowcontrol/v1beta1": ["true"],
"staging/src/k8s.io/api/imagepolicy/v1alpha1": ["true"],
"staging/src/k8s.io/api/networking/v1": ["true"],
"staging/src/k8s.io/api/networking/v1beta1": ["true"],

View File

@ -283,6 +283,7 @@ var apiVersionPriorities = map[schema.GroupVersion]priority{
{Group: "node.k8s.io", Version: "v1beta1"}: {group: 16300, version: 9},
{Group: "discovery.k8s.io", Version: "v1beta1"}: {group: 16200, version: 12},
{Group: "discovery.k8s.io", Version: "v1alpha1"}: {group: 16200, version: 9},
{Group: "flowcontrol.apiserver.k8s.io", Version: "v1beta1"}: {group: 16100, version: 12},
{Group: "flowcontrol.apiserver.k8s.io", Version: "v1alpha1"}: {group: 16100, version: 9},
{Group: "internal.apiserver.k8s.io", Version: "v1alpha1"}: {group: 16000, version: 9},
// Append a new group to the end of the list if unsure.

View File

@ -133,17 +133,17 @@ func validateTokenRequest(options *ServerRunOptions) []error {
func validateAPIPriorityAndFairness(options *ServerRunOptions) []error {
if utilfeature.DefaultFeatureGate.Enabled(genericfeatures.APIPriorityAndFairness) && options.GenericServerRunOptions.EnablePriorityAndFairness {
// We need the alpha API enabled. There are only a few ways to turn it on
// If none of the following runtime config options are specified, APF is
// assumed to be turned on.
enabledAPIString := options.APIEnablement.RuntimeConfig.String()
switch {
case strings.Contains(enabledAPIString, "api/all=true"):
testConfigs := []string{"flowcontrol.apiserver.k8s.io/v1beta1", "api/beta", "api/all"} // in the order of precedence
for _, testConfig := range testConfigs {
if strings.Contains(enabledAPIString, fmt.Sprintf("%s=false", testConfig)) {
return []error{fmt.Errorf("%s=false conflicts with APIPriorityAndFairness feature gate", testConfig)}
}
if strings.Contains(enabledAPIString, fmt.Sprintf("%s=true", testConfig)) {
return nil
case strings.Contains(enabledAPIString, "api/alpha=true"):
return nil
case strings.Contains(enabledAPIString, "flowcontrol.apiserver.k8s.io/v1alpha1=true"):
return nil
default:
return []error{fmt.Errorf("enabling APIPriorityAndFairness requires --runtime-confg=flowcontrol.apiserver.k8s.io/v1alpha1=true to enable the required API")}
}
}
}

View File

@ -586,7 +586,7 @@ func BuildAuthorizer(s *options.ServerRunOptions, EgressSelector *egressselector
func BuildPriorityAndFairness(s *options.ServerRunOptions, extclient clientgoclientset.Interface, versionedInformer clientgoinformers.SharedInformerFactory) utilflowcontrol.Interface {
return utilflowcontrol.New(
versionedInformer,
extclient.FlowcontrolV1alpha1(),
extclient.FlowcontrolV1beta1(),
s.GenericServerRunOptions.MaxRequestsInFlight+s.GenericServerRunOptions.MaxMutatingRequestsInFlight,
s.GenericServerRunOptions.RequestTimeout/4,
)

View File

@ -30,6 +30,7 @@ pkg/apis/events/v1
pkg/apis/events/v1beta1
pkg/apis/extensions/v1beta1
pkg/apis/flowcontrol/v1alpha1
pkg/apis/flowcontrol/v1beta1
pkg/apis/networking/v1
pkg/apis/networking/v1beta1
pkg/apis/node/v1alpha1

View File

@ -106,6 +106,7 @@ storage.k8s.io/v1beta1 \
storage.k8s.io/v1 \
storage.k8s.io/v1alpha1 \
flowcontrol.apiserver.k8s.io/v1alpha1 \
flowcontrol.apiserver.k8s.io/v1beta1 \
internal.apiserver.k8s.io/v1alpha1 \
}"

View File

@ -32,6 +32,7 @@ filegroup(
"//pkg/apis/flowcontrol/internalbootstrap:all-srcs",
"//pkg/apis/flowcontrol/util:all-srcs",
"//pkg/apis/flowcontrol/v1alpha1:all-srcs",
"//pkg/apis/flowcontrol/v1beta1:all-srcs",
"//pkg/apis/flowcontrol/validation:all-srcs",
],
tags = ["automanaged"],

View File

@ -13,6 +13,7 @@ go_library(
"//pkg/api/legacyscheme:go_default_library",
"//pkg/apis/flowcontrol:go_default_library",
"//pkg/apis/flowcontrol/v1alpha1:go_default_library",
"//pkg/apis/flowcontrol/v1beta1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/runtime:go_default_library",
],

View File

@ -24,6 +24,7 @@ import (
"k8s.io/kubernetes/pkg/api/legacyscheme"
"k8s.io/kubernetes/pkg/apis/flowcontrol"
flowcontrolv1alpha1 "k8s.io/kubernetes/pkg/apis/flowcontrol/v1alpha1"
flowcontrolv1beta1 "k8s.io/kubernetes/pkg/apis/flowcontrol/v1beta1"
)
func init() {
@ -34,5 +35,6 @@ func init() {
func Install(scheme *runtime.Scheme) {
utilruntime.Must(flowcontrol.AddToScheme(scheme))
utilruntime.Must(flowcontrolv1alpha1.AddToScheme(scheme))
utilruntime.Must(scheme.SetVersionPriority(flowcontrolv1alpha1.SchemeGroupVersion))
utilruntime.Must(flowcontrolv1beta1.AddToScheme(scheme))
utilruntime.Must(scheme.SetVersionPriority(flowcontrolv1beta1.SchemeGroupVersion, flowcontrolv1alpha1.SchemeGroupVersion))
}

View File

@ -8,7 +8,7 @@ go_library(
deps = [
"//pkg/apis/flowcontrol:go_default_library",
"//pkg/apis/flowcontrol/install:go_default_library",
"//staging/src/k8s.io/api/flowcontrol/v1alpha1:go_default_library",
"//staging/src/k8s.io/api/flowcontrol/v1beta1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/apis/flowcontrol/bootstrap:go_default_library",
],
@ -33,7 +33,7 @@ go_test(
srcs = ["defaults_test.go"],
embed = [":go_default_library"],
deps = [
"//staging/src/k8s.io/api/flowcontrol/v1alpha1:go_default_library",
"//staging/src/k8s.io/api/flowcontrol/v1beta1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/api/equality:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/apis/flowcontrol/bootstrap:go_default_library",
],

View File

@ -17,7 +17,7 @@ limitations under the License.
package internalbootstrap
import (
fcv1a1 "k8s.io/api/flowcontrol/v1alpha1"
flowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apiserver/pkg/apis/flowcontrol/bootstrap"
"k8s.io/kubernetes/pkg/apis/flowcontrol"
@ -46,7 +46,7 @@ func NewAPFScheme() *runtime.Scheme {
return scheme
}
func internalizeFSes(exts []*fcv1a1.FlowSchema) map[string]*flowcontrol.FlowSchema {
func internalizeFSes(exts []*flowcontrolv1beta1.FlowSchema) map[string]*flowcontrol.FlowSchema {
ans := make(map[string]*flowcontrol.FlowSchema, len(exts))
scheme := NewAPFScheme()
for _, ext := range exts {
@ -59,7 +59,7 @@ func internalizeFSes(exts []*fcv1a1.FlowSchema) map[string]*flowcontrol.FlowSche
return ans
}
func internalizePLs(exts []*fcv1a1.PriorityLevelConfiguration) map[string]*flowcontrol.PriorityLevelConfiguration {
func internalizePLs(exts []*flowcontrolv1beta1.PriorityLevelConfiguration) map[string]*flowcontrol.PriorityLevelConfiguration {
ans := make(map[string]*flowcontrol.PriorityLevelConfiguration, len(exts))
scheme := NewAPFScheme()
for _, ext := range exts {

View File

@ -19,7 +19,7 @@ package internalbootstrap
import (
"testing"
fcv1a1 "k8s.io/api/flowcontrol/v1alpha1"
flowcontrol "k8s.io/api/flowcontrol/v1beta1"
apiequality "k8s.io/apimachinery/pkg/api/equality"
"k8s.io/apiserver/pkg/apis/flowcontrol/bootstrap"
)
@ -27,7 +27,7 @@ import (
func TestMandatoryAlreadyDefaulted(t *testing.T) {
scheme := NewAPFScheme()
for _, obj := range bootstrap.MandatoryFlowSchemas {
obj2 := obj.DeepCopyObject().(*fcv1a1.FlowSchema)
obj2 := obj.DeepCopyObject().(*flowcontrol.FlowSchema)
scheme.Default(obj2)
if apiequality.Semantic.DeepEqual(obj, obj2) {
t.Logf("Defaulting makes no change to %#+v", *obj)
@ -36,7 +36,7 @@ func TestMandatoryAlreadyDefaulted(t *testing.T) {
}
}
for _, obj := range bootstrap.MandatoryPriorityLevelConfigurations {
obj2 := obj.DeepCopyObject().(*fcv1a1.PriorityLevelConfiguration)
obj2 := obj.DeepCopyObject().(*flowcontrol.PriorityLevelConfiguration)
scheme.Default(obj2)
if apiequality.Semantic.DeepEqual(obj, obj2) {
t.Logf("Defaulting makes no change to %#+v", *obj)

View File

@ -0,0 +1,35 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = [
"defaults.go",
"doc.go",
"register.go",
"zz_generated.conversion.go",
"zz_generated.defaults.go",
],
importpath = "k8s.io/kubernetes/pkg/apis/flowcontrol/v1beta1",
visibility = ["//visibility:public"],
deps = [
"//pkg/apis/flowcontrol:go_default_library",
"//staging/src/k8s.io/api/flowcontrol/v1beta1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/conversion:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,60 @@
/*
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1beta1
import (
"k8s.io/api/flowcontrol/v1beta1"
)
// Default settings for flow-schema
const (
FlowSchemaDefaultMatchingPrecedence int32 = 1000
)
// Default settings for priority-level-configuration
const (
PriorityLevelConfigurationDefaultHandSize int32 = 8
PriorityLevelConfigurationDefaultQueues int32 = 64
PriorityLevelConfigurationDefaultQueueLengthLimit int32 = 50
PriorityLevelConfigurationDefaultAssuredConcurrencyShares int32 = 30
)
// SetDefaults_FlowSchema sets default values for flow schema
func SetDefaults_FlowSchemaSpec(spec *v1beta1.FlowSchemaSpec) {
if spec.MatchingPrecedence == 0 {
spec.MatchingPrecedence = FlowSchemaDefaultMatchingPrecedence
}
}
func SetDefaults_LimitedPriorityLevelConfiguration(lplc *v1beta1.LimitedPriorityLevelConfiguration) {
if lplc.AssuredConcurrencyShares == 0 {
lplc.AssuredConcurrencyShares = PriorityLevelConfigurationDefaultAssuredConcurrencyShares
}
}
// SetDefaults_FlowSchema sets default values for flow schema
func SetDefaults_QueuingConfiguration(cfg *v1beta1.QueuingConfiguration) {
if cfg.HandSize == 0 {
cfg.HandSize = PriorityLevelConfigurationDefaultHandSize
}
if cfg.Queues == 0 {
cfg.Queues = PriorityLevelConfigurationDefaultQueues
}
if cfg.QueueLengthLimit == 0 {
cfg.QueueLengthLimit = PriorityLevelConfigurationDefaultQueueLengthLimit
}
}

View File

@ -0,0 +1,24 @@
/*
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// +k8s:conversion-gen=k8s.io/kubernetes/pkg/apis/flowcontrol
// +k8s:conversion-gen-external-types=k8s.io/api/flowcontrol/v1beta1
// +k8s:defaulter-gen=TypeMeta
// +k8s:defaulter-gen-input=../../../../vendor/k8s.io/api/flowcontrol/v1beta1
// +groupName=flowcontrol.apiserver.k8s.io
package v1beta1 // import "k8s.io/kubernetes/pkg/apis/flowcontrol/v1beta1"

View File

@ -0,0 +1,46 @@
/*
Copyright 2015 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1beta1
import (
flowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1"
"k8s.io/apimachinery/pkg/runtime/schema"
)
// GroupName is the group name use in this package
const GroupName = "flowcontrol.apiserver.k8s.io"
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"}
// Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
var (
localSchemeBuilder = &flowcontrolv1beta1.SchemeBuilder
// AddToScheme adds api to a scheme
AddToScheme = localSchemeBuilder.AddToScheme
)
func init() {
// We only register manually written functions here. The registration of the
// generated functions takes place in the generated files. The separation
// makes the code compile even when the generated files are missing.
localSchemeBuilder.Register(RegisterDefaults)
}

View File

@ -0,0 +1,790 @@
// +build !ignore_autogenerated
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by conversion-gen. DO NOT EDIT.
package v1beta1
import (
unsafe "unsafe"
v1beta1 "k8s.io/api/flowcontrol/v1beta1"
conversion "k8s.io/apimachinery/pkg/conversion"
runtime "k8s.io/apimachinery/pkg/runtime"
flowcontrol "k8s.io/kubernetes/pkg/apis/flowcontrol"
)
func init() {
localSchemeBuilder.Register(RegisterConversions)
}
// RegisterConversions adds conversion functions to the given scheme.
// Public to allow building arbitrary schemes.
func RegisterConversions(s *runtime.Scheme) error {
if err := s.AddGeneratedConversionFunc((*v1beta1.FlowDistinguisherMethod)(nil), (*flowcontrol.FlowDistinguisherMethod)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_FlowDistinguisherMethod_To_flowcontrol_FlowDistinguisherMethod(a.(*v1beta1.FlowDistinguisherMethod), b.(*flowcontrol.FlowDistinguisherMethod), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*flowcontrol.FlowDistinguisherMethod)(nil), (*v1beta1.FlowDistinguisherMethod)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_flowcontrol_FlowDistinguisherMethod_To_v1beta1_FlowDistinguisherMethod(a.(*flowcontrol.FlowDistinguisherMethod), b.(*v1beta1.FlowDistinguisherMethod), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1beta1.FlowSchema)(nil), (*flowcontrol.FlowSchema)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_FlowSchema_To_flowcontrol_FlowSchema(a.(*v1beta1.FlowSchema), b.(*flowcontrol.FlowSchema), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*flowcontrol.FlowSchema)(nil), (*v1beta1.FlowSchema)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_flowcontrol_FlowSchema_To_v1beta1_FlowSchema(a.(*flowcontrol.FlowSchema), b.(*v1beta1.FlowSchema), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1beta1.FlowSchemaCondition)(nil), (*flowcontrol.FlowSchemaCondition)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_FlowSchemaCondition_To_flowcontrol_FlowSchemaCondition(a.(*v1beta1.FlowSchemaCondition), b.(*flowcontrol.FlowSchemaCondition), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*flowcontrol.FlowSchemaCondition)(nil), (*v1beta1.FlowSchemaCondition)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_flowcontrol_FlowSchemaCondition_To_v1beta1_FlowSchemaCondition(a.(*flowcontrol.FlowSchemaCondition), b.(*v1beta1.FlowSchemaCondition), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1beta1.FlowSchemaList)(nil), (*flowcontrol.FlowSchemaList)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_FlowSchemaList_To_flowcontrol_FlowSchemaList(a.(*v1beta1.FlowSchemaList), b.(*flowcontrol.FlowSchemaList), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*flowcontrol.FlowSchemaList)(nil), (*v1beta1.FlowSchemaList)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_flowcontrol_FlowSchemaList_To_v1beta1_FlowSchemaList(a.(*flowcontrol.FlowSchemaList), b.(*v1beta1.FlowSchemaList), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1beta1.FlowSchemaSpec)(nil), (*flowcontrol.FlowSchemaSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_FlowSchemaSpec_To_flowcontrol_FlowSchemaSpec(a.(*v1beta1.FlowSchemaSpec), b.(*flowcontrol.FlowSchemaSpec), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*flowcontrol.FlowSchemaSpec)(nil), (*v1beta1.FlowSchemaSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_flowcontrol_FlowSchemaSpec_To_v1beta1_FlowSchemaSpec(a.(*flowcontrol.FlowSchemaSpec), b.(*v1beta1.FlowSchemaSpec), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1beta1.FlowSchemaStatus)(nil), (*flowcontrol.FlowSchemaStatus)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_FlowSchemaStatus_To_flowcontrol_FlowSchemaStatus(a.(*v1beta1.FlowSchemaStatus), b.(*flowcontrol.FlowSchemaStatus), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*flowcontrol.FlowSchemaStatus)(nil), (*v1beta1.FlowSchemaStatus)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_flowcontrol_FlowSchemaStatus_To_v1beta1_FlowSchemaStatus(a.(*flowcontrol.FlowSchemaStatus), b.(*v1beta1.FlowSchemaStatus), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1beta1.GroupSubject)(nil), (*flowcontrol.GroupSubject)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_GroupSubject_To_flowcontrol_GroupSubject(a.(*v1beta1.GroupSubject), b.(*flowcontrol.GroupSubject), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*flowcontrol.GroupSubject)(nil), (*v1beta1.GroupSubject)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_flowcontrol_GroupSubject_To_v1beta1_GroupSubject(a.(*flowcontrol.GroupSubject), b.(*v1beta1.GroupSubject), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1beta1.LimitResponse)(nil), (*flowcontrol.LimitResponse)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_LimitResponse_To_flowcontrol_LimitResponse(a.(*v1beta1.LimitResponse), b.(*flowcontrol.LimitResponse), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*flowcontrol.LimitResponse)(nil), (*v1beta1.LimitResponse)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_flowcontrol_LimitResponse_To_v1beta1_LimitResponse(a.(*flowcontrol.LimitResponse), b.(*v1beta1.LimitResponse), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1beta1.LimitedPriorityLevelConfiguration)(nil), (*flowcontrol.LimitedPriorityLevelConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration(a.(*v1beta1.LimitedPriorityLevelConfiguration), b.(*flowcontrol.LimitedPriorityLevelConfiguration), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*flowcontrol.LimitedPriorityLevelConfiguration)(nil), (*v1beta1.LimitedPriorityLevelConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1beta1_LimitedPriorityLevelConfiguration(a.(*flowcontrol.LimitedPriorityLevelConfiguration), b.(*v1beta1.LimitedPriorityLevelConfiguration), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1beta1.NonResourcePolicyRule)(nil), (*flowcontrol.NonResourcePolicyRule)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_NonResourcePolicyRule_To_flowcontrol_NonResourcePolicyRule(a.(*v1beta1.NonResourcePolicyRule), b.(*flowcontrol.NonResourcePolicyRule), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*flowcontrol.NonResourcePolicyRule)(nil), (*v1beta1.NonResourcePolicyRule)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_flowcontrol_NonResourcePolicyRule_To_v1beta1_NonResourcePolicyRule(a.(*flowcontrol.NonResourcePolicyRule), b.(*v1beta1.NonResourcePolicyRule), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1beta1.PolicyRulesWithSubjects)(nil), (*flowcontrol.PolicyRulesWithSubjects)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_PolicyRulesWithSubjects_To_flowcontrol_PolicyRulesWithSubjects(a.(*v1beta1.PolicyRulesWithSubjects), b.(*flowcontrol.PolicyRulesWithSubjects), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*flowcontrol.PolicyRulesWithSubjects)(nil), (*v1beta1.PolicyRulesWithSubjects)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_flowcontrol_PolicyRulesWithSubjects_To_v1beta1_PolicyRulesWithSubjects(a.(*flowcontrol.PolicyRulesWithSubjects), b.(*v1beta1.PolicyRulesWithSubjects), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1beta1.PriorityLevelConfiguration)(nil), (*flowcontrol.PriorityLevelConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_PriorityLevelConfiguration_To_flowcontrol_PriorityLevelConfiguration(a.(*v1beta1.PriorityLevelConfiguration), b.(*flowcontrol.PriorityLevelConfiguration), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*flowcontrol.PriorityLevelConfiguration)(nil), (*v1beta1.PriorityLevelConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_flowcontrol_PriorityLevelConfiguration_To_v1beta1_PriorityLevelConfiguration(a.(*flowcontrol.PriorityLevelConfiguration), b.(*v1beta1.PriorityLevelConfiguration), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1beta1.PriorityLevelConfigurationCondition)(nil), (*flowcontrol.PriorityLevelConfigurationCondition)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_PriorityLevelConfigurationCondition_To_flowcontrol_PriorityLevelConfigurationCondition(a.(*v1beta1.PriorityLevelConfigurationCondition), b.(*flowcontrol.PriorityLevelConfigurationCondition), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*flowcontrol.PriorityLevelConfigurationCondition)(nil), (*v1beta1.PriorityLevelConfigurationCondition)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_flowcontrol_PriorityLevelConfigurationCondition_To_v1beta1_PriorityLevelConfigurationCondition(a.(*flowcontrol.PriorityLevelConfigurationCondition), b.(*v1beta1.PriorityLevelConfigurationCondition), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1beta1.PriorityLevelConfigurationList)(nil), (*flowcontrol.PriorityLevelConfigurationList)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_PriorityLevelConfigurationList_To_flowcontrol_PriorityLevelConfigurationList(a.(*v1beta1.PriorityLevelConfigurationList), b.(*flowcontrol.PriorityLevelConfigurationList), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*flowcontrol.PriorityLevelConfigurationList)(nil), (*v1beta1.PriorityLevelConfigurationList)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_flowcontrol_PriorityLevelConfigurationList_To_v1beta1_PriorityLevelConfigurationList(a.(*flowcontrol.PriorityLevelConfigurationList), b.(*v1beta1.PriorityLevelConfigurationList), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1beta1.PriorityLevelConfigurationReference)(nil), (*flowcontrol.PriorityLevelConfigurationReference)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_PriorityLevelConfigurationReference_To_flowcontrol_PriorityLevelConfigurationReference(a.(*v1beta1.PriorityLevelConfigurationReference), b.(*flowcontrol.PriorityLevelConfigurationReference), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*flowcontrol.PriorityLevelConfigurationReference)(nil), (*v1beta1.PriorityLevelConfigurationReference)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_flowcontrol_PriorityLevelConfigurationReference_To_v1beta1_PriorityLevelConfigurationReference(a.(*flowcontrol.PriorityLevelConfigurationReference), b.(*v1beta1.PriorityLevelConfigurationReference), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1beta1.PriorityLevelConfigurationSpec)(nil), (*flowcontrol.PriorityLevelConfigurationSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_PriorityLevelConfigurationSpec_To_flowcontrol_PriorityLevelConfigurationSpec(a.(*v1beta1.PriorityLevelConfigurationSpec), b.(*flowcontrol.PriorityLevelConfigurationSpec), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*flowcontrol.PriorityLevelConfigurationSpec)(nil), (*v1beta1.PriorityLevelConfigurationSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_flowcontrol_PriorityLevelConfigurationSpec_To_v1beta1_PriorityLevelConfigurationSpec(a.(*flowcontrol.PriorityLevelConfigurationSpec), b.(*v1beta1.PriorityLevelConfigurationSpec), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1beta1.PriorityLevelConfigurationStatus)(nil), (*flowcontrol.PriorityLevelConfigurationStatus)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_PriorityLevelConfigurationStatus_To_flowcontrol_PriorityLevelConfigurationStatus(a.(*v1beta1.PriorityLevelConfigurationStatus), b.(*flowcontrol.PriorityLevelConfigurationStatus), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*flowcontrol.PriorityLevelConfigurationStatus)(nil), (*v1beta1.PriorityLevelConfigurationStatus)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_flowcontrol_PriorityLevelConfigurationStatus_To_v1beta1_PriorityLevelConfigurationStatus(a.(*flowcontrol.PriorityLevelConfigurationStatus), b.(*v1beta1.PriorityLevelConfigurationStatus), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1beta1.QueuingConfiguration)(nil), (*flowcontrol.QueuingConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_QueuingConfiguration_To_flowcontrol_QueuingConfiguration(a.(*v1beta1.QueuingConfiguration), b.(*flowcontrol.QueuingConfiguration), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*flowcontrol.QueuingConfiguration)(nil), (*v1beta1.QueuingConfiguration)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_flowcontrol_QueuingConfiguration_To_v1beta1_QueuingConfiguration(a.(*flowcontrol.QueuingConfiguration), b.(*v1beta1.QueuingConfiguration), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1beta1.ResourcePolicyRule)(nil), (*flowcontrol.ResourcePolicyRule)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_ResourcePolicyRule_To_flowcontrol_ResourcePolicyRule(a.(*v1beta1.ResourcePolicyRule), b.(*flowcontrol.ResourcePolicyRule), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*flowcontrol.ResourcePolicyRule)(nil), (*v1beta1.ResourcePolicyRule)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_flowcontrol_ResourcePolicyRule_To_v1beta1_ResourcePolicyRule(a.(*flowcontrol.ResourcePolicyRule), b.(*v1beta1.ResourcePolicyRule), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1beta1.ServiceAccountSubject)(nil), (*flowcontrol.ServiceAccountSubject)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_ServiceAccountSubject_To_flowcontrol_ServiceAccountSubject(a.(*v1beta1.ServiceAccountSubject), b.(*flowcontrol.ServiceAccountSubject), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*flowcontrol.ServiceAccountSubject)(nil), (*v1beta1.ServiceAccountSubject)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_flowcontrol_ServiceAccountSubject_To_v1beta1_ServiceAccountSubject(a.(*flowcontrol.ServiceAccountSubject), b.(*v1beta1.ServiceAccountSubject), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1beta1.Subject)(nil), (*flowcontrol.Subject)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_Subject_To_flowcontrol_Subject(a.(*v1beta1.Subject), b.(*flowcontrol.Subject), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*flowcontrol.Subject)(nil), (*v1beta1.Subject)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_flowcontrol_Subject_To_v1beta1_Subject(a.(*flowcontrol.Subject), b.(*v1beta1.Subject), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*v1beta1.UserSubject)(nil), (*flowcontrol.UserSubject)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_v1beta1_UserSubject_To_flowcontrol_UserSubject(a.(*v1beta1.UserSubject), b.(*flowcontrol.UserSubject), scope)
}); err != nil {
return err
}
if err := s.AddGeneratedConversionFunc((*flowcontrol.UserSubject)(nil), (*v1beta1.UserSubject)(nil), func(a, b interface{}, scope conversion.Scope) error {
return Convert_flowcontrol_UserSubject_To_v1beta1_UserSubject(a.(*flowcontrol.UserSubject), b.(*v1beta1.UserSubject), scope)
}); err != nil {
return err
}
return nil
}
func autoConvert_v1beta1_FlowDistinguisherMethod_To_flowcontrol_FlowDistinguisherMethod(in *v1beta1.FlowDistinguisherMethod, out *flowcontrol.FlowDistinguisherMethod, s conversion.Scope) error {
out.Type = flowcontrol.FlowDistinguisherMethodType(in.Type)
return nil
}
// Convert_v1beta1_FlowDistinguisherMethod_To_flowcontrol_FlowDistinguisherMethod is an autogenerated conversion function.
func Convert_v1beta1_FlowDistinguisherMethod_To_flowcontrol_FlowDistinguisherMethod(in *v1beta1.FlowDistinguisherMethod, out *flowcontrol.FlowDistinguisherMethod, s conversion.Scope) error {
return autoConvert_v1beta1_FlowDistinguisherMethod_To_flowcontrol_FlowDistinguisherMethod(in, out, s)
}
func autoConvert_flowcontrol_FlowDistinguisherMethod_To_v1beta1_FlowDistinguisherMethod(in *flowcontrol.FlowDistinguisherMethod, out *v1beta1.FlowDistinguisherMethod, s conversion.Scope) error {
out.Type = v1beta1.FlowDistinguisherMethodType(in.Type)
return nil
}
// Convert_flowcontrol_FlowDistinguisherMethod_To_v1beta1_FlowDistinguisherMethod is an autogenerated conversion function.
func Convert_flowcontrol_FlowDistinguisherMethod_To_v1beta1_FlowDistinguisherMethod(in *flowcontrol.FlowDistinguisherMethod, out *v1beta1.FlowDistinguisherMethod, s conversion.Scope) error {
return autoConvert_flowcontrol_FlowDistinguisherMethod_To_v1beta1_FlowDistinguisherMethod(in, out, s)
}
func autoConvert_v1beta1_FlowSchema_To_flowcontrol_FlowSchema(in *v1beta1.FlowSchema, out *flowcontrol.FlowSchema, s conversion.Scope) error {
out.ObjectMeta = in.ObjectMeta
if err := Convert_v1beta1_FlowSchemaSpec_To_flowcontrol_FlowSchemaSpec(&in.Spec, &out.Spec, s); err != nil {
return err
}
if err := Convert_v1beta1_FlowSchemaStatus_To_flowcontrol_FlowSchemaStatus(&in.Status, &out.Status, s); err != nil {
return err
}
return nil
}
// Convert_v1beta1_FlowSchema_To_flowcontrol_FlowSchema is an autogenerated conversion function.
func Convert_v1beta1_FlowSchema_To_flowcontrol_FlowSchema(in *v1beta1.FlowSchema, out *flowcontrol.FlowSchema, s conversion.Scope) error {
return autoConvert_v1beta1_FlowSchema_To_flowcontrol_FlowSchema(in, out, s)
}
func autoConvert_flowcontrol_FlowSchema_To_v1beta1_FlowSchema(in *flowcontrol.FlowSchema, out *v1beta1.FlowSchema, s conversion.Scope) error {
out.ObjectMeta = in.ObjectMeta
if err := Convert_flowcontrol_FlowSchemaSpec_To_v1beta1_FlowSchemaSpec(&in.Spec, &out.Spec, s); err != nil {
return err
}
if err := Convert_flowcontrol_FlowSchemaStatus_To_v1beta1_FlowSchemaStatus(&in.Status, &out.Status, s); err != nil {
return err
}
return nil
}
// Convert_flowcontrol_FlowSchema_To_v1beta1_FlowSchema is an autogenerated conversion function.
func Convert_flowcontrol_FlowSchema_To_v1beta1_FlowSchema(in *flowcontrol.FlowSchema, out *v1beta1.FlowSchema, s conversion.Scope) error {
return autoConvert_flowcontrol_FlowSchema_To_v1beta1_FlowSchema(in, out, s)
}
func autoConvert_v1beta1_FlowSchemaCondition_To_flowcontrol_FlowSchemaCondition(in *v1beta1.FlowSchemaCondition, out *flowcontrol.FlowSchemaCondition, s conversion.Scope) error {
out.Type = flowcontrol.FlowSchemaConditionType(in.Type)
out.Status = flowcontrol.ConditionStatus(in.Status)
out.LastTransitionTime = in.LastTransitionTime
out.Reason = in.Reason
out.Message = in.Message
return nil
}
// Convert_v1beta1_FlowSchemaCondition_To_flowcontrol_FlowSchemaCondition is an autogenerated conversion function.
func Convert_v1beta1_FlowSchemaCondition_To_flowcontrol_FlowSchemaCondition(in *v1beta1.FlowSchemaCondition, out *flowcontrol.FlowSchemaCondition, s conversion.Scope) error {
return autoConvert_v1beta1_FlowSchemaCondition_To_flowcontrol_FlowSchemaCondition(in, out, s)
}
func autoConvert_flowcontrol_FlowSchemaCondition_To_v1beta1_FlowSchemaCondition(in *flowcontrol.FlowSchemaCondition, out *v1beta1.FlowSchemaCondition, s conversion.Scope) error {
out.Type = v1beta1.FlowSchemaConditionType(in.Type)
out.Status = v1beta1.ConditionStatus(in.Status)
out.LastTransitionTime = in.LastTransitionTime
out.Reason = in.Reason
out.Message = in.Message
return nil
}
// Convert_flowcontrol_FlowSchemaCondition_To_v1beta1_FlowSchemaCondition is an autogenerated conversion function.
func Convert_flowcontrol_FlowSchemaCondition_To_v1beta1_FlowSchemaCondition(in *flowcontrol.FlowSchemaCondition, out *v1beta1.FlowSchemaCondition, s conversion.Scope) error {
return autoConvert_flowcontrol_FlowSchemaCondition_To_v1beta1_FlowSchemaCondition(in, out, s)
}
func autoConvert_v1beta1_FlowSchemaList_To_flowcontrol_FlowSchemaList(in *v1beta1.FlowSchemaList, out *flowcontrol.FlowSchemaList, s conversion.Scope) error {
out.ListMeta = in.ListMeta
out.Items = *(*[]flowcontrol.FlowSchema)(unsafe.Pointer(&in.Items))
return nil
}
// Convert_v1beta1_FlowSchemaList_To_flowcontrol_FlowSchemaList is an autogenerated conversion function.
func Convert_v1beta1_FlowSchemaList_To_flowcontrol_FlowSchemaList(in *v1beta1.FlowSchemaList, out *flowcontrol.FlowSchemaList, s conversion.Scope) error {
return autoConvert_v1beta1_FlowSchemaList_To_flowcontrol_FlowSchemaList(in, out, s)
}
func autoConvert_flowcontrol_FlowSchemaList_To_v1beta1_FlowSchemaList(in *flowcontrol.FlowSchemaList, out *v1beta1.FlowSchemaList, s conversion.Scope) error {
out.ListMeta = in.ListMeta
out.Items = *(*[]v1beta1.FlowSchema)(unsafe.Pointer(&in.Items))
return nil
}
// Convert_flowcontrol_FlowSchemaList_To_v1beta1_FlowSchemaList is an autogenerated conversion function.
func Convert_flowcontrol_FlowSchemaList_To_v1beta1_FlowSchemaList(in *flowcontrol.FlowSchemaList, out *v1beta1.FlowSchemaList, s conversion.Scope) error {
return autoConvert_flowcontrol_FlowSchemaList_To_v1beta1_FlowSchemaList(in, out, s)
}
func autoConvert_v1beta1_FlowSchemaSpec_To_flowcontrol_FlowSchemaSpec(in *v1beta1.FlowSchemaSpec, out *flowcontrol.FlowSchemaSpec, s conversion.Scope) error {
if err := Convert_v1beta1_PriorityLevelConfigurationReference_To_flowcontrol_PriorityLevelConfigurationReference(&in.PriorityLevelConfiguration, &out.PriorityLevelConfiguration, s); err != nil {
return err
}
out.MatchingPrecedence = in.MatchingPrecedence
out.DistinguisherMethod = (*flowcontrol.FlowDistinguisherMethod)(unsafe.Pointer(in.DistinguisherMethod))
out.Rules = *(*[]flowcontrol.PolicyRulesWithSubjects)(unsafe.Pointer(&in.Rules))
return nil
}
// Convert_v1beta1_FlowSchemaSpec_To_flowcontrol_FlowSchemaSpec is an autogenerated conversion function.
func Convert_v1beta1_FlowSchemaSpec_To_flowcontrol_FlowSchemaSpec(in *v1beta1.FlowSchemaSpec, out *flowcontrol.FlowSchemaSpec, s conversion.Scope) error {
return autoConvert_v1beta1_FlowSchemaSpec_To_flowcontrol_FlowSchemaSpec(in, out, s)
}
func autoConvert_flowcontrol_FlowSchemaSpec_To_v1beta1_FlowSchemaSpec(in *flowcontrol.FlowSchemaSpec, out *v1beta1.FlowSchemaSpec, s conversion.Scope) error {
if err := Convert_flowcontrol_PriorityLevelConfigurationReference_To_v1beta1_PriorityLevelConfigurationReference(&in.PriorityLevelConfiguration, &out.PriorityLevelConfiguration, s); err != nil {
return err
}
out.MatchingPrecedence = in.MatchingPrecedence
out.DistinguisherMethod = (*v1beta1.FlowDistinguisherMethod)(unsafe.Pointer(in.DistinguisherMethod))
out.Rules = *(*[]v1beta1.PolicyRulesWithSubjects)(unsafe.Pointer(&in.Rules))
return nil
}
// Convert_flowcontrol_FlowSchemaSpec_To_v1beta1_FlowSchemaSpec is an autogenerated conversion function.
func Convert_flowcontrol_FlowSchemaSpec_To_v1beta1_FlowSchemaSpec(in *flowcontrol.FlowSchemaSpec, out *v1beta1.FlowSchemaSpec, s conversion.Scope) error {
return autoConvert_flowcontrol_FlowSchemaSpec_To_v1beta1_FlowSchemaSpec(in, out, s)
}
func autoConvert_v1beta1_FlowSchemaStatus_To_flowcontrol_FlowSchemaStatus(in *v1beta1.FlowSchemaStatus, out *flowcontrol.FlowSchemaStatus, s conversion.Scope) error {
out.Conditions = *(*[]flowcontrol.FlowSchemaCondition)(unsafe.Pointer(&in.Conditions))
return nil
}
// Convert_v1beta1_FlowSchemaStatus_To_flowcontrol_FlowSchemaStatus is an autogenerated conversion function.
func Convert_v1beta1_FlowSchemaStatus_To_flowcontrol_FlowSchemaStatus(in *v1beta1.FlowSchemaStatus, out *flowcontrol.FlowSchemaStatus, s conversion.Scope) error {
return autoConvert_v1beta1_FlowSchemaStatus_To_flowcontrol_FlowSchemaStatus(in, out, s)
}
func autoConvert_flowcontrol_FlowSchemaStatus_To_v1beta1_FlowSchemaStatus(in *flowcontrol.FlowSchemaStatus, out *v1beta1.FlowSchemaStatus, s conversion.Scope) error {
out.Conditions = *(*[]v1beta1.FlowSchemaCondition)(unsafe.Pointer(&in.Conditions))
return nil
}
// Convert_flowcontrol_FlowSchemaStatus_To_v1beta1_FlowSchemaStatus is an autogenerated conversion function.
func Convert_flowcontrol_FlowSchemaStatus_To_v1beta1_FlowSchemaStatus(in *flowcontrol.FlowSchemaStatus, out *v1beta1.FlowSchemaStatus, s conversion.Scope) error {
return autoConvert_flowcontrol_FlowSchemaStatus_To_v1beta1_FlowSchemaStatus(in, out, s)
}
func autoConvert_v1beta1_GroupSubject_To_flowcontrol_GroupSubject(in *v1beta1.GroupSubject, out *flowcontrol.GroupSubject, s conversion.Scope) error {
out.Name = in.Name
return nil
}
// Convert_v1beta1_GroupSubject_To_flowcontrol_GroupSubject is an autogenerated conversion function.
func Convert_v1beta1_GroupSubject_To_flowcontrol_GroupSubject(in *v1beta1.GroupSubject, out *flowcontrol.GroupSubject, s conversion.Scope) error {
return autoConvert_v1beta1_GroupSubject_To_flowcontrol_GroupSubject(in, out, s)
}
func autoConvert_flowcontrol_GroupSubject_To_v1beta1_GroupSubject(in *flowcontrol.GroupSubject, out *v1beta1.GroupSubject, s conversion.Scope) error {
out.Name = in.Name
return nil
}
// Convert_flowcontrol_GroupSubject_To_v1beta1_GroupSubject is an autogenerated conversion function.
func Convert_flowcontrol_GroupSubject_To_v1beta1_GroupSubject(in *flowcontrol.GroupSubject, out *v1beta1.GroupSubject, s conversion.Scope) error {
return autoConvert_flowcontrol_GroupSubject_To_v1beta1_GroupSubject(in, out, s)
}
func autoConvert_v1beta1_LimitResponse_To_flowcontrol_LimitResponse(in *v1beta1.LimitResponse, out *flowcontrol.LimitResponse, s conversion.Scope) error {
out.Type = flowcontrol.LimitResponseType(in.Type)
out.Queuing = (*flowcontrol.QueuingConfiguration)(unsafe.Pointer(in.Queuing))
return nil
}
// Convert_v1beta1_LimitResponse_To_flowcontrol_LimitResponse is an autogenerated conversion function.
func Convert_v1beta1_LimitResponse_To_flowcontrol_LimitResponse(in *v1beta1.LimitResponse, out *flowcontrol.LimitResponse, s conversion.Scope) error {
return autoConvert_v1beta1_LimitResponse_To_flowcontrol_LimitResponse(in, out, s)
}
func autoConvert_flowcontrol_LimitResponse_To_v1beta1_LimitResponse(in *flowcontrol.LimitResponse, out *v1beta1.LimitResponse, s conversion.Scope) error {
out.Type = v1beta1.LimitResponseType(in.Type)
out.Queuing = (*v1beta1.QueuingConfiguration)(unsafe.Pointer(in.Queuing))
return nil
}
// Convert_flowcontrol_LimitResponse_To_v1beta1_LimitResponse is an autogenerated conversion function.
func Convert_flowcontrol_LimitResponse_To_v1beta1_LimitResponse(in *flowcontrol.LimitResponse, out *v1beta1.LimitResponse, s conversion.Scope) error {
return autoConvert_flowcontrol_LimitResponse_To_v1beta1_LimitResponse(in, out, s)
}
func autoConvert_v1beta1_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration(in *v1beta1.LimitedPriorityLevelConfiguration, out *flowcontrol.LimitedPriorityLevelConfiguration, s conversion.Scope) error {
out.AssuredConcurrencyShares = in.AssuredConcurrencyShares
if err := Convert_v1beta1_LimitResponse_To_flowcontrol_LimitResponse(&in.LimitResponse, &out.LimitResponse, s); err != nil {
return err
}
return nil
}
// Convert_v1beta1_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration is an autogenerated conversion function.
func Convert_v1beta1_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration(in *v1beta1.LimitedPriorityLevelConfiguration, out *flowcontrol.LimitedPriorityLevelConfiguration, s conversion.Scope) error {
return autoConvert_v1beta1_LimitedPriorityLevelConfiguration_To_flowcontrol_LimitedPriorityLevelConfiguration(in, out, s)
}
func autoConvert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1beta1_LimitedPriorityLevelConfiguration(in *flowcontrol.LimitedPriorityLevelConfiguration, out *v1beta1.LimitedPriorityLevelConfiguration, s conversion.Scope) error {
out.AssuredConcurrencyShares = in.AssuredConcurrencyShares
if err := Convert_flowcontrol_LimitResponse_To_v1beta1_LimitResponse(&in.LimitResponse, &out.LimitResponse, s); err != nil {
return err
}
return nil
}
// Convert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1beta1_LimitedPriorityLevelConfiguration is an autogenerated conversion function.
func Convert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1beta1_LimitedPriorityLevelConfiguration(in *flowcontrol.LimitedPriorityLevelConfiguration, out *v1beta1.LimitedPriorityLevelConfiguration, s conversion.Scope) error {
return autoConvert_flowcontrol_LimitedPriorityLevelConfiguration_To_v1beta1_LimitedPriorityLevelConfiguration(in, out, s)
}
func autoConvert_v1beta1_NonResourcePolicyRule_To_flowcontrol_NonResourcePolicyRule(in *v1beta1.NonResourcePolicyRule, out *flowcontrol.NonResourcePolicyRule, s conversion.Scope) error {
out.Verbs = *(*[]string)(unsafe.Pointer(&in.Verbs))
out.NonResourceURLs = *(*[]string)(unsafe.Pointer(&in.NonResourceURLs))
return nil
}
// Convert_v1beta1_NonResourcePolicyRule_To_flowcontrol_NonResourcePolicyRule is an autogenerated conversion function.
func Convert_v1beta1_NonResourcePolicyRule_To_flowcontrol_NonResourcePolicyRule(in *v1beta1.NonResourcePolicyRule, out *flowcontrol.NonResourcePolicyRule, s conversion.Scope) error {
return autoConvert_v1beta1_NonResourcePolicyRule_To_flowcontrol_NonResourcePolicyRule(in, out, s)
}
func autoConvert_flowcontrol_NonResourcePolicyRule_To_v1beta1_NonResourcePolicyRule(in *flowcontrol.NonResourcePolicyRule, out *v1beta1.NonResourcePolicyRule, s conversion.Scope) error {
out.Verbs = *(*[]string)(unsafe.Pointer(&in.Verbs))
out.NonResourceURLs = *(*[]string)(unsafe.Pointer(&in.NonResourceURLs))
return nil
}
// Convert_flowcontrol_NonResourcePolicyRule_To_v1beta1_NonResourcePolicyRule is an autogenerated conversion function.
func Convert_flowcontrol_NonResourcePolicyRule_To_v1beta1_NonResourcePolicyRule(in *flowcontrol.NonResourcePolicyRule, out *v1beta1.NonResourcePolicyRule, s conversion.Scope) error {
return autoConvert_flowcontrol_NonResourcePolicyRule_To_v1beta1_NonResourcePolicyRule(in, out, s)
}
func autoConvert_v1beta1_PolicyRulesWithSubjects_To_flowcontrol_PolicyRulesWithSubjects(in *v1beta1.PolicyRulesWithSubjects, out *flowcontrol.PolicyRulesWithSubjects, s conversion.Scope) error {
out.Subjects = *(*[]flowcontrol.Subject)(unsafe.Pointer(&in.Subjects))
out.ResourceRules = *(*[]flowcontrol.ResourcePolicyRule)(unsafe.Pointer(&in.ResourceRules))
out.NonResourceRules = *(*[]flowcontrol.NonResourcePolicyRule)(unsafe.Pointer(&in.NonResourceRules))
return nil
}
// Convert_v1beta1_PolicyRulesWithSubjects_To_flowcontrol_PolicyRulesWithSubjects is an autogenerated conversion function.
func Convert_v1beta1_PolicyRulesWithSubjects_To_flowcontrol_PolicyRulesWithSubjects(in *v1beta1.PolicyRulesWithSubjects, out *flowcontrol.PolicyRulesWithSubjects, s conversion.Scope) error {
return autoConvert_v1beta1_PolicyRulesWithSubjects_To_flowcontrol_PolicyRulesWithSubjects(in, out, s)
}
func autoConvert_flowcontrol_PolicyRulesWithSubjects_To_v1beta1_PolicyRulesWithSubjects(in *flowcontrol.PolicyRulesWithSubjects, out *v1beta1.PolicyRulesWithSubjects, s conversion.Scope) error {
out.Subjects = *(*[]v1beta1.Subject)(unsafe.Pointer(&in.Subjects))
out.ResourceRules = *(*[]v1beta1.ResourcePolicyRule)(unsafe.Pointer(&in.ResourceRules))
out.NonResourceRules = *(*[]v1beta1.NonResourcePolicyRule)(unsafe.Pointer(&in.NonResourceRules))
return nil
}
// Convert_flowcontrol_PolicyRulesWithSubjects_To_v1beta1_PolicyRulesWithSubjects is an autogenerated conversion function.
func Convert_flowcontrol_PolicyRulesWithSubjects_To_v1beta1_PolicyRulesWithSubjects(in *flowcontrol.PolicyRulesWithSubjects, out *v1beta1.PolicyRulesWithSubjects, s conversion.Scope) error {
return autoConvert_flowcontrol_PolicyRulesWithSubjects_To_v1beta1_PolicyRulesWithSubjects(in, out, s)
}
func autoConvert_v1beta1_PriorityLevelConfiguration_To_flowcontrol_PriorityLevelConfiguration(in *v1beta1.PriorityLevelConfiguration, out *flowcontrol.PriorityLevelConfiguration, s conversion.Scope) error {
out.ObjectMeta = in.ObjectMeta
if err := Convert_v1beta1_PriorityLevelConfigurationSpec_To_flowcontrol_PriorityLevelConfigurationSpec(&in.Spec, &out.Spec, s); err != nil {
return err
}
if err := Convert_v1beta1_PriorityLevelConfigurationStatus_To_flowcontrol_PriorityLevelConfigurationStatus(&in.Status, &out.Status, s); err != nil {
return err
}
return nil
}
// Convert_v1beta1_PriorityLevelConfiguration_To_flowcontrol_PriorityLevelConfiguration is an autogenerated conversion function.
func Convert_v1beta1_PriorityLevelConfiguration_To_flowcontrol_PriorityLevelConfiguration(in *v1beta1.PriorityLevelConfiguration, out *flowcontrol.PriorityLevelConfiguration, s conversion.Scope) error {
return autoConvert_v1beta1_PriorityLevelConfiguration_To_flowcontrol_PriorityLevelConfiguration(in, out, s)
}
func autoConvert_flowcontrol_PriorityLevelConfiguration_To_v1beta1_PriorityLevelConfiguration(in *flowcontrol.PriorityLevelConfiguration, out *v1beta1.PriorityLevelConfiguration, s conversion.Scope) error {
out.ObjectMeta = in.ObjectMeta
if err := Convert_flowcontrol_PriorityLevelConfigurationSpec_To_v1beta1_PriorityLevelConfigurationSpec(&in.Spec, &out.Spec, s); err != nil {
return err
}
if err := Convert_flowcontrol_PriorityLevelConfigurationStatus_To_v1beta1_PriorityLevelConfigurationStatus(&in.Status, &out.Status, s); err != nil {
return err
}
return nil
}
// Convert_flowcontrol_PriorityLevelConfiguration_To_v1beta1_PriorityLevelConfiguration is an autogenerated conversion function.
func Convert_flowcontrol_PriorityLevelConfiguration_To_v1beta1_PriorityLevelConfiguration(in *flowcontrol.PriorityLevelConfiguration, out *v1beta1.PriorityLevelConfiguration, s conversion.Scope) error {
return autoConvert_flowcontrol_PriorityLevelConfiguration_To_v1beta1_PriorityLevelConfiguration(in, out, s)
}
func autoConvert_v1beta1_PriorityLevelConfigurationCondition_To_flowcontrol_PriorityLevelConfigurationCondition(in *v1beta1.PriorityLevelConfigurationCondition, out *flowcontrol.PriorityLevelConfigurationCondition, s conversion.Scope) error {
out.Type = flowcontrol.PriorityLevelConfigurationConditionType(in.Type)
out.Status = flowcontrol.ConditionStatus(in.Status)
out.LastTransitionTime = in.LastTransitionTime
out.Reason = in.Reason
out.Message = in.Message
return nil
}
// Convert_v1beta1_PriorityLevelConfigurationCondition_To_flowcontrol_PriorityLevelConfigurationCondition is an autogenerated conversion function.
func Convert_v1beta1_PriorityLevelConfigurationCondition_To_flowcontrol_PriorityLevelConfigurationCondition(in *v1beta1.PriorityLevelConfigurationCondition, out *flowcontrol.PriorityLevelConfigurationCondition, s conversion.Scope) error {
return autoConvert_v1beta1_PriorityLevelConfigurationCondition_To_flowcontrol_PriorityLevelConfigurationCondition(in, out, s)
}
func autoConvert_flowcontrol_PriorityLevelConfigurationCondition_To_v1beta1_PriorityLevelConfigurationCondition(in *flowcontrol.PriorityLevelConfigurationCondition, out *v1beta1.PriorityLevelConfigurationCondition, s conversion.Scope) error {
out.Type = v1beta1.PriorityLevelConfigurationConditionType(in.Type)
out.Status = v1beta1.ConditionStatus(in.Status)
out.LastTransitionTime = in.LastTransitionTime
out.Reason = in.Reason
out.Message = in.Message
return nil
}
// Convert_flowcontrol_PriorityLevelConfigurationCondition_To_v1beta1_PriorityLevelConfigurationCondition is an autogenerated conversion function.
func Convert_flowcontrol_PriorityLevelConfigurationCondition_To_v1beta1_PriorityLevelConfigurationCondition(in *flowcontrol.PriorityLevelConfigurationCondition, out *v1beta1.PriorityLevelConfigurationCondition, s conversion.Scope) error {
return autoConvert_flowcontrol_PriorityLevelConfigurationCondition_To_v1beta1_PriorityLevelConfigurationCondition(in, out, s)
}
func autoConvert_v1beta1_PriorityLevelConfigurationList_To_flowcontrol_PriorityLevelConfigurationList(in *v1beta1.PriorityLevelConfigurationList, out *flowcontrol.PriorityLevelConfigurationList, s conversion.Scope) error {
out.ListMeta = in.ListMeta
out.Items = *(*[]flowcontrol.PriorityLevelConfiguration)(unsafe.Pointer(&in.Items))
return nil
}
// Convert_v1beta1_PriorityLevelConfigurationList_To_flowcontrol_PriorityLevelConfigurationList is an autogenerated conversion function.
func Convert_v1beta1_PriorityLevelConfigurationList_To_flowcontrol_PriorityLevelConfigurationList(in *v1beta1.PriorityLevelConfigurationList, out *flowcontrol.PriorityLevelConfigurationList, s conversion.Scope) error {
return autoConvert_v1beta1_PriorityLevelConfigurationList_To_flowcontrol_PriorityLevelConfigurationList(in, out, s)
}
func autoConvert_flowcontrol_PriorityLevelConfigurationList_To_v1beta1_PriorityLevelConfigurationList(in *flowcontrol.PriorityLevelConfigurationList, out *v1beta1.PriorityLevelConfigurationList, s conversion.Scope) error {
out.ListMeta = in.ListMeta
out.Items = *(*[]v1beta1.PriorityLevelConfiguration)(unsafe.Pointer(&in.Items))
return nil
}
// Convert_flowcontrol_PriorityLevelConfigurationList_To_v1beta1_PriorityLevelConfigurationList is an autogenerated conversion function.
func Convert_flowcontrol_PriorityLevelConfigurationList_To_v1beta1_PriorityLevelConfigurationList(in *flowcontrol.PriorityLevelConfigurationList, out *v1beta1.PriorityLevelConfigurationList, s conversion.Scope) error {
return autoConvert_flowcontrol_PriorityLevelConfigurationList_To_v1beta1_PriorityLevelConfigurationList(in, out, s)
}
func autoConvert_v1beta1_PriorityLevelConfigurationReference_To_flowcontrol_PriorityLevelConfigurationReference(in *v1beta1.PriorityLevelConfigurationReference, out *flowcontrol.PriorityLevelConfigurationReference, s conversion.Scope) error {
out.Name = in.Name
return nil
}
// Convert_v1beta1_PriorityLevelConfigurationReference_To_flowcontrol_PriorityLevelConfigurationReference is an autogenerated conversion function.
func Convert_v1beta1_PriorityLevelConfigurationReference_To_flowcontrol_PriorityLevelConfigurationReference(in *v1beta1.PriorityLevelConfigurationReference, out *flowcontrol.PriorityLevelConfigurationReference, s conversion.Scope) error {
return autoConvert_v1beta1_PriorityLevelConfigurationReference_To_flowcontrol_PriorityLevelConfigurationReference(in, out, s)
}
func autoConvert_flowcontrol_PriorityLevelConfigurationReference_To_v1beta1_PriorityLevelConfigurationReference(in *flowcontrol.PriorityLevelConfigurationReference, out *v1beta1.PriorityLevelConfigurationReference, s conversion.Scope) error {
out.Name = in.Name
return nil
}
// Convert_flowcontrol_PriorityLevelConfigurationReference_To_v1beta1_PriorityLevelConfigurationReference is an autogenerated conversion function.
func Convert_flowcontrol_PriorityLevelConfigurationReference_To_v1beta1_PriorityLevelConfigurationReference(in *flowcontrol.PriorityLevelConfigurationReference, out *v1beta1.PriorityLevelConfigurationReference, s conversion.Scope) error {
return autoConvert_flowcontrol_PriorityLevelConfigurationReference_To_v1beta1_PriorityLevelConfigurationReference(in, out, s)
}
func autoConvert_v1beta1_PriorityLevelConfigurationSpec_To_flowcontrol_PriorityLevelConfigurationSpec(in *v1beta1.PriorityLevelConfigurationSpec, out *flowcontrol.PriorityLevelConfigurationSpec, s conversion.Scope) error {
out.Type = flowcontrol.PriorityLevelEnablement(in.Type)
out.Limited = (*flowcontrol.LimitedPriorityLevelConfiguration)(unsafe.Pointer(in.Limited))
return nil
}
// Convert_v1beta1_PriorityLevelConfigurationSpec_To_flowcontrol_PriorityLevelConfigurationSpec is an autogenerated conversion function.
func Convert_v1beta1_PriorityLevelConfigurationSpec_To_flowcontrol_PriorityLevelConfigurationSpec(in *v1beta1.PriorityLevelConfigurationSpec, out *flowcontrol.PriorityLevelConfigurationSpec, s conversion.Scope) error {
return autoConvert_v1beta1_PriorityLevelConfigurationSpec_To_flowcontrol_PriorityLevelConfigurationSpec(in, out, s)
}
func autoConvert_flowcontrol_PriorityLevelConfigurationSpec_To_v1beta1_PriorityLevelConfigurationSpec(in *flowcontrol.PriorityLevelConfigurationSpec, out *v1beta1.PriorityLevelConfigurationSpec, s conversion.Scope) error {
out.Type = v1beta1.PriorityLevelEnablement(in.Type)
out.Limited = (*v1beta1.LimitedPriorityLevelConfiguration)(unsafe.Pointer(in.Limited))
return nil
}
// Convert_flowcontrol_PriorityLevelConfigurationSpec_To_v1beta1_PriorityLevelConfigurationSpec is an autogenerated conversion function.
func Convert_flowcontrol_PriorityLevelConfigurationSpec_To_v1beta1_PriorityLevelConfigurationSpec(in *flowcontrol.PriorityLevelConfigurationSpec, out *v1beta1.PriorityLevelConfigurationSpec, s conversion.Scope) error {
return autoConvert_flowcontrol_PriorityLevelConfigurationSpec_To_v1beta1_PriorityLevelConfigurationSpec(in, out, s)
}
func autoConvert_v1beta1_PriorityLevelConfigurationStatus_To_flowcontrol_PriorityLevelConfigurationStatus(in *v1beta1.PriorityLevelConfigurationStatus, out *flowcontrol.PriorityLevelConfigurationStatus, s conversion.Scope) error {
out.Conditions = *(*[]flowcontrol.PriorityLevelConfigurationCondition)(unsafe.Pointer(&in.Conditions))
return nil
}
// Convert_v1beta1_PriorityLevelConfigurationStatus_To_flowcontrol_PriorityLevelConfigurationStatus is an autogenerated conversion function.
func Convert_v1beta1_PriorityLevelConfigurationStatus_To_flowcontrol_PriorityLevelConfigurationStatus(in *v1beta1.PriorityLevelConfigurationStatus, out *flowcontrol.PriorityLevelConfigurationStatus, s conversion.Scope) error {
return autoConvert_v1beta1_PriorityLevelConfigurationStatus_To_flowcontrol_PriorityLevelConfigurationStatus(in, out, s)
}
func autoConvert_flowcontrol_PriorityLevelConfigurationStatus_To_v1beta1_PriorityLevelConfigurationStatus(in *flowcontrol.PriorityLevelConfigurationStatus, out *v1beta1.PriorityLevelConfigurationStatus, s conversion.Scope) error {
out.Conditions = *(*[]v1beta1.PriorityLevelConfigurationCondition)(unsafe.Pointer(&in.Conditions))
return nil
}
// Convert_flowcontrol_PriorityLevelConfigurationStatus_To_v1beta1_PriorityLevelConfigurationStatus is an autogenerated conversion function.
func Convert_flowcontrol_PriorityLevelConfigurationStatus_To_v1beta1_PriorityLevelConfigurationStatus(in *flowcontrol.PriorityLevelConfigurationStatus, out *v1beta1.PriorityLevelConfigurationStatus, s conversion.Scope) error {
return autoConvert_flowcontrol_PriorityLevelConfigurationStatus_To_v1beta1_PriorityLevelConfigurationStatus(in, out, s)
}
func autoConvert_v1beta1_QueuingConfiguration_To_flowcontrol_QueuingConfiguration(in *v1beta1.QueuingConfiguration, out *flowcontrol.QueuingConfiguration, s conversion.Scope) error {
out.Queues = in.Queues
out.HandSize = in.HandSize
out.QueueLengthLimit = in.QueueLengthLimit
return nil
}
// Convert_v1beta1_QueuingConfiguration_To_flowcontrol_QueuingConfiguration is an autogenerated conversion function.
func Convert_v1beta1_QueuingConfiguration_To_flowcontrol_QueuingConfiguration(in *v1beta1.QueuingConfiguration, out *flowcontrol.QueuingConfiguration, s conversion.Scope) error {
return autoConvert_v1beta1_QueuingConfiguration_To_flowcontrol_QueuingConfiguration(in, out, s)
}
func autoConvert_flowcontrol_QueuingConfiguration_To_v1beta1_QueuingConfiguration(in *flowcontrol.QueuingConfiguration, out *v1beta1.QueuingConfiguration, s conversion.Scope) error {
out.Queues = in.Queues
out.HandSize = in.HandSize
out.QueueLengthLimit = in.QueueLengthLimit
return nil
}
// Convert_flowcontrol_QueuingConfiguration_To_v1beta1_QueuingConfiguration is an autogenerated conversion function.
func Convert_flowcontrol_QueuingConfiguration_To_v1beta1_QueuingConfiguration(in *flowcontrol.QueuingConfiguration, out *v1beta1.QueuingConfiguration, s conversion.Scope) error {
return autoConvert_flowcontrol_QueuingConfiguration_To_v1beta1_QueuingConfiguration(in, out, s)
}
func autoConvert_v1beta1_ResourcePolicyRule_To_flowcontrol_ResourcePolicyRule(in *v1beta1.ResourcePolicyRule, out *flowcontrol.ResourcePolicyRule, s conversion.Scope) error {
out.Verbs = *(*[]string)(unsafe.Pointer(&in.Verbs))
out.APIGroups = *(*[]string)(unsafe.Pointer(&in.APIGroups))
out.Resources = *(*[]string)(unsafe.Pointer(&in.Resources))
out.ClusterScope = in.ClusterScope
out.Namespaces = *(*[]string)(unsafe.Pointer(&in.Namespaces))
return nil
}
// Convert_v1beta1_ResourcePolicyRule_To_flowcontrol_ResourcePolicyRule is an autogenerated conversion function.
func Convert_v1beta1_ResourcePolicyRule_To_flowcontrol_ResourcePolicyRule(in *v1beta1.ResourcePolicyRule, out *flowcontrol.ResourcePolicyRule, s conversion.Scope) error {
return autoConvert_v1beta1_ResourcePolicyRule_To_flowcontrol_ResourcePolicyRule(in, out, s)
}
func autoConvert_flowcontrol_ResourcePolicyRule_To_v1beta1_ResourcePolicyRule(in *flowcontrol.ResourcePolicyRule, out *v1beta1.ResourcePolicyRule, s conversion.Scope) error {
out.Verbs = *(*[]string)(unsafe.Pointer(&in.Verbs))
out.APIGroups = *(*[]string)(unsafe.Pointer(&in.APIGroups))
out.Resources = *(*[]string)(unsafe.Pointer(&in.Resources))
out.ClusterScope = in.ClusterScope
out.Namespaces = *(*[]string)(unsafe.Pointer(&in.Namespaces))
return nil
}
// Convert_flowcontrol_ResourcePolicyRule_To_v1beta1_ResourcePolicyRule is an autogenerated conversion function.
func Convert_flowcontrol_ResourcePolicyRule_To_v1beta1_ResourcePolicyRule(in *flowcontrol.ResourcePolicyRule, out *v1beta1.ResourcePolicyRule, s conversion.Scope) error {
return autoConvert_flowcontrol_ResourcePolicyRule_To_v1beta1_ResourcePolicyRule(in, out, s)
}
func autoConvert_v1beta1_ServiceAccountSubject_To_flowcontrol_ServiceAccountSubject(in *v1beta1.ServiceAccountSubject, out *flowcontrol.ServiceAccountSubject, s conversion.Scope) error {
out.Namespace = in.Namespace
out.Name = in.Name
return nil
}
// Convert_v1beta1_ServiceAccountSubject_To_flowcontrol_ServiceAccountSubject is an autogenerated conversion function.
func Convert_v1beta1_ServiceAccountSubject_To_flowcontrol_ServiceAccountSubject(in *v1beta1.ServiceAccountSubject, out *flowcontrol.ServiceAccountSubject, s conversion.Scope) error {
return autoConvert_v1beta1_ServiceAccountSubject_To_flowcontrol_ServiceAccountSubject(in, out, s)
}
func autoConvert_flowcontrol_ServiceAccountSubject_To_v1beta1_ServiceAccountSubject(in *flowcontrol.ServiceAccountSubject, out *v1beta1.ServiceAccountSubject, s conversion.Scope) error {
out.Namespace = in.Namespace
out.Name = in.Name
return nil
}
// Convert_flowcontrol_ServiceAccountSubject_To_v1beta1_ServiceAccountSubject is an autogenerated conversion function.
func Convert_flowcontrol_ServiceAccountSubject_To_v1beta1_ServiceAccountSubject(in *flowcontrol.ServiceAccountSubject, out *v1beta1.ServiceAccountSubject, s conversion.Scope) error {
return autoConvert_flowcontrol_ServiceAccountSubject_To_v1beta1_ServiceAccountSubject(in, out, s)
}
func autoConvert_v1beta1_Subject_To_flowcontrol_Subject(in *v1beta1.Subject, out *flowcontrol.Subject, s conversion.Scope) error {
out.Kind = flowcontrol.SubjectKind(in.Kind)
out.User = (*flowcontrol.UserSubject)(unsafe.Pointer(in.User))
out.Group = (*flowcontrol.GroupSubject)(unsafe.Pointer(in.Group))
out.ServiceAccount = (*flowcontrol.ServiceAccountSubject)(unsafe.Pointer(in.ServiceAccount))
return nil
}
// Convert_v1beta1_Subject_To_flowcontrol_Subject is an autogenerated conversion function.
func Convert_v1beta1_Subject_To_flowcontrol_Subject(in *v1beta1.Subject, out *flowcontrol.Subject, s conversion.Scope) error {
return autoConvert_v1beta1_Subject_To_flowcontrol_Subject(in, out, s)
}
func autoConvert_flowcontrol_Subject_To_v1beta1_Subject(in *flowcontrol.Subject, out *v1beta1.Subject, s conversion.Scope) error {
out.Kind = v1beta1.SubjectKind(in.Kind)
out.User = (*v1beta1.UserSubject)(unsafe.Pointer(in.User))
out.Group = (*v1beta1.GroupSubject)(unsafe.Pointer(in.Group))
out.ServiceAccount = (*v1beta1.ServiceAccountSubject)(unsafe.Pointer(in.ServiceAccount))
return nil
}
// Convert_flowcontrol_Subject_To_v1beta1_Subject is an autogenerated conversion function.
func Convert_flowcontrol_Subject_To_v1beta1_Subject(in *flowcontrol.Subject, out *v1beta1.Subject, s conversion.Scope) error {
return autoConvert_flowcontrol_Subject_To_v1beta1_Subject(in, out, s)
}
func autoConvert_v1beta1_UserSubject_To_flowcontrol_UserSubject(in *v1beta1.UserSubject, out *flowcontrol.UserSubject, s conversion.Scope) error {
out.Name = in.Name
return nil
}
// Convert_v1beta1_UserSubject_To_flowcontrol_UserSubject is an autogenerated conversion function.
func Convert_v1beta1_UserSubject_To_flowcontrol_UserSubject(in *v1beta1.UserSubject, out *flowcontrol.UserSubject, s conversion.Scope) error {
return autoConvert_v1beta1_UserSubject_To_flowcontrol_UserSubject(in, out, s)
}
func autoConvert_flowcontrol_UserSubject_To_v1beta1_UserSubject(in *flowcontrol.UserSubject, out *v1beta1.UserSubject, s conversion.Scope) error {
out.Name = in.Name
return nil
}
// Convert_flowcontrol_UserSubject_To_v1beta1_UserSubject is an autogenerated conversion function.
func Convert_flowcontrol_UserSubject_To_v1beta1_UserSubject(in *flowcontrol.UserSubject, out *v1beta1.UserSubject, s conversion.Scope) error {
return autoConvert_flowcontrol_UserSubject_To_v1beta1_UserSubject(in, out, s)
}

View File

@ -0,0 +1,68 @@
// +build !ignore_autogenerated
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by defaulter-gen. DO NOT EDIT.
package v1beta1
import (
v1beta1 "k8s.io/api/flowcontrol/v1beta1"
runtime "k8s.io/apimachinery/pkg/runtime"
)
// RegisterDefaults adds defaulters functions to the given scheme.
// Public to allow building arbitrary schemes.
// All generated defaulters are covering - they call all nested defaulters.
func RegisterDefaults(scheme *runtime.Scheme) error {
scheme.AddTypeDefaultingFunc(&v1beta1.FlowSchema{}, func(obj interface{}) { SetObjectDefaults_FlowSchema(obj.(*v1beta1.FlowSchema)) })
scheme.AddTypeDefaultingFunc(&v1beta1.FlowSchemaList{}, func(obj interface{}) { SetObjectDefaults_FlowSchemaList(obj.(*v1beta1.FlowSchemaList)) })
scheme.AddTypeDefaultingFunc(&v1beta1.PriorityLevelConfiguration{}, func(obj interface{}) {
SetObjectDefaults_PriorityLevelConfiguration(obj.(*v1beta1.PriorityLevelConfiguration))
})
scheme.AddTypeDefaultingFunc(&v1beta1.PriorityLevelConfigurationList{}, func(obj interface{}) {
SetObjectDefaults_PriorityLevelConfigurationList(obj.(*v1beta1.PriorityLevelConfigurationList))
})
return nil
}
func SetObjectDefaults_FlowSchema(in *v1beta1.FlowSchema) {
SetDefaults_FlowSchemaSpec(&in.Spec)
}
func SetObjectDefaults_FlowSchemaList(in *v1beta1.FlowSchemaList) {
for i := range in.Items {
a := &in.Items[i]
SetObjectDefaults_FlowSchema(a)
}
}
func SetObjectDefaults_PriorityLevelConfiguration(in *v1beta1.PriorityLevelConfiguration) {
if in.Spec.Limited != nil {
SetDefaults_LimitedPriorityLevelConfiguration(in.Spec.Limited)
if in.Spec.Limited.LimitResponse.Queuing != nil {
SetDefaults_QueuingConfiguration(in.Spec.Limited.LimitResponse.Queuing)
}
}
}
func SetObjectDefaults_PriorityLevelConfigurationList(in *v1beta1.PriorityLevelConfigurationList) {
for i := range in.Items {
a := &in.Items[i]
SetObjectDefaults_PriorityLevelConfiguration(a)
}
}

View File

@ -29,6 +29,7 @@ go_library(
"//pkg/apis/events/install:go_default_library",
"//pkg/apis/extensions/install:go_default_library",
"//pkg/apis/flowcontrol/install:go_default_library",
"//pkg/apis/flowcontrol/v1beta1:go_default_library",
"//pkg/apis/imagepolicy/install:go_default_library",
"//pkg/apis/networking/install:go_default_library",
"//pkg/apis/node/install:go_default_library",

View File

@ -84,6 +84,7 @@ import (
discoveryclient "k8s.io/client-go/kubernetes/typed/discovery/v1beta1"
"k8s.io/component-helpers/apimachinery/lease"
api "k8s.io/kubernetes/pkg/apis/core"
flowcontrolv1beta1 "k8s.io/kubernetes/pkg/apis/flowcontrol/v1beta1"
"k8s.io/kubernetes/pkg/controlplane/controller/apiserverleasegc"
"k8s.io/kubernetes/pkg/controlplane/controller/clusterauthenticationtrust"
"k8s.io/kubernetes/pkg/controlplane/reconcilers"
@ -686,6 +687,7 @@ func DefaultAPIResourceConfigSource() *serverstorage.ResourceConfig {
storageapiv1beta1.SchemeGroupVersion,
schedulingapiv1beta1.SchemeGroupVersion,
schedulingapiv1.SchemeGroupVersion,
flowcontrolv1beta1.SchemeGroupVersion,
)
// enable non-deprecated beta resources in extensions/v1beta1 explicitly so we have a full list of what's possible to serve
ret.EnableResources(

View File

@ -106,4 +106,6 @@ var GVRToStorageVersionHash = map[string]string{
"admissionregistration.k8s.io/v1/validatingwebhookconfigurations": "P9NhrezfnWE=",
"events.k8s.io/v1/events": "r2yiGXH7wu8=",
"events.k8s.io/v1beta1/events": "r2yiGXH7wu8=",
"flowcontrol.apiserver.k8s.io/v1beta1/flowschemas": "9bSnTLYweJ0=",
"flowcontrol.apiserver.k8s.io/v1beta1/prioritylevelconfigurations": "BFVwf8eYnsw=",
}

View File

@ -807,7 +807,7 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS
genericfeatures.APIListChunking: {Default: true, PreRelease: featuregate.Beta},
genericfeatures.DryRun: {Default: true, PreRelease: featuregate.GA},
genericfeatures.ServerSideApply: {Default: true, PreRelease: featuregate.Beta},
genericfeatures.APIPriorityAndFairness: {Default: false, PreRelease: featuregate.Alpha},
genericfeatures.APIPriorityAndFairness: {Default: true, PreRelease: featuregate.Beta},
genericfeatures.WarningHeaders: {Default: true, PreRelease: featuregate.Beta},
// features that enable backwards compatibility but are scheduled to be removed

View File

@ -94,7 +94,7 @@ go_library(
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/api/discovery/v1beta1:go_default_library",
"//staging/src/k8s.io/api/extensions/v1beta1:go_default_library",
"//staging/src/k8s.io/api/flowcontrol/v1alpha1:go_default_library",
"//staging/src/k8s.io/api/flowcontrol/v1beta1:go_default_library",
"//staging/src/k8s.io/api/policy/v1beta1:go_default_library",
"//staging/src/k8s.io/api/rbac/v1beta1:go_default_library",
"//staging/src/k8s.io/api/scheduling/v1:go_default_library",

View File

@ -35,7 +35,7 @@ import (
apiv1 "k8s.io/api/core/v1"
discoveryv1beta1 "k8s.io/api/discovery/v1beta1"
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
flowcontrolv1alpha1 "k8s.io/api/flowcontrol/v1alpha1"
flowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1"
policyv1beta1 "k8s.io/api/policy/v1beta1"
rbacv1beta1 "k8s.io/api/rbac/v1beta1"
schedulingv1 "k8s.io/api/scheduling/v1"
@ -553,9 +553,9 @@ func AddHandlers(h printers.PrintHandler) {
flowSchemaColumnDefinitions := []metav1.TableColumnDefinition{
{Name: "Name", Type: "string", Format: "name", Description: metav1.ObjectMeta{}.SwaggerDoc()["name"]},
{Name: "PriorityLevel", Type: "string", Description: flowcontrolv1alpha1.PriorityLevelConfigurationReference{}.SwaggerDoc()["name"]},
{Name: "MatchingPrecedence", Type: "string", Description: flowcontrolv1alpha1.FlowSchemaSpec{}.SwaggerDoc()["matchingPrecedence"]},
{Name: "DistinguisherMethod", Type: "string", Description: flowcontrolv1alpha1.FlowSchemaSpec{}.SwaggerDoc()["distinguisherMethod"]},
{Name: "PriorityLevel", Type: "string", Description: flowcontrolv1beta1.PriorityLevelConfigurationReference{}.SwaggerDoc()["name"]},
{Name: "MatchingPrecedence", Type: "string", Description: flowcontrolv1beta1.FlowSchemaSpec{}.SwaggerDoc()["matchingPrecedence"]},
{Name: "DistinguisherMethod", Type: "string", Description: flowcontrolv1beta1.FlowSchemaSpec{}.SwaggerDoc()["distinguisherMethod"]},
{Name: "Age", Type: "string", Description: metav1.ObjectMeta{}.SwaggerDoc()["creationTimestamp"]},
{Name: "MissingPL", Type: "string", Description: "references a broken or non-existent PriorityLevelConfiguration"},
}
@ -564,11 +564,11 @@ func AddHandlers(h printers.PrintHandler) {
priorityLevelColumnDefinitions := []metav1.TableColumnDefinition{
{Name: "Name", Type: "string", Format: "name", Description: metav1.ObjectMeta{}.SwaggerDoc()["name"]},
{Name: "Type", Type: "string", Description: flowcontrolv1alpha1.PriorityLevelConfigurationSpec{}.SwaggerDoc()["type"]},
{Name: "AssuredConcurrencyShares", Type: "string", Description: flowcontrolv1alpha1.LimitedPriorityLevelConfiguration{}.SwaggerDoc()["assuredConcurrencyShares"]},
{Name: "Queues", Type: "string", Description: flowcontrolv1alpha1.QueuingConfiguration{}.SwaggerDoc()["queues"]},
{Name: "HandSize", Type: "string", Description: flowcontrolv1alpha1.QueuingConfiguration{}.SwaggerDoc()["handSize"]},
{Name: "QueueLengthLimit", Type: "string", Description: flowcontrolv1alpha1.QueuingConfiguration{}.SwaggerDoc()["queueLengthLimit"]},
{Name: "Type", Type: "string", Description: flowcontrolv1beta1.PriorityLevelConfigurationSpec{}.SwaggerDoc()["type"]},
{Name: "AssuredConcurrencyShares", Type: "string", Description: flowcontrolv1beta1.LimitedPriorityLevelConfiguration{}.SwaggerDoc()["assuredConcurrencyShares"]},
{Name: "Queues", Type: "string", Description: flowcontrolv1beta1.QueuingConfiguration{}.SwaggerDoc()["queues"]},
{Name: "HandSize", Type: "string", Description: flowcontrolv1beta1.QueuingConfiguration{}.SwaggerDoc()["handSize"]},
{Name: "QueueLengthLimit", Type: "string", Description: flowcontrolv1beta1.QueuingConfiguration{}.SwaggerDoc()["queueLengthLimit"]},
{Name: "Age", Type: "string", Description: metav1.ObjectMeta{}.SwaggerDoc()["creationTimestamp"]},
}
h.TableHandler(priorityLevelColumnDefinitions, printPriorityLevelConfiguration)

View File

@ -9,9 +9,10 @@ go_library(
"//pkg/api/legacyscheme:go_default_library",
"//pkg/apis/flowcontrol:go_default_library",
"//pkg/apis/flowcontrol/v1alpha1:go_default_library",
"//pkg/apis/flowcontrol/v1beta1:go_default_library",
"//pkg/registry/flowcontrol/flowschema/storage:go_default_library",
"//pkg/registry/flowcontrol/prioritylevelconfiguration/storage:go_default_library",
"//staging/src/k8s.io/api/flowcontrol/v1alpha1:go_default_library",
"//staging/src/k8s.io/api/flowcontrol/v1beta1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/api/equality:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
@ -21,7 +22,7 @@ go_library(
"//staging/src/k8s.io/apiserver/pkg/registry/rest:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/server:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/server/storage:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1:go_default_library",
"//vendor/k8s.io/klog/v2:go_default_library",
],
)
@ -46,7 +47,7 @@ go_test(
embed = [":go_default_library"],
deps = [
"//pkg/apis/flowcontrol/v1alpha1:go_default_library",
"//staging/src/k8s.io/api/flowcontrol/v1alpha1:go_default_library",
"//staging/src/k8s.io/api/flowcontrol/v1beta1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/apis/flowcontrol/bootstrap:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes/fake:go_default_library",

View File

@ -21,7 +21,7 @@ import (
"fmt"
"time"
flowcontrolv1alpha1 "k8s.io/api/flowcontrol/v1alpha1"
flowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1"
"k8s.io/apimachinery/pkg/api/equality"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@ -31,11 +31,12 @@ import (
"k8s.io/apiserver/pkg/registry/rest"
genericapiserver "k8s.io/apiserver/pkg/server"
serverstorage "k8s.io/apiserver/pkg/server/storage"
flowcontrolclient "k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1"
flowcontrolclient "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1"
"k8s.io/klog/v2"
"k8s.io/kubernetes/pkg/api/legacyscheme"
"k8s.io/kubernetes/pkg/apis/flowcontrol"
flowcontrolapisv1alpha1 "k8s.io/kubernetes/pkg/apis/flowcontrol/v1alpha1"
flowcontrolapisv1beta1 "k8s.io/kubernetes/pkg/apis/flowcontrol/v1beta1"
flowschemastore "k8s.io/kubernetes/pkg/registry/flowcontrol/flowschema/storage"
prioritylevelconfigurationstore "k8s.io/kubernetes/pkg/registry/flowcontrol/prioritylevelconfiguration/storage"
)
@ -52,17 +53,21 @@ const PostStartHookName = "priority-and-fairness-config-producer"
func (p RESTStorageProvider) NewRESTStorage(apiResourceConfigSource serverstorage.APIResourceConfigSource, restOptionsGetter generic.RESTOptionsGetter) (genericapiserver.APIGroupInfo, bool, error) {
apiGroupInfo := genericapiserver.NewDefaultAPIGroupInfo(flowcontrol.GroupName, legacyscheme.Scheme, legacyscheme.ParameterCodec, legacyscheme.Codecs)
if apiResourceConfigSource.VersionEnabled(flowcontrolv1alpha1.SchemeGroupVersion) {
flowControlStorage, err := p.v1alpha1Storage(apiResourceConfigSource, restOptionsGetter)
// Flow control storage is shared across different versions.
flowControlStorage, err := p.storage(apiResourceConfigSource, restOptionsGetter)
if err != nil {
return genericapiserver.APIGroupInfo{}, false, err
}
apiGroupInfo.VersionedResourcesStorageMap[flowcontrolv1alpha1.SchemeGroupVersion.Version] = flowControlStorage
if apiResourceConfigSource.VersionEnabled(flowcontrolapisv1alpha1.SchemeGroupVersion) {
apiGroupInfo.VersionedResourcesStorageMap[flowcontrolapisv1alpha1.SchemeGroupVersion.Version] = flowControlStorage
}
if apiResourceConfigSource.VersionEnabled(flowcontrolapisv1beta1.SchemeGroupVersion) {
apiGroupInfo.VersionedResourcesStorageMap[flowcontrolapisv1beta1.SchemeGroupVersion.Version] = flowControlStorage
}
return apiGroupInfo, true, nil
}
func (p RESTStorageProvider) v1alpha1Storage(apiResourceConfigSource serverstorage.APIResourceConfigSource, restOptionsGetter generic.RESTOptionsGetter) (map[string]rest.Storage, error) {
func (p RESTStorageProvider) storage(apiResourceConfigSource serverstorage.APIResourceConfigSource, restOptionsGetter generic.RESTOptionsGetter) (map[string]rest.Storage, error) {
storage := map[string]rest.Storage{}
// flow-schema
@ -98,12 +103,12 @@ func (p RESTStorageProvider) PostStartHook() (string, genericapiserver.PostStart
_ = wait.PollImmediateUntil(
retryCreatingSuggestedSettingsInterval,
func() (bool, error) {
shouldEnsureSuggested, err := lastMandatoryExists(flowcontrolClientSet)
should, err := shouldEnsureSuggested(flowcontrolClientSet)
if err != nil {
klog.Errorf("failed getting exempt flow-schema, will retry later: %v", err)
return false, nil
}
if !shouldEnsureSuggested {
if !should {
return true, nil
}
err = ensure(
@ -141,9 +146,9 @@ func (p RESTStorageProvider) PostStartHook() (string, genericapiserver.PostStart
}
// Returns false if there's a "exempt" priority-level existing in the cluster, otherwise returns a true
// if the "exempt" priority-level is not found.
func lastMandatoryExists(flowcontrolClientSet flowcontrolclient.FlowcontrolV1alpha1Interface) (bool, error) {
// shouldEnsureSuggested checks if the exempt priority level exists and returns
// whether the suggested flow schemas and priority levels should be ensured.
func shouldEnsureSuggested(flowcontrolClientSet flowcontrolclient.FlowcontrolV1beta1Interface) (bool, error) {
if _, err := flowcontrolClientSet.PriorityLevelConfigurations().Get(context.TODO(), flowcontrol.PriorityLevelConfigurationNameExempt, metav1.GetOptions{}); err != nil {
if apierrors.IsNotFound(err) {
return true, nil
@ -155,7 +160,7 @@ func lastMandatoryExists(flowcontrolClientSet flowcontrolclient.FlowcontrolV1alp
const thisFieldManager = "api-priority-and-fairness-config-producer-v1"
func ensure(flowcontrolClientSet flowcontrolclient.FlowcontrolV1alpha1Interface, flowSchemas []*flowcontrolv1alpha1.FlowSchema, priorityLevels []*flowcontrolv1alpha1.PriorityLevelConfiguration) error {
func ensure(flowcontrolClientSet flowcontrolclient.FlowcontrolV1beta1Interface, flowSchemas []*flowcontrolv1beta1.FlowSchema, priorityLevels []*flowcontrolv1beta1.PriorityLevelConfiguration) error {
for _, flowSchema := range flowSchemas {
_, err := flowcontrolClientSet.FlowSchemas().Create(context.TODO(), flowSchema, metav1.CreateOptions{FieldManager: thisFieldManager})
if apierrors.IsAlreadyExists(err) {
@ -181,7 +186,7 @@ func ensure(flowcontrolClientSet flowcontrolclient.FlowcontrolV1alpha1Interface,
return nil
}
func upgrade(flowcontrolClientSet flowcontrolclient.FlowcontrolV1alpha1Interface, flowSchemas []*flowcontrolv1alpha1.FlowSchema, priorityLevels []*flowcontrolv1alpha1.PriorityLevelConfiguration) error {
func upgrade(flowcontrolClientSet flowcontrolclient.FlowcontrolV1beta1Interface, flowSchemas []*flowcontrolv1beta1.FlowSchema, priorityLevels []*flowcontrolv1beta1.PriorityLevelConfiguration) error {
for _, expectedFlowSchema := range flowSchemas {
actualFlowSchema, err := flowcontrolClientSet.FlowSchemas().Get(context.TODO(), expectedFlowSchema.Name, metav1.GetOptions{})
if err == nil {
@ -245,14 +250,14 @@ func upgrade(flowcontrolClientSet flowcontrolclient.FlowcontrolV1alpha1Interface
return nil
}
func flowSchemaHasWrongSpec(expected, actual *flowcontrolv1alpha1.FlowSchema) (bool, error) {
func flowSchemaHasWrongSpec(expected, actual *flowcontrolv1beta1.FlowSchema) (bool, error) {
copiedExpectedFlowSchema := expected.DeepCopy()
flowcontrolapisv1alpha1.SetObjectDefaults_FlowSchema(copiedExpectedFlowSchema)
flowcontrolapisv1beta1.SetObjectDefaults_FlowSchema(copiedExpectedFlowSchema)
return !equality.Semantic.DeepEqual(copiedExpectedFlowSchema.Spec, actual.Spec), nil
}
func priorityLevelHasWrongSpec(expected, actual *flowcontrolv1alpha1.PriorityLevelConfiguration) (bool, error) {
func priorityLevelHasWrongSpec(expected, actual *flowcontrolv1beta1.PriorityLevelConfiguration) (bool, error) {
copiedExpectedPriorityLevel := expected.DeepCopy()
flowcontrolapisv1alpha1.SetObjectDefaults_PriorityLevelConfiguration(copiedExpectedPriorityLevel)
flowcontrolapisv1beta1.SetObjectDefaults_PriorityLevelConfiguration(copiedExpectedPriorityLevel)
return !equality.Semantic.DeepEqual(copiedExpectedPriorityLevel.Spec, actual.Spec), nil
}

View File

@ -18,21 +18,21 @@ package rest
import (
"context"
"github.com/stretchr/testify/require"
"testing"
"github.com/stretchr/testify/assert"
flowcontrolv1alpha1 "k8s.io/api/flowcontrol/v1alpha1"
"github.com/stretchr/testify/require"
flowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apiserver/pkg/apis/flowcontrol/bootstrap"
"k8s.io/client-go/kubernetes/fake"
flowcontrolapisv1alpha1 "k8s.io/kubernetes/pkg/apis/flowcontrol/v1alpha1"
flowcontrolapisv1beta1 "k8s.io/kubernetes/pkg/apis/flowcontrol/v1beta1"
)
func TestShouldEnsurePredefinedSettings(t *testing.T) {
testCases := []struct {
name string
existingPriorityLevel *flowcontrolv1alpha1.PriorityLevelConfiguration
existingPriorityLevel *flowcontrolv1beta1.PriorityLevelConfiguration
expected bool
}{
{
@ -51,9 +51,9 @@ func TestShouldEnsurePredefinedSettings(t *testing.T) {
t.Run(testCase.name, func(t *testing.T) {
c := fake.NewSimpleClientset()
if testCase.existingPriorityLevel != nil {
c.FlowcontrolV1alpha1().PriorityLevelConfigurations().Create(context.TODO(), testCase.existingPriorityLevel, metav1.CreateOptions{})
c.FlowcontrolV1beta1().PriorityLevelConfigurations().Create(context.TODO(), testCase.existingPriorityLevel, metav1.CreateOptions{})
}
should, err := lastMandatoryExists(c.FlowcontrolV1alpha1())
should, err := shouldEnsureSuggested(c.FlowcontrolV1beta1())
assert.NoError(t, err)
assert.Equal(t, testCase.expected, should)
})
@ -61,23 +61,23 @@ func TestShouldEnsurePredefinedSettings(t *testing.T) {
}
func TestFlowSchemaHasWrongSpec(t *testing.T) {
fs1 := &flowcontrolv1alpha1.FlowSchema{
Spec: flowcontrolv1alpha1.FlowSchemaSpec{},
fs1 := &flowcontrolv1beta1.FlowSchema{
Spec: flowcontrolv1beta1.FlowSchemaSpec{},
}
fs2 := &flowcontrolv1alpha1.FlowSchema{
Spec: flowcontrolv1alpha1.FlowSchemaSpec{
fs2 := &flowcontrolv1beta1.FlowSchema{
Spec: flowcontrolv1beta1.FlowSchemaSpec{
MatchingPrecedence: 1,
},
}
fs1Defaulted := &flowcontrolv1alpha1.FlowSchema{
Spec: flowcontrolv1alpha1.FlowSchemaSpec{
MatchingPrecedence: flowcontrolapisv1alpha1.FlowSchemaDefaultMatchingPrecedence,
fs1Defaulted := &flowcontrolv1beta1.FlowSchema{
Spec: flowcontrolv1beta1.FlowSchemaSpec{
MatchingPrecedence: flowcontrolapisv1beta1.FlowSchemaDefaultMatchingPrecedence,
},
}
testCases := []struct {
name string
expected *flowcontrolv1alpha1.FlowSchema
actual *flowcontrolv1alpha1.FlowSchema
expected *flowcontrolv1beta1.FlowSchema
actual *flowcontrolv1beta1.FlowSchema
hasWrongSpec bool
}{
{
@ -109,39 +109,39 @@ func TestFlowSchemaHasWrongSpec(t *testing.T) {
}
func TestPriorityLevelHasWrongSpec(t *testing.T) {
pl1 := &flowcontrolv1alpha1.PriorityLevelConfiguration{
Spec: flowcontrolv1alpha1.PriorityLevelConfigurationSpec{
Type: flowcontrolv1alpha1.PriorityLevelEnablementLimited,
Limited: &flowcontrolv1alpha1.LimitedPriorityLevelConfiguration{
LimitResponse: flowcontrolv1alpha1.LimitResponse{
Type: flowcontrolv1alpha1.LimitResponseTypeReject,
pl1 := &flowcontrolv1beta1.PriorityLevelConfiguration{
Spec: flowcontrolv1beta1.PriorityLevelConfigurationSpec{
Type: flowcontrolv1beta1.PriorityLevelEnablementLimited,
Limited: &flowcontrolv1beta1.LimitedPriorityLevelConfiguration{
LimitResponse: flowcontrolv1beta1.LimitResponse{
Type: flowcontrolv1beta1.LimitResponseTypeReject,
},
},
},
}
pl2 := &flowcontrolv1alpha1.PriorityLevelConfiguration{
Spec: flowcontrolv1alpha1.PriorityLevelConfigurationSpec{
Type: flowcontrolv1alpha1.PriorityLevelEnablementLimited,
Limited: &flowcontrolv1alpha1.LimitedPriorityLevelConfiguration{
pl2 := &flowcontrolv1beta1.PriorityLevelConfiguration{
Spec: flowcontrolv1beta1.PriorityLevelConfigurationSpec{
Type: flowcontrolv1beta1.PriorityLevelEnablementLimited,
Limited: &flowcontrolv1beta1.LimitedPriorityLevelConfiguration{
AssuredConcurrencyShares: 1,
},
},
}
pl1Defaulted := &flowcontrolv1alpha1.PriorityLevelConfiguration{
Spec: flowcontrolv1alpha1.PriorityLevelConfigurationSpec{
Type: flowcontrolv1alpha1.PriorityLevelEnablementLimited,
Limited: &flowcontrolv1alpha1.LimitedPriorityLevelConfiguration{
AssuredConcurrencyShares: flowcontrolapisv1alpha1.PriorityLevelConfigurationDefaultAssuredConcurrencyShares,
LimitResponse: flowcontrolv1alpha1.LimitResponse{
Type: flowcontrolv1alpha1.LimitResponseTypeReject,
pl1Defaulted := &flowcontrolv1beta1.PriorityLevelConfiguration{
Spec: flowcontrolv1beta1.PriorityLevelConfigurationSpec{
Type: flowcontrolv1beta1.PriorityLevelEnablementLimited,
Limited: &flowcontrolv1beta1.LimitedPriorityLevelConfiguration{
AssuredConcurrencyShares: flowcontrolapisv1beta1.PriorityLevelConfigurationDefaultAssuredConcurrencyShares,
LimitResponse: flowcontrolv1beta1.LimitResponse{
Type: flowcontrolv1beta1.LimitResponseTypeReject,
},
},
},
}
testCases := []struct {
name string
expected *flowcontrolv1alpha1.PriorityLevelConfiguration
actual *flowcontrolv1alpha1.PriorityLevelConfiguration
expected *flowcontrolv1beta1.PriorityLevelConfiguration
actual *flowcontrolv1beta1.PriorityLevelConfiguration
hasWrongSpec bool
}{
{

View File

@ -96,6 +96,7 @@ filegroup(
"//staging/src/k8s.io/api/events/v1beta1:all-srcs",
"//staging/src/k8s.io/api/extensions/v1beta1:all-srcs",
"//staging/src/k8s.io/api/flowcontrol/v1alpha1:all-srcs",
"//staging/src/k8s.io/api/flowcontrol/v1beta1:all-srcs",
"//staging/src/k8s.io/api/imagepolicy/v1alpha1:all-srcs",
"//staging/src/k8s.io/api/networking/v1:all-srcs",
"//staging/src/k8s.io/api/networking/v1beta1:all-srcs",

View File

@ -9,6 +9,7 @@ go_library(
"types.go",
"types_swagger_doc_generated.go",
"zz_generated.deepcopy.go",
"zz_generated.prerelease-lifecycle.go",
],
importmap = "k8s.io/kubernetes/vendor/k8s.io/api/flowcontrol/v1alpha1",
importpath = "k8s.io/api/flowcontrol/v1alpha1",

View File

@ -17,6 +17,7 @@ limitations under the License.
// +k8s:deepcopy-gen=package
// +k8s:protobuf-gen=package
// +k8s:openapi-gen=true
// +k8s:prerelease-lifecycle-gen=true
// +groupName=flowcontrol.apiserver.k8s.io

View File

@ -60,6 +60,10 @@ const (
// +genclient
// +genclient:nonNamespaced
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +k8s:prerelease-lifecycle-gen:introduced=1.18
// +k8s:prerelease-lifecycle-gen:deprecated=1.20
// +k8s:prerelease-lifecycle-gen:removed=1.21
// +k8s:prerelease-lifecycle-gen:replacement=flowcontrol.apiserver.k8s.io,v1beta1,FlowSchema
// FlowSchema defines the schema of a group of flows. Note that a flow is made up of a set of inbound API requests with
// similar attributes and is identified by a pair of strings: the name of the FlowSchema and a "flow distinguisher".
@ -80,6 +84,10 @@ type FlowSchema struct {
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +k8s:prerelease-lifecycle-gen:introduced=1.18
// +k8s:prerelease-lifecycle-gen:deprecated=1.20
// +k8s:prerelease-lifecycle-gen:removed=1.21
// +k8s:prerelease-lifecycle-gen:replacement=flowcontrol.apiserver.k8s.io,v1beta1,FlowSchemaList
// FlowSchemaList is a list of FlowSchema objects.
type FlowSchemaList struct {
@ -327,6 +335,10 @@ type FlowSchemaConditionType string
// +genclient
// +genclient:nonNamespaced
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +k8s:prerelease-lifecycle-gen:introduced=1.18
// +k8s:prerelease-lifecycle-gen:deprecated=1.20
// +k8s:prerelease-lifecycle-gen:removed=1.21
// +k8s:prerelease-lifecycle-gen:replacement=flowcontrol.apiserver.k8s.io,v1beta1,PriorityLevelConfiguration
// PriorityLevelConfiguration represents the configuration of a priority level.
type PriorityLevelConfiguration struct {
@ -346,6 +358,10 @@ type PriorityLevelConfiguration struct {
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +k8s:prerelease-lifecycle-gen:introduced=1.18
// +k8s:prerelease-lifecycle-gen:deprecated=1.20
// +k8s:prerelease-lifecycle-gen:removed=1.21
// +k8s:prerelease-lifecycle-gen:replacement=flowcontrol.apiserver.k8s.io,v1beta1,PriorityLevelConfigurationList
// PriorityLevelConfigurationList is a list of PriorityLevelConfiguration objects.
type PriorityLevelConfigurationList struct {

View File

@ -0,0 +1,121 @@
// +build !ignore_autogenerated
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by prerelease-lifecycle-gen. DO NOT EDIT.
package v1alpha1
import (
schema "k8s.io/apimachinery/pkg/runtime/schema"
)
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
func (in *FlowSchema) APILifecycleIntroduced() (major, minor int) {
return 1, 18
}
// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor.
func (in *FlowSchema) APILifecycleDeprecated() (major, minor int) {
return 1, 20
}
// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type.
// It is controlled by "k8s:prerelease-lifecycle-gen:replacement=<group>,<version>,<kind>" tags in types.go.
func (in *FlowSchema) APILifecycleReplacement() schema.GroupVersionKind {
return schema.GroupVersionKind{Group: "flowcontrol.apiserver.k8s.io", Version: "v1beta1", Kind: "FlowSchema"}
}
// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor.
func (in *FlowSchema) APILifecycleRemoved() (major, minor int) {
return 1, 21
}
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
func (in *FlowSchemaList) APILifecycleIntroduced() (major, minor int) {
return 1, 18
}
// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor.
func (in *FlowSchemaList) APILifecycleDeprecated() (major, minor int) {
return 1, 20
}
// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type.
// It is controlled by "k8s:prerelease-lifecycle-gen:replacement=<group>,<version>,<kind>" tags in types.go.
func (in *FlowSchemaList) APILifecycleReplacement() schema.GroupVersionKind {
return schema.GroupVersionKind{Group: "flowcontrol.apiserver.k8s.io", Version: "v1beta1", Kind: "FlowSchemaList"}
}
// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor.
func (in *FlowSchemaList) APILifecycleRemoved() (major, minor int) {
return 1, 21
}
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
func (in *PriorityLevelConfiguration) APILifecycleIntroduced() (major, minor int) {
return 1, 18
}
// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor.
func (in *PriorityLevelConfiguration) APILifecycleDeprecated() (major, minor int) {
return 1, 20
}
// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type.
// It is controlled by "k8s:prerelease-lifecycle-gen:replacement=<group>,<version>,<kind>" tags in types.go.
func (in *PriorityLevelConfiguration) APILifecycleReplacement() schema.GroupVersionKind {
return schema.GroupVersionKind{Group: "flowcontrol.apiserver.k8s.io", Version: "v1beta1", Kind: "PriorityLevelConfiguration"}
}
// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor.
func (in *PriorityLevelConfiguration) APILifecycleRemoved() (major, minor int) {
return 1, 21
}
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
func (in *PriorityLevelConfigurationList) APILifecycleIntroduced() (major, minor int) {
return 1, 18
}
// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor.
func (in *PriorityLevelConfigurationList) APILifecycleDeprecated() (major, minor int) {
return 1, 20
}
// APILifecycleReplacement is an autogenerated function, returning the group, version, and kind that should be used instead of this deprecated type.
// It is controlled by "k8s:prerelease-lifecycle-gen:replacement=<group>,<version>,<kind>" tags in types.go.
func (in *PriorityLevelConfigurationList) APILifecycleReplacement() schema.GroupVersionKind {
return schema.GroupVersionKind{Group: "flowcontrol.apiserver.k8s.io", Version: "v1beta1", Kind: "PriorityLevelConfigurationList"}
}
// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor.
func (in *PriorityLevelConfigurationList) APILifecycleRemoved() (major, minor int) {
return 1, 21
}

View File

@ -0,0 +1,37 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = [
"doc.go",
"generated.pb.go",
"register.go",
"types.go",
"types_swagger_doc_generated.go",
"zz_generated.deepcopy.go",
"zz_generated.prerelease-lifecycle.go",
],
importmap = "k8s.io/kubernetes/vendor/k8s.io/api/flowcontrol/v1beta1",
importpath = "k8s.io/api/flowcontrol/v1beta1",
visibility = ["//visibility:public"],
deps = [
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//vendor/github.com/gogo/protobuf/proto:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,25 @@
/*
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// +k8s:deepcopy-gen=package
// +k8s:protobuf-gen=package
// +k8s:openapi-gen=true
// +k8s:prerelease-lifecycle-gen=true
// +groupName=flowcontrol.apiserver.k8s.io
// Package v1beta1 holds api types of version v1alpha1 for group "flowcontrol.apiserver.k8s.io".
package v1beta1 // import "k8s.io/api/flowcontrol/v1beta1"

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,434 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This file was autogenerated by go-to-protobuf. Do not edit it manually!
syntax = "proto2";
package k8s.io.api.flowcontrol.v1beta1;
import "k8s.io/apimachinery/pkg/apis/meta/v1/generated.proto";
import "k8s.io/apimachinery/pkg/runtime/generated.proto";
import "k8s.io/apimachinery/pkg/runtime/schema/generated.proto";
// Package-wide variables from generator "generated".
option go_package = "v1beta1";
// FlowDistinguisherMethod specifies the method of a flow distinguisher.
message FlowDistinguisherMethod {
// `type` is the type of flow distinguisher method
// The supported types are "ByUser" and "ByNamespace".
// Required.
optional string type = 1;
}
// FlowSchema defines the schema of a group of flows. Note that a flow is made up of a set of inbound API requests with
// similar attributes and is identified by a pair of strings: the name of the FlowSchema and a "flow distinguisher".
message FlowSchema {
// `metadata` is the standard object's metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
// +optional
optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
// `spec` is the specification of the desired behavior of a FlowSchema.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
// +optional
optional FlowSchemaSpec spec = 2;
// `status` is the current status of a FlowSchema.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
// +optional
optional FlowSchemaStatus status = 3;
}
// FlowSchemaCondition describes conditions for a FlowSchema.
message FlowSchemaCondition {
// `type` is the type of the condition.
// Required.
optional string type = 1;
// `status` is the status of the condition.
// Can be True, False, Unknown.
// Required.
optional string status = 2;
// `lastTransitionTime` is the last time the condition transitioned from one status to another.
optional k8s.io.apimachinery.pkg.apis.meta.v1.Time lastTransitionTime = 3;
// `reason` is a unique, one-word, CamelCase reason for the condition's last transition.
optional string reason = 4;
// `message` is a human-readable message indicating details about last transition.
optional string message = 5;
}
// FlowSchemaList is a list of FlowSchema objects.
message FlowSchemaList {
// `metadata` is the standard list metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
// +optional
optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
// `items` is a list of FlowSchemas.
repeated FlowSchema items = 2;
}
// FlowSchemaSpec describes how the FlowSchema's specification looks like.
message FlowSchemaSpec {
// `priorityLevelConfiguration` should reference a PriorityLevelConfiguration in the cluster. If the reference cannot
// be resolved, the FlowSchema will be ignored and marked as invalid in its status.
// Required.
optional PriorityLevelConfigurationReference priorityLevelConfiguration = 1;
// `matchingPrecedence` is used to choose among the FlowSchemas that match a given request. The chosen
// FlowSchema is among those with the numerically lowest (which we take to be logically highest)
// MatchingPrecedence. Each MatchingPrecedence value must be ranged in [1,10000].
// Note that if the precedence is not specified, it will be set to 1000 as default.
// +optional
optional int32 matchingPrecedence = 2;
// `distinguisherMethod` defines how to compute the flow distinguisher for requests that match this schema.
// `nil` specifies that the distinguisher is disabled and thus will always be the empty string.
// +optional
optional FlowDistinguisherMethod distinguisherMethod = 3;
// `rules` describes which requests will match this flow schema. This FlowSchema matches a request if and only if
// at least one member of rules matches the request.
// if it is an empty slice, there will be no requests matching the FlowSchema.
// +listType=atomic
// +optional
repeated PolicyRulesWithSubjects rules = 4;
}
// FlowSchemaStatus represents the current state of a FlowSchema.
message FlowSchemaStatus {
// `conditions` is a list of the current states of FlowSchema.
// +listType=map
// +listMapKey=type
// +optional
repeated FlowSchemaCondition conditions = 1;
}
// GroupSubject holds detailed information for group-kind subject.
message GroupSubject {
// name is the user group that matches, or "*" to match all user groups.
// See https://github.com/kubernetes/apiserver/blob/master/pkg/authentication/user/user.go for some
// well-known group names.
// Required.
optional string name = 1;
}
// LimitResponse defines how to handle requests that can not be executed right now.
// +union
message LimitResponse {
// `type` is "Queue" or "Reject".
// "Queue" means that requests that can not be executed upon arrival
// are held in a queue until they can be executed or a queuing limit
// is reached.
// "Reject" means that requests that can not be executed upon arrival
// are rejected.
// Required.
// +unionDiscriminator
optional string type = 1;
// `queuing` holds the configuration parameters for queuing.
// This field may be non-empty only if `type` is `"Queue"`.
// +optional
optional QueuingConfiguration queuing = 2;
}
// LimitedPriorityLevelConfiguration specifies how to handle requests that are subject to limits.
// It addresses two issues:
// * How are requests for this priority level limited?
// * What should be done with requests that exceed the limit?
message LimitedPriorityLevelConfiguration {
// `assuredConcurrencyShares` (ACS) configures the execution
// limit, which is a limit on the number of requests of this
// priority level that may be exeucting at a given time. ACS must
// be a positive number. The server's concurrency limit (SCL) is
// divided among the concurrency-controlled priority levels in
// proportion to their assured concurrency shares. This produces
// the assured concurrency value (ACV) --- the number of requests
// that may be executing at a time --- for each such priority
// level:
//
// ACV(l) = ceil( SCL * ACS(l) / ( sum[priority levels k] ACS(k) ) )
//
// bigger numbers of ACS mean more reserved concurrent requests (at the
// expense of every other PL).
// This field has a default value of 30.
// +optional
optional int32 assuredConcurrencyShares = 1;
// `limitResponse` indicates what to do with requests that can not be executed right now
optional LimitResponse limitResponse = 2;
}
// NonResourcePolicyRule is a predicate that matches non-resource requests according to their verb and the
// target non-resource URL. A NonResourcePolicyRule matches a request if and only if both (a) at least one member
// of verbs matches the request and (b) at least one member of nonResourceURLs matches the request.
message NonResourcePolicyRule {
// `verbs` is a list of matching verbs and may not be empty.
// "*" matches all verbs. If it is present, it must be the only entry.
// +listType=set
// Required.
repeated string verbs = 1;
// `nonResourceURLs` is a set of url prefixes that a user should have access to and may not be empty.
// For example:
// - "/healthz" is legal
// - "/hea*" is illegal
// - "/hea" is legal but matches nothing
// - "/hea/*" also matches nothing
// - "/healthz/*" matches all per-component health checks.
// "*" matches all non-resource urls. if it is present, it must be the only entry.
// +listType=set
// Required.
repeated string nonResourceURLs = 6;
}
// PolicyRulesWithSubjects prescribes a test that applies to a request to an apiserver. The test considers the subject
// making the request, the verb being requested, and the resource to be acted upon. This PolicyRulesWithSubjects matches
// a request if and only if both (a) at least one member of subjects matches the request and (b) at least one member
// of resourceRules or nonResourceRules matches the request.
message PolicyRulesWithSubjects {
// subjects is the list of normal user, serviceaccount, or group that this rule cares about.
// There must be at least one member in this slice.
// A slice that includes both the system:authenticated and system:unauthenticated user groups matches every request.
// +listType=atomic
// Required.
repeated Subject subjects = 1;
// `resourceRules` is a slice of ResourcePolicyRules that identify matching requests according to their verb and the
// target resource.
// At least one of `resourceRules` and `nonResourceRules` has to be non-empty.
// +listType=atomic
// +optional
repeated ResourcePolicyRule resourceRules = 2;
// `nonResourceRules` is a list of NonResourcePolicyRules that identify matching requests according to their verb
// and the target non-resource URL.
// +listType=atomic
// +optional
repeated NonResourcePolicyRule nonResourceRules = 3;
}
// PriorityLevelConfiguration represents the configuration of a priority level.
message PriorityLevelConfiguration {
// `metadata` is the standard object's metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
// +optional
optional k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
// `spec` is the specification of the desired behavior of a "request-priority".
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
// +optional
optional PriorityLevelConfigurationSpec spec = 2;
// `status` is the current status of a "request-priority".
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
// +optional
optional PriorityLevelConfigurationStatus status = 3;
}
// PriorityLevelConfigurationCondition defines the condition of priority level.
message PriorityLevelConfigurationCondition {
// `type` is the type of the condition.
// Required.
optional string type = 1;
// `status` is the status of the condition.
// Can be True, False, Unknown.
// Required.
optional string status = 2;
// `lastTransitionTime` is the last time the condition transitioned from one status to another.
optional k8s.io.apimachinery.pkg.apis.meta.v1.Time lastTransitionTime = 3;
// `reason` is a unique, one-word, CamelCase reason for the condition's last transition.
optional string reason = 4;
// `message` is a human-readable message indicating details about last transition.
optional string message = 5;
}
// PriorityLevelConfigurationList is a list of PriorityLevelConfiguration objects.
message PriorityLevelConfigurationList {
// `metadata` is the standard object's metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
// +optional
optional k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
// `items` is a list of request-priorities.
repeated PriorityLevelConfiguration items = 2;
}
// PriorityLevelConfigurationReference contains information that points to the "request-priority" being used.
message PriorityLevelConfigurationReference {
// `name` is the name of the priority level configuration being referenced
// Required.
optional string name = 1;
}
// PriorityLevelConfigurationSpec specifies the configuration of a priority level.
// +union
message PriorityLevelConfigurationSpec {
// `type` indicates whether this priority level is subject to
// limitation on request execution. A value of `"Exempt"` means
// that requests of this priority level are not subject to a limit
// (and thus are never queued) and do not detract from the
// capacity made available to other priority levels. A value of
// `"Limited"` means that (a) requests of this priority level
// _are_ subject to limits and (b) some of the server's limited
// capacity is made available exclusively to this priority level.
// Required.
// +unionDiscriminator
optional string type = 1;
// `limited` specifies how requests are handled for a Limited priority level.
// This field must be non-empty if and only if `type` is `"Limited"`.
// +optional
optional LimitedPriorityLevelConfiguration limited = 2;
}
// PriorityLevelConfigurationStatus represents the current state of a "request-priority".
message PriorityLevelConfigurationStatus {
// `conditions` is the current state of "request-priority".
// +listType=map
// +listMapKey=type
// +optional
repeated PriorityLevelConfigurationCondition conditions = 1;
}
// QueuingConfiguration holds the configuration parameters for queuing
message QueuingConfiguration {
// `queues` is the number of queues for this priority level. The
// queues exist independently at each apiserver. The value must be
// positive. Setting it to 1 effectively precludes
// shufflesharding and thus makes the distinguisher method of
// associated flow schemas irrelevant. This field has a default
// value of 64.
// +optional
optional int32 queues = 1;
// `handSize` is a small positive number that configures the
// shuffle sharding of requests into queues. When enqueuing a request
// at this priority level the request's flow identifier (a string
// pair) is hashed and the hash value is used to shuffle the list
// of queues and deal a hand of the size specified here. The
// request is put into one of the shortest queues in that hand.
// `handSize` must be no larger than `queues`, and should be
// significantly smaller (so that a few heavy flows do not
// saturate most of the queues). See the user-facing
// documentation for more extensive guidance on setting this
// field. This field has a default value of 8.
// +optional
optional int32 handSize = 2;
// `queueLengthLimit` is the maximum number of requests allowed to
// be waiting in a given queue of this priority level at a time;
// excess requests are rejected. This value must be positive. If
// not specified, it will be defaulted to 50.
// +optional
optional int32 queueLengthLimit = 3;
}
// ResourcePolicyRule is a predicate that matches some resource
// requests, testing the request's verb and the target resource. A
// ResourcePolicyRule matches a resource request if and only if: (a)
// at least one member of verbs matches the request, (b) at least one
// member of apiGroups matches the request, (c) at least one member of
// resources matches the request, and (d) least one member of
// namespaces matches the request.
message ResourcePolicyRule {
// `verbs` is a list of matching verbs and may not be empty.
// "*" matches all verbs and, if present, must be the only entry.
// +listType=set
// Required.
repeated string verbs = 1;
// `apiGroups` is a list of matching API groups and may not be empty.
// "*" matches all API groups and, if present, must be the only entry.
// +listType=set
// Required.
repeated string apiGroups = 2;
// `resources` is a list of matching resources (i.e., lowercase
// and plural) with, if desired, subresource. For example, [
// "services", "nodes/status" ]. This list may not be empty.
// "*" matches all resources and, if present, must be the only entry.
// Required.
// +listType=set
repeated string resources = 3;
// `clusterScope` indicates whether to match requests that do not
// specify a namespace (which happens either because the resource
// is not namespaced or the request targets all namespaces).
// If this field is omitted or false then the `namespaces` field
// must contain a non-empty list.
// +optional
optional bool clusterScope = 4;
// `namespaces` is a list of target namespaces that restricts
// matches. A request that specifies a target namespace matches
// only if either (a) this list contains that target namespace or
// (b) this list contains "*". Note that "*" matches any
// specified namespace but does not match a request that _does
// not specify_ a namespace (see the `clusterScope` field for
// that).
// This list may be empty, but only if `clusterScope` is true.
// +optional
// +listType=set
repeated string namespaces = 5;
}
// ServiceAccountSubject holds detailed information for service-account-kind subject.
message ServiceAccountSubject {
// `namespace` is the namespace of matching ServiceAccount objects.
// Required.
optional string namespace = 1;
// `name` is the name of matching ServiceAccount objects, or "*" to match regardless of name.
// Required.
optional string name = 2;
}
// Subject matches the originator of a request, as identified by the request authentication system. There are three
// ways of matching an originator; by user, group, or service account.
// +union
message Subject {
// Required
// +unionDiscriminator
optional string kind = 1;
// +optional
optional UserSubject user = 2;
// +optional
optional GroupSubject group = 3;
// +optional
optional ServiceAccountSubject serviceAccount = 4;
}
// UserSubject holds detailed information for user-kind subject.
message UserSubject {
// `name` is the username that matches, or "*" to match all usernames.
// Required.
optional string name = 1;
}

View File

@ -0,0 +1,58 @@
/*
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1beta1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)
// GroupName is the name of api group
const GroupName = "flowcontrol.apiserver.k8s.io"
// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: "v1beta1"}
// Kind takes an unqualified kind and returns a Group qualified GroupKind
func Kind(kind string) schema.GroupKind {
return SchemeGroupVersion.WithKind(kind).GroupKind()
}
// Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}
var (
// SchemeBuilder installs the api group to a scheme
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)
// AddToScheme adds api to a scheme
AddToScheme = SchemeBuilder.AddToScheme
)
// Adds the list of known types to the given scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&FlowSchema{},
&FlowSchemaList{},
&PriorityLevelConfiguration{},
&PriorityLevelConfigurationList{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
}

View File

@ -0,0 +1,529 @@
/*
Copyright 2019 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1beta1
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// These are valid wildcards.
const (
APIGroupAll = "*"
ResourceAll = "*"
VerbAll = "*"
NonResourceAll = "*"
NameAll = "*"
NamespaceEvery = "*" // matches every particular namespace
)
// System preset priority level names
const (
PriorityLevelConfigurationNameExempt = "exempt"
PriorityLevelConfigurationNameCatchAll = "catch-all"
FlowSchemaNameExempt = "exempt"
FlowSchemaNameCatchAll = "catch-all"
)
// Conditions
const (
FlowSchemaConditionDangling = "Dangling"
PriorityLevelConfigurationConditionConcurrencyShared = "ConcurrencyShared"
)
// Constants used by api validation.
const (
FlowSchemaMaxMatchingPrecedence int32 = 10000
)
// Constants for apiserver response headers.
const (
ResponseHeaderMatchedPriorityLevelConfigurationUID = "X-Kubernetes-PF-PriorityLevel-UID"
ResponseHeaderMatchedFlowSchemaUID = "X-Kubernetes-PF-FlowSchema-UID"
)
// +genclient
// +genclient:nonNamespaced
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +k8s:prerelease-lifecycle-gen:introduced=1.20
// FlowSchema defines the schema of a group of flows. Note that a flow is made up of a set of inbound API requests with
// similar attributes and is identified by a pair of strings: the name of the FlowSchema and a "flow distinguisher".
type FlowSchema struct {
metav1.TypeMeta `json:",inline"`
// `metadata` is the standard object's metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
// +optional
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// `spec` is the specification of the desired behavior of a FlowSchema.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
// +optional
Spec FlowSchemaSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
// `status` is the current status of a FlowSchema.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
// +optional
Status FlowSchemaStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +k8s:prerelease-lifecycle-gen:introduced=1.20
// FlowSchemaList is a list of FlowSchema objects.
type FlowSchemaList struct {
metav1.TypeMeta `json:",inline"`
// `metadata` is the standard list metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
// +optional
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// `items` is a list of FlowSchemas.
Items []FlowSchema `json:"items" protobuf:"bytes,2,rep,name=items"`
}
// FlowSchemaSpec describes how the FlowSchema's specification looks like.
type FlowSchemaSpec struct {
// `priorityLevelConfiguration` should reference a PriorityLevelConfiguration in the cluster. If the reference cannot
// be resolved, the FlowSchema will be ignored and marked as invalid in its status.
// Required.
PriorityLevelConfiguration PriorityLevelConfigurationReference `json:"priorityLevelConfiguration" protobuf:"bytes,1,opt,name=priorityLevelConfiguration"`
// `matchingPrecedence` is used to choose among the FlowSchemas that match a given request. The chosen
// FlowSchema is among those with the numerically lowest (which we take to be logically highest)
// MatchingPrecedence. Each MatchingPrecedence value must be ranged in [1,10000].
// Note that if the precedence is not specified, it will be set to 1000 as default.
// +optional
MatchingPrecedence int32 `json:"matchingPrecedence" protobuf:"varint,2,opt,name=matchingPrecedence"`
// `distinguisherMethod` defines how to compute the flow distinguisher for requests that match this schema.
// `nil` specifies that the distinguisher is disabled and thus will always be the empty string.
// +optional
DistinguisherMethod *FlowDistinguisherMethod `json:"distinguisherMethod,omitempty" protobuf:"bytes,3,opt,name=distinguisherMethod"`
// `rules` describes which requests will match this flow schema. This FlowSchema matches a request if and only if
// at least one member of rules matches the request.
// if it is an empty slice, there will be no requests matching the FlowSchema.
// +listType=atomic
// +optional
Rules []PolicyRulesWithSubjects `json:"rules,omitempty" protobuf:"bytes,4,rep,name=rules"`
}
// FlowDistinguisherMethodType is the type of flow distinguisher method
type FlowDistinguisherMethodType string
// These are valid flow-distinguisher methods.
const (
// FlowDistinguisherMethodByUserType specifies that the flow distinguisher is the username in the request.
// This type is used to provide some insulation between users.
FlowDistinguisherMethodByUserType FlowDistinguisherMethodType = "ByUser"
// FlowDistinguisherMethodByNamespaceType specifies that the flow distinguisher is the namespace of the
// object that the request acts upon. If the object is not namespaced, or if the request is a non-resource
// request, then the distinguisher will be the empty string. An example usage of this type is to provide
// some insulation between tenants in a situation where there are multiple tenants and each namespace
// is dedicated to a tenant.
FlowDistinguisherMethodByNamespaceType FlowDistinguisherMethodType = "ByNamespace"
)
// FlowDistinguisherMethod specifies the method of a flow distinguisher.
type FlowDistinguisherMethod struct {
// `type` is the type of flow distinguisher method
// The supported types are "ByUser" and "ByNamespace".
// Required.
Type FlowDistinguisherMethodType `json:"type" protobuf:"bytes,1,opt,name=type"`
}
// PriorityLevelConfigurationReference contains information that points to the "request-priority" being used.
type PriorityLevelConfigurationReference struct {
// `name` is the name of the priority level configuration being referenced
// Required.
Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
}
// PolicyRulesWithSubjects prescribes a test that applies to a request to an apiserver. The test considers the subject
// making the request, the verb being requested, and the resource to be acted upon. This PolicyRulesWithSubjects matches
// a request if and only if both (a) at least one member of subjects matches the request and (b) at least one member
// of resourceRules or nonResourceRules matches the request.
type PolicyRulesWithSubjects struct {
// subjects is the list of normal user, serviceaccount, or group that this rule cares about.
// There must be at least one member in this slice.
// A slice that includes both the system:authenticated and system:unauthenticated user groups matches every request.
// +listType=atomic
// Required.
Subjects []Subject `json:"subjects" protobuf:"bytes,1,rep,name=subjects"`
// `resourceRules` is a slice of ResourcePolicyRules that identify matching requests according to their verb and the
// target resource.
// At least one of `resourceRules` and `nonResourceRules` has to be non-empty.
// +listType=atomic
// +optional
ResourceRules []ResourcePolicyRule `json:"resourceRules,omitempty" protobuf:"bytes,2,opt,name=resourceRules"`
// `nonResourceRules` is a list of NonResourcePolicyRules that identify matching requests according to their verb
// and the target non-resource URL.
// +listType=atomic
// +optional
NonResourceRules []NonResourcePolicyRule `json:"nonResourceRules,omitempty" protobuf:"bytes,3,opt,name=nonResourceRules"`
}
// Subject matches the originator of a request, as identified by the request authentication system. There are three
// ways of matching an originator; by user, group, or service account.
// +union
type Subject struct {
// Required
// +unionDiscriminator
Kind SubjectKind `json:"kind" protobuf:"bytes,1,opt,name=kind"`
// +optional
User *UserSubject `json:"user,omitempty" protobuf:"bytes,2,opt,name=user"`
// +optional
Group *GroupSubject `json:"group,omitempty" protobuf:"bytes,3,opt,name=group"`
// +optional
ServiceAccount *ServiceAccountSubject `json:"serviceAccount,omitempty" protobuf:"bytes,4,opt,name=serviceAccount"`
}
// SubjectKind is the kind of subject.
type SubjectKind string
// Supported subject's kinds.
const (
SubjectKindUser SubjectKind = "User"
SubjectKindGroup SubjectKind = "Group"
SubjectKindServiceAccount SubjectKind = "ServiceAccount"
)
// UserSubject holds detailed information for user-kind subject.
type UserSubject struct {
// `name` is the username that matches, or "*" to match all usernames.
// Required.
Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
}
// GroupSubject holds detailed information for group-kind subject.
type GroupSubject struct {
// name is the user group that matches, or "*" to match all user groups.
// See https://github.com/kubernetes/apiserver/blob/master/pkg/authentication/user/user.go for some
// well-known group names.
// Required.
Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
}
// ServiceAccountSubject holds detailed information for service-account-kind subject.
type ServiceAccountSubject struct {
// `namespace` is the namespace of matching ServiceAccount objects.
// Required.
Namespace string `json:"namespace" protobuf:"bytes,1,opt,name=namespace"`
// `name` is the name of matching ServiceAccount objects, or "*" to match regardless of name.
// Required.
Name string `json:"name" protobuf:"bytes,2,opt,name=name"`
}
// ResourcePolicyRule is a predicate that matches some resource
// requests, testing the request's verb and the target resource. A
// ResourcePolicyRule matches a resource request if and only if: (a)
// at least one member of verbs matches the request, (b) at least one
// member of apiGroups matches the request, (c) at least one member of
// resources matches the request, and (d) least one member of
// namespaces matches the request.
type ResourcePolicyRule struct {
// `verbs` is a list of matching verbs and may not be empty.
// "*" matches all verbs and, if present, must be the only entry.
// +listType=set
// Required.
Verbs []string `json:"verbs" protobuf:"bytes,1,rep,name=verbs"`
// `apiGroups` is a list of matching API groups and may not be empty.
// "*" matches all API groups and, if present, must be the only entry.
// +listType=set
// Required.
APIGroups []string `json:"apiGroups" protobuf:"bytes,2,rep,name=apiGroups"`
// `resources` is a list of matching resources (i.e., lowercase
// and plural) with, if desired, subresource. For example, [
// "services", "nodes/status" ]. This list may not be empty.
// "*" matches all resources and, if present, must be the only entry.
// Required.
// +listType=set
Resources []string `json:"resources" protobuf:"bytes,3,rep,name=resources"`
// `clusterScope` indicates whether to match requests that do not
// specify a namespace (which happens either because the resource
// is not namespaced or the request targets all namespaces).
// If this field is omitted or false then the `namespaces` field
// must contain a non-empty list.
// +optional
ClusterScope bool `json:"clusterScope,omitempty" protobuf:"varint,4,opt,name=clusterScope"`
// `namespaces` is a list of target namespaces that restricts
// matches. A request that specifies a target namespace matches
// only if either (a) this list contains that target namespace or
// (b) this list contains "*". Note that "*" matches any
// specified namespace but does not match a request that _does
// not specify_ a namespace (see the `clusterScope` field for
// that).
// This list may be empty, but only if `clusterScope` is true.
// +optional
// +listType=set
Namespaces []string `json:"namespaces" protobuf:"bytes,5,rep,name=namespaces"`
}
// NonResourcePolicyRule is a predicate that matches non-resource requests according to their verb and the
// target non-resource URL. A NonResourcePolicyRule matches a request if and only if both (a) at least one member
// of verbs matches the request and (b) at least one member of nonResourceURLs matches the request.
type NonResourcePolicyRule struct {
// `verbs` is a list of matching verbs and may not be empty.
// "*" matches all verbs. If it is present, it must be the only entry.
// +listType=set
// Required.
Verbs []string `json:"verbs" protobuf:"bytes,1,rep,name=verbs"`
// `nonResourceURLs` is a set of url prefixes that a user should have access to and may not be empty.
// For example:
// - "/healthz" is legal
// - "/hea*" is illegal
// - "/hea" is legal but matches nothing
// - "/hea/*" also matches nothing
// - "/healthz/*" matches all per-component health checks.
// "*" matches all non-resource urls. if it is present, it must be the only entry.
// +listType=set
// Required.
NonResourceURLs []string `json:"nonResourceURLs" protobuf:"bytes,6,rep,name=nonResourceURLs"`
}
// FlowSchemaStatus represents the current state of a FlowSchema.
type FlowSchemaStatus struct {
// `conditions` is a list of the current states of FlowSchema.
// +listType=map
// +listMapKey=type
// +optional
Conditions []FlowSchemaCondition `json:"conditions,omitempty" protobuf:"bytes,1,rep,name=conditions"`
}
// FlowSchemaCondition describes conditions for a FlowSchema.
type FlowSchemaCondition struct {
// `type` is the type of the condition.
// Required.
Type FlowSchemaConditionType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type"`
// `status` is the status of the condition.
// Can be True, False, Unknown.
// Required.
Status ConditionStatus `json:"status,omitempty" protobuf:"bytes,2,opt,name=status"`
// `lastTransitionTime` is the last time the condition transitioned from one status to another.
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,3,opt,name=lastTransitionTime"`
// `reason` is a unique, one-word, CamelCase reason for the condition's last transition.
Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"`
// `message` is a human-readable message indicating details about last transition.
Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"`
}
// FlowSchemaConditionType is a valid value for FlowSchemaStatusCondition.Type
type FlowSchemaConditionType string
// +genclient
// +genclient:nonNamespaced
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +k8s:prerelease-lifecycle-gen:introduced=1.20
// PriorityLevelConfiguration represents the configuration of a priority level.
type PriorityLevelConfiguration struct {
metav1.TypeMeta `json:",inline"`
// `metadata` is the standard object's metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
// +optional
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// `spec` is the specification of the desired behavior of a "request-priority".
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
// +optional
Spec PriorityLevelConfigurationSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
// `status` is the current status of a "request-priority".
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
// +optional
Status PriorityLevelConfigurationStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
}
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +k8s:prerelease-lifecycle-gen:introduced=1.20
// PriorityLevelConfigurationList is a list of PriorityLevelConfiguration objects.
type PriorityLevelConfigurationList struct {
metav1.TypeMeta `json:",inline"`
// `metadata` is the standard object's metadata.
// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
// +optional
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// `items` is a list of request-priorities.
Items []PriorityLevelConfiguration `json:"items" protobuf:"bytes,2,rep,name=items"`
}
// PriorityLevelConfigurationSpec specifies the configuration of a priority level.
// +union
type PriorityLevelConfigurationSpec struct {
// `type` indicates whether this priority level is subject to
// limitation on request execution. A value of `"Exempt"` means
// that requests of this priority level are not subject to a limit
// (and thus are never queued) and do not detract from the
// capacity made available to other priority levels. A value of
// `"Limited"` means that (a) requests of this priority level
// _are_ subject to limits and (b) some of the server's limited
// capacity is made available exclusively to this priority level.
// Required.
// +unionDiscriminator
Type PriorityLevelEnablement `json:"type" protobuf:"bytes,1,opt,name=type"`
// `limited` specifies how requests are handled for a Limited priority level.
// This field must be non-empty if and only if `type` is `"Limited"`.
// +optional
Limited *LimitedPriorityLevelConfiguration `json:"limited,omitempty" protobuf:"bytes,2,opt,name=limited"`
}
// PriorityLevelEnablement indicates whether limits on execution are enabled for the priority level
type PriorityLevelEnablement string
// Supported priority level enablement values.
const (
// PriorityLevelEnablementExempt means that requests are not subject to limits
PriorityLevelEnablementExempt PriorityLevelEnablement = "Exempt"
// PriorityLevelEnablementLimited means that requests are subject to limits
PriorityLevelEnablementLimited PriorityLevelEnablement = "Limited"
)
// LimitedPriorityLevelConfiguration specifies how to handle requests that are subject to limits.
// It addresses two issues:
// * How are requests for this priority level limited?
// * What should be done with requests that exceed the limit?
type LimitedPriorityLevelConfiguration struct {
// `assuredConcurrencyShares` (ACS) configures the execution
// limit, which is a limit on the number of requests of this
// priority level that may be exeucting at a given time. ACS must
// be a positive number. The server's concurrency limit (SCL) is
// divided among the concurrency-controlled priority levels in
// proportion to their assured concurrency shares. This produces
// the assured concurrency value (ACV) --- the number of requests
// that may be executing at a time --- for each such priority
// level:
//
// ACV(l) = ceil( SCL * ACS(l) / ( sum[priority levels k] ACS(k) ) )
//
// bigger numbers of ACS mean more reserved concurrent requests (at the
// expense of every other PL).
// This field has a default value of 30.
// +optional
AssuredConcurrencyShares int32 `json:"assuredConcurrencyShares" protobuf:"varint,1,opt,name=assuredConcurrencyShares"`
// `limitResponse` indicates what to do with requests that can not be executed right now
LimitResponse LimitResponse `json:"limitResponse,omitempty" protobuf:"bytes,2,opt,name=limitResponse"`
}
// LimitResponse defines how to handle requests that can not be executed right now.
// +union
type LimitResponse struct {
// `type` is "Queue" or "Reject".
// "Queue" means that requests that can not be executed upon arrival
// are held in a queue until they can be executed or a queuing limit
// is reached.
// "Reject" means that requests that can not be executed upon arrival
// are rejected.
// Required.
// +unionDiscriminator
Type LimitResponseType `json:"type" protobuf:"bytes,1,opt,name=type"`
// `queuing` holds the configuration parameters for queuing.
// This field may be non-empty only if `type` is `"Queue"`.
// +optional
Queuing *QueuingConfiguration `json:"queuing,omitempty" protobuf:"bytes,2,opt,name=queuing"`
}
// LimitResponseType identifies how a Limited priority level handles a request that can not be executed right now
type LimitResponseType string
// Supported limit responses.
const (
// LimitResponseTypeQueue means that requests that can not be executed right now are queued until they can be executed or a queuing limit is hit
LimitResponseTypeQueue LimitResponseType = "Queue"
// LimitResponseTypeReject means that requests that can not be executed right now are rejected
LimitResponseTypeReject LimitResponseType = "Reject"
)
// QueuingConfiguration holds the configuration parameters for queuing
type QueuingConfiguration struct {
// `queues` is the number of queues for this priority level. The
// queues exist independently at each apiserver. The value must be
// positive. Setting it to 1 effectively precludes
// shufflesharding and thus makes the distinguisher method of
// associated flow schemas irrelevant. This field has a default
// value of 64.
// +optional
Queues int32 `json:"queues" protobuf:"varint,1,opt,name=queues"`
// `handSize` is a small positive number that configures the
// shuffle sharding of requests into queues. When enqueuing a request
// at this priority level the request's flow identifier (a string
// pair) is hashed and the hash value is used to shuffle the list
// of queues and deal a hand of the size specified here. The
// request is put into one of the shortest queues in that hand.
// `handSize` must be no larger than `queues`, and should be
// significantly smaller (so that a few heavy flows do not
// saturate most of the queues). See the user-facing
// documentation for more extensive guidance on setting this
// field. This field has a default value of 8.
// +optional
HandSize int32 `json:"handSize" protobuf:"varint,2,opt,name=handSize"`
// `queueLengthLimit` is the maximum number of requests allowed to
// be waiting in a given queue of this priority level at a time;
// excess requests are rejected. This value must be positive. If
// not specified, it will be defaulted to 50.
// +optional
QueueLengthLimit int32 `json:"queueLengthLimit" protobuf:"varint,3,opt,name=queueLengthLimit"`
}
// PriorityLevelConfigurationConditionType is a valid value for PriorityLevelConfigurationStatusCondition.Type
type PriorityLevelConfigurationConditionType string
// PriorityLevelConfigurationStatus represents the current state of a "request-priority".
type PriorityLevelConfigurationStatus struct {
// `conditions` is the current state of "request-priority".
// +listType=map
// +listMapKey=type
// +optional
Conditions []PriorityLevelConfigurationCondition `json:"conditions,omitempty" protobuf:"bytes,1,rep,name=conditions"`
}
// PriorityLevelConfigurationCondition defines the condition of priority level.
type PriorityLevelConfigurationCondition struct {
// `type` is the type of the condition.
// Required.
Type PriorityLevelConfigurationConditionType `json:"type,omitempty" protobuf:"bytes,1,opt,name=type"`
// `status` is the status of the condition.
// Can be True, False, Unknown.
// Required.
Status ConditionStatus `json:"status,omitempty" protobuf:"bytes,2,opt,name=status"`
// `lastTransitionTime` is the last time the condition transitioned from one status to another.
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,3,opt,name=lastTransitionTime"`
// `reason` is a unique, one-word, CamelCase reason for the condition's last transition.
Reason string `json:"reason,omitempty" protobuf:"bytes,4,opt,name=reason"`
// `message` is a human-readable message indicating details about last transition.
Message string `json:"message,omitempty" protobuf:"bytes,5,opt,name=message"`
}
// ConditionStatus is the status of the condition.
type ConditionStatus string
// These are valid condition statuses. "ConditionTrue" means a resource is in the condition.
// "ConditionFalse" means a resource is not in the condition. "ConditionUnknown" means kubernetes
// can't decide if a resource is in the condition or not. In the future, we could add other
// intermediate conditions, e.g. ConditionDegraded.
const (
ConditionTrue ConditionStatus = "True"
ConditionFalse ConditionStatus = "False"
ConditionUnknown ConditionStatus = "Unknown"
)

View File

@ -0,0 +1,258 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package v1beta1
// This file contains a collection of methods that can be used from go-restful to
// generate Swagger API documentation for its models. Please read this PR for more
// information on the implementation: https://github.com/emicklei/go-restful/pull/215
//
// TODOs are ignored from the parser (e.g. TODO(andronat):... || TODO:...) if and only if
// they are on one line! For multiple line or blocks that you want to ignore use ---.
// Any context after a --- is ignored.
//
// Those methods can be generated by using hack/update-generated-swagger-docs.sh
// AUTO-GENERATED FUNCTIONS START HERE. DO NOT EDIT.
var map_FlowDistinguisherMethod = map[string]string{
"": "FlowDistinguisherMethod specifies the method of a flow distinguisher.",
"type": "`type` is the type of flow distinguisher method The supported types are \"ByUser\" and \"ByNamespace\". Required.",
}
func (FlowDistinguisherMethod) SwaggerDoc() map[string]string {
return map_FlowDistinguisherMethod
}
var map_FlowSchema = map[string]string{
"": "FlowSchema defines the schema of a group of flows. Note that a flow is made up of a set of inbound API requests with similar attributes and is identified by a pair of strings: the name of the FlowSchema and a \"flow distinguisher\".",
"metadata": "`metadata` is the standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
"spec": "`spec` is the specification of the desired behavior of a FlowSchema. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status",
"status": "`status` is the current status of a FlowSchema. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status",
}
func (FlowSchema) SwaggerDoc() map[string]string {
return map_FlowSchema
}
var map_FlowSchemaCondition = map[string]string{
"": "FlowSchemaCondition describes conditions for a FlowSchema.",
"type": "`type` is the type of the condition. Required.",
"status": "`status` is the status of the condition. Can be True, False, Unknown. Required.",
"lastTransitionTime": "`lastTransitionTime` is the last time the condition transitioned from one status to another.",
"reason": "`reason` is a unique, one-word, CamelCase reason for the condition's last transition.",
"message": "`message` is a human-readable message indicating details about last transition.",
}
func (FlowSchemaCondition) SwaggerDoc() map[string]string {
return map_FlowSchemaCondition
}
var map_FlowSchemaList = map[string]string{
"": "FlowSchemaList is a list of FlowSchema objects.",
"metadata": "`metadata` is the standard list metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
"items": "`items` is a list of FlowSchemas.",
}
func (FlowSchemaList) SwaggerDoc() map[string]string {
return map_FlowSchemaList
}
var map_FlowSchemaSpec = map[string]string{
"": "FlowSchemaSpec describes how the FlowSchema's specification looks like.",
"priorityLevelConfiguration": "`priorityLevelConfiguration` should reference a PriorityLevelConfiguration in the cluster. If the reference cannot be resolved, the FlowSchema will be ignored and marked as invalid in its status. Required.",
"matchingPrecedence": "`matchingPrecedence` is used to choose among the FlowSchemas that match a given request. The chosen FlowSchema is among those with the numerically lowest (which we take to be logically highest) MatchingPrecedence. Each MatchingPrecedence value must be ranged in [1,10000]. Note that if the precedence is not specified, it will be set to 1000 as default.",
"distinguisherMethod": "`distinguisherMethod` defines how to compute the flow distinguisher for requests that match this schema. `nil` specifies that the distinguisher is disabled and thus will always be the empty string.",
"rules": "`rules` describes which requests will match this flow schema. This FlowSchema matches a request if and only if at least one member of rules matches the request. if it is an empty slice, there will be no requests matching the FlowSchema.",
}
func (FlowSchemaSpec) SwaggerDoc() map[string]string {
return map_FlowSchemaSpec
}
var map_FlowSchemaStatus = map[string]string{
"": "FlowSchemaStatus represents the current state of a FlowSchema.",
"conditions": "`conditions` is a list of the current states of FlowSchema.",
}
func (FlowSchemaStatus) SwaggerDoc() map[string]string {
return map_FlowSchemaStatus
}
var map_GroupSubject = map[string]string{
"": "GroupSubject holds detailed information for group-kind subject.",
"name": "name is the user group that matches, or \"*\" to match all user groups. See https://github.com/kubernetes/apiserver/blob/master/pkg/authentication/user/user.go for some well-known group names. Required.",
}
func (GroupSubject) SwaggerDoc() map[string]string {
return map_GroupSubject
}
var map_LimitResponse = map[string]string{
"": "LimitResponse defines how to handle requests that can not be executed right now.",
"type": "`type` is \"Queue\" or \"Reject\". \"Queue\" means that requests that can not be executed upon arrival are held in a queue until they can be executed or a queuing limit is reached. \"Reject\" means that requests that can not be executed upon arrival are rejected. Required.",
"queuing": "`queuing` holds the configuration parameters for queuing. This field may be non-empty only if `type` is `\"Queue\"`.",
}
func (LimitResponse) SwaggerDoc() map[string]string {
return map_LimitResponse
}
var map_LimitedPriorityLevelConfiguration = map[string]string{
"": "LimitedPriorityLevelConfiguration specifies how to handle requests that are subject to limits. It addresses two issues:\n * How are requests for this priority level limited?\n * What should be done with requests that exceed the limit?",
"assuredConcurrencyShares": "`assuredConcurrencyShares` (ACS) configures the execution limit, which is a limit on the number of requests of this priority level that may be exeucting at a given time. ACS must be a positive number. The server's concurrency limit (SCL) is divided among the concurrency-controlled priority levels in proportion to their assured concurrency shares. This produces the assured concurrency value (ACV) ",
"limitResponse": "`limitResponse` indicates what to do with requests that can not be executed right now",
}
func (LimitedPriorityLevelConfiguration) SwaggerDoc() map[string]string {
return map_LimitedPriorityLevelConfiguration
}
var map_NonResourcePolicyRule = map[string]string{
"": "NonResourcePolicyRule is a predicate that matches non-resource requests according to their verb and the target non-resource URL. A NonResourcePolicyRule matches a request if and only if both (a) at least one member of verbs matches the request and (b) at least one member of nonResourceURLs matches the request.",
"verbs": "`verbs` is a list of matching verbs and may not be empty. \"*\" matches all verbs. If it is present, it must be the only entry. Required.",
"nonResourceURLs": "`nonResourceURLs` is a set of url prefixes that a user should have access to and may not be empty. For example:\n - \"/healthz\" is legal\n - \"/hea*\" is illegal\n - \"/hea\" is legal but matches nothing\n - \"/hea/*\" also matches nothing\n - \"/healthz/*\" matches all per-component health checks.\n\"*\" matches all non-resource urls. if it is present, it must be the only entry. Required.",
}
func (NonResourcePolicyRule) SwaggerDoc() map[string]string {
return map_NonResourcePolicyRule
}
var map_PolicyRulesWithSubjects = map[string]string{
"": "PolicyRulesWithSubjects prescribes a test that applies to a request to an apiserver. The test considers the subject making the request, the verb being requested, and the resource to be acted upon. This PolicyRulesWithSubjects matches a request if and only if both (a) at least one member of subjects matches the request and (b) at least one member of resourceRules or nonResourceRules matches the request.",
"subjects": "subjects is the list of normal user, serviceaccount, or group that this rule cares about. There must be at least one member in this slice. A slice that includes both the system:authenticated and system:unauthenticated user groups matches every request. Required.",
"resourceRules": "`resourceRules` is a slice of ResourcePolicyRules that identify matching requests according to their verb and the target resource. At least one of `resourceRules` and `nonResourceRules` has to be non-empty.",
"nonResourceRules": "`nonResourceRules` is a list of NonResourcePolicyRules that identify matching requests according to their verb and the target non-resource URL.",
}
func (PolicyRulesWithSubjects) SwaggerDoc() map[string]string {
return map_PolicyRulesWithSubjects
}
var map_PriorityLevelConfiguration = map[string]string{
"": "PriorityLevelConfiguration represents the configuration of a priority level.",
"metadata": "`metadata` is the standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
"spec": "`spec` is the specification of the desired behavior of a \"request-priority\". More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status",
"status": "`status` is the current status of a \"request-priority\". More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status",
}
func (PriorityLevelConfiguration) SwaggerDoc() map[string]string {
return map_PriorityLevelConfiguration
}
var map_PriorityLevelConfigurationCondition = map[string]string{
"": "PriorityLevelConfigurationCondition defines the condition of priority level.",
"type": "`type` is the type of the condition. Required.",
"status": "`status` is the status of the condition. Can be True, False, Unknown. Required.",
"lastTransitionTime": "`lastTransitionTime` is the last time the condition transitioned from one status to another.",
"reason": "`reason` is a unique, one-word, CamelCase reason for the condition's last transition.",
"message": "`message` is a human-readable message indicating details about last transition.",
}
func (PriorityLevelConfigurationCondition) SwaggerDoc() map[string]string {
return map_PriorityLevelConfigurationCondition
}
var map_PriorityLevelConfigurationList = map[string]string{
"": "PriorityLevelConfigurationList is a list of PriorityLevelConfiguration objects.",
"metadata": "`metadata` is the standard object's metadata. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata",
"items": "`items` is a list of request-priorities.",
}
func (PriorityLevelConfigurationList) SwaggerDoc() map[string]string {
return map_PriorityLevelConfigurationList
}
var map_PriorityLevelConfigurationReference = map[string]string{
"": "PriorityLevelConfigurationReference contains information that points to the \"request-priority\" being used.",
"name": "`name` is the name of the priority level configuration being referenced Required.",
}
func (PriorityLevelConfigurationReference) SwaggerDoc() map[string]string {
return map_PriorityLevelConfigurationReference
}
var map_PriorityLevelConfigurationSpec = map[string]string{
"": "PriorityLevelConfigurationSpec specifies the configuration of a priority level.",
"type": "`type` indicates whether this priority level is subject to limitation on request execution. A value of `\"Exempt\"` means that requests of this priority level are not subject to a limit (and thus are never queued) and do not detract from the capacity made available to other priority levels. A value of `\"Limited\"` means that (a) requests of this priority level _are_ subject to limits and (b) some of the server's limited capacity is made available exclusively to this priority level. Required.",
"limited": "`limited` specifies how requests are handled for a Limited priority level. This field must be non-empty if and only if `type` is `\"Limited\"`.",
}
func (PriorityLevelConfigurationSpec) SwaggerDoc() map[string]string {
return map_PriorityLevelConfigurationSpec
}
var map_PriorityLevelConfigurationStatus = map[string]string{
"": "PriorityLevelConfigurationStatus represents the current state of a \"request-priority\".",
"conditions": "`conditions` is the current state of \"request-priority\".",
}
func (PriorityLevelConfigurationStatus) SwaggerDoc() map[string]string {
return map_PriorityLevelConfigurationStatus
}
var map_QueuingConfiguration = map[string]string{
"": "QueuingConfiguration holds the configuration parameters for queuing",
"queues": "`queues` is the number of queues for this priority level. The queues exist independently at each apiserver. The value must be positive. Setting it to 1 effectively precludes shufflesharding and thus makes the distinguisher method of associated flow schemas irrelevant. This field has a default value of 64.",
"handSize": "`handSize` is a small positive number that configures the shuffle sharding of requests into queues. When enqueuing a request at this priority level the request's flow identifier (a string pair) is hashed and the hash value is used to shuffle the list of queues and deal a hand of the size specified here. The request is put into one of the shortest queues in that hand. `handSize` must be no larger than `queues`, and should be significantly smaller (so that a few heavy flows do not saturate most of the queues). See the user-facing documentation for more extensive guidance on setting this field. This field has a default value of 8.",
"queueLengthLimit": "`queueLengthLimit` is the maximum number of requests allowed to be waiting in a given queue of this priority level at a time; excess requests are rejected. This value must be positive. If not specified, it will be defaulted to 50.",
}
func (QueuingConfiguration) SwaggerDoc() map[string]string {
return map_QueuingConfiguration
}
var map_ResourcePolicyRule = map[string]string{
"": "ResourcePolicyRule is a predicate that matches some resource requests, testing the request's verb and the target resource. A ResourcePolicyRule matches a resource request if and only if: (a) at least one member of verbs matches the request, (b) at least one member of apiGroups matches the request, (c) at least one member of resources matches the request, and (d) least one member of namespaces matches the request.",
"verbs": "`verbs` is a list of matching verbs and may not be empty. \"*\" matches all verbs and, if present, must be the only entry. Required.",
"apiGroups": "`apiGroups` is a list of matching API groups and may not be empty. \"*\" matches all API groups and, if present, must be the only entry. Required.",
"resources": "`resources` is a list of matching resources (i.e., lowercase and plural) with, if desired, subresource. For example, [ \"services\", \"nodes/status\" ]. This list may not be empty. \"*\" matches all resources and, if present, must be the only entry. Required.",
"clusterScope": "`clusterScope` indicates whether to match requests that do not specify a namespace (which happens either because the resource is not namespaced or the request targets all namespaces). If this field is omitted or false then the `namespaces` field must contain a non-empty list.",
"namespaces": "`namespaces` is a list of target namespaces that restricts matches. A request that specifies a target namespace matches only if either (a) this list contains that target namespace or (b) this list contains \"*\". Note that \"*\" matches any specified namespace but does not match a request that _does not specify_ a namespace (see the `clusterScope` field for that). This list may be empty, but only if `clusterScope` is true.",
}
func (ResourcePolicyRule) SwaggerDoc() map[string]string {
return map_ResourcePolicyRule
}
var map_ServiceAccountSubject = map[string]string{
"": "ServiceAccountSubject holds detailed information for service-account-kind subject.",
"namespace": "`namespace` is the namespace of matching ServiceAccount objects. Required.",
"name": "`name` is the name of matching ServiceAccount objects, or \"*\" to match regardless of name. Required.",
}
func (ServiceAccountSubject) SwaggerDoc() map[string]string {
return map_ServiceAccountSubject
}
var map_Subject = map[string]string{
"": "Subject matches the originator of a request, as identified by the request authentication system. There are three ways of matching an originator; by user, group, or service account.",
"kind": "Required",
}
func (Subject) SwaggerDoc() map[string]string {
return map_Subject
}
var map_UserSubject = map[string]string{
"": "UserSubject holds detailed information for user-kind subject.",
"name": "`name` is the username that matches, or \"*\" to match all usernames. Required.",
}
func (UserSubject) SwaggerDoc() map[string]string {
return map_UserSubject
}
// AUTO-GENERATED FUNCTIONS END HERE

View File

@ -0,0 +1,541 @@
// +build !ignore_autogenerated
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by deepcopy-gen. DO NOT EDIT.
package v1beta1
import (
runtime "k8s.io/apimachinery/pkg/runtime"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *FlowDistinguisherMethod) DeepCopyInto(out *FlowDistinguisherMethod) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FlowDistinguisherMethod.
func (in *FlowDistinguisherMethod) DeepCopy() *FlowDistinguisherMethod {
if in == nil {
return nil
}
out := new(FlowDistinguisherMethod)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *FlowSchema) DeepCopyInto(out *FlowSchema) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FlowSchema.
func (in *FlowSchema) DeepCopy() *FlowSchema {
if in == nil {
return nil
}
out := new(FlowSchema)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *FlowSchema) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *FlowSchemaCondition) DeepCopyInto(out *FlowSchemaCondition) {
*out = *in
in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FlowSchemaCondition.
func (in *FlowSchemaCondition) DeepCopy() *FlowSchemaCondition {
if in == nil {
return nil
}
out := new(FlowSchemaCondition)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *FlowSchemaList) DeepCopyInto(out *FlowSchemaList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]FlowSchema, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FlowSchemaList.
func (in *FlowSchemaList) DeepCopy() *FlowSchemaList {
if in == nil {
return nil
}
out := new(FlowSchemaList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *FlowSchemaList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *FlowSchemaSpec) DeepCopyInto(out *FlowSchemaSpec) {
*out = *in
out.PriorityLevelConfiguration = in.PriorityLevelConfiguration
if in.DistinguisherMethod != nil {
in, out := &in.DistinguisherMethod, &out.DistinguisherMethod
*out = new(FlowDistinguisherMethod)
**out = **in
}
if in.Rules != nil {
in, out := &in.Rules, &out.Rules
*out = make([]PolicyRulesWithSubjects, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FlowSchemaSpec.
func (in *FlowSchemaSpec) DeepCopy() *FlowSchemaSpec {
if in == nil {
return nil
}
out := new(FlowSchemaSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *FlowSchemaStatus) DeepCopyInto(out *FlowSchemaStatus) {
*out = *in
if in.Conditions != nil {
in, out := &in.Conditions, &out.Conditions
*out = make([]FlowSchemaCondition, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new FlowSchemaStatus.
func (in *FlowSchemaStatus) DeepCopy() *FlowSchemaStatus {
if in == nil {
return nil
}
out := new(FlowSchemaStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *GroupSubject) DeepCopyInto(out *GroupSubject) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GroupSubject.
func (in *GroupSubject) DeepCopy() *GroupSubject {
if in == nil {
return nil
}
out := new(GroupSubject)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *LimitResponse) DeepCopyInto(out *LimitResponse) {
*out = *in
if in.Queuing != nil {
in, out := &in.Queuing, &out.Queuing
*out = new(QueuingConfiguration)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LimitResponse.
func (in *LimitResponse) DeepCopy() *LimitResponse {
if in == nil {
return nil
}
out := new(LimitResponse)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *LimitedPriorityLevelConfiguration) DeepCopyInto(out *LimitedPriorityLevelConfiguration) {
*out = *in
in.LimitResponse.DeepCopyInto(&out.LimitResponse)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LimitedPriorityLevelConfiguration.
func (in *LimitedPriorityLevelConfiguration) DeepCopy() *LimitedPriorityLevelConfiguration {
if in == nil {
return nil
}
out := new(LimitedPriorityLevelConfiguration)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *NonResourcePolicyRule) DeepCopyInto(out *NonResourcePolicyRule) {
*out = *in
if in.Verbs != nil {
in, out := &in.Verbs, &out.Verbs
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.NonResourceURLs != nil {
in, out := &in.NonResourceURLs, &out.NonResourceURLs
*out = make([]string, len(*in))
copy(*out, *in)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NonResourcePolicyRule.
func (in *NonResourcePolicyRule) DeepCopy() *NonResourcePolicyRule {
if in == nil {
return nil
}
out := new(NonResourcePolicyRule)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PolicyRulesWithSubjects) DeepCopyInto(out *PolicyRulesWithSubjects) {
*out = *in
if in.Subjects != nil {
in, out := &in.Subjects, &out.Subjects
*out = make([]Subject, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.ResourceRules != nil {
in, out := &in.ResourceRules, &out.ResourceRules
*out = make([]ResourcePolicyRule, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
if in.NonResourceRules != nil {
in, out := &in.NonResourceRules, &out.NonResourceRules
*out = make([]NonResourcePolicyRule, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PolicyRulesWithSubjects.
func (in *PolicyRulesWithSubjects) DeepCopy() *PolicyRulesWithSubjects {
if in == nil {
return nil
}
out := new(PolicyRulesWithSubjects)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PriorityLevelConfiguration) DeepCopyInto(out *PriorityLevelConfiguration) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PriorityLevelConfiguration.
func (in *PriorityLevelConfiguration) DeepCopy() *PriorityLevelConfiguration {
if in == nil {
return nil
}
out := new(PriorityLevelConfiguration)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *PriorityLevelConfiguration) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PriorityLevelConfigurationCondition) DeepCopyInto(out *PriorityLevelConfigurationCondition) {
*out = *in
in.LastTransitionTime.DeepCopyInto(&out.LastTransitionTime)
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PriorityLevelConfigurationCondition.
func (in *PriorityLevelConfigurationCondition) DeepCopy() *PriorityLevelConfigurationCondition {
if in == nil {
return nil
}
out := new(PriorityLevelConfigurationCondition)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PriorityLevelConfigurationList) DeepCopyInto(out *PriorityLevelConfigurationList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]PriorityLevelConfiguration, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PriorityLevelConfigurationList.
func (in *PriorityLevelConfigurationList) DeepCopy() *PriorityLevelConfigurationList {
if in == nil {
return nil
}
out := new(PriorityLevelConfigurationList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *PriorityLevelConfigurationList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PriorityLevelConfigurationReference) DeepCopyInto(out *PriorityLevelConfigurationReference) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PriorityLevelConfigurationReference.
func (in *PriorityLevelConfigurationReference) DeepCopy() *PriorityLevelConfigurationReference {
if in == nil {
return nil
}
out := new(PriorityLevelConfigurationReference)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PriorityLevelConfigurationSpec) DeepCopyInto(out *PriorityLevelConfigurationSpec) {
*out = *in
if in.Limited != nil {
in, out := &in.Limited, &out.Limited
*out = new(LimitedPriorityLevelConfiguration)
(*in).DeepCopyInto(*out)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PriorityLevelConfigurationSpec.
func (in *PriorityLevelConfigurationSpec) DeepCopy() *PriorityLevelConfigurationSpec {
if in == nil {
return nil
}
out := new(PriorityLevelConfigurationSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PriorityLevelConfigurationStatus) DeepCopyInto(out *PriorityLevelConfigurationStatus) {
*out = *in
if in.Conditions != nil {
in, out := &in.Conditions, &out.Conditions
*out = make([]PriorityLevelConfigurationCondition, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PriorityLevelConfigurationStatus.
func (in *PriorityLevelConfigurationStatus) DeepCopy() *PriorityLevelConfigurationStatus {
if in == nil {
return nil
}
out := new(PriorityLevelConfigurationStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *QueuingConfiguration) DeepCopyInto(out *QueuingConfiguration) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new QueuingConfiguration.
func (in *QueuingConfiguration) DeepCopy() *QueuingConfiguration {
if in == nil {
return nil
}
out := new(QueuingConfiguration)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ResourcePolicyRule) DeepCopyInto(out *ResourcePolicyRule) {
*out = *in
if in.Verbs != nil {
in, out := &in.Verbs, &out.Verbs
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.APIGroups != nil {
in, out := &in.APIGroups, &out.APIGroups
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.Resources != nil {
in, out := &in.Resources, &out.Resources
*out = make([]string, len(*in))
copy(*out, *in)
}
if in.Namespaces != nil {
in, out := &in.Namespaces, &out.Namespaces
*out = make([]string, len(*in))
copy(*out, *in)
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourcePolicyRule.
func (in *ResourcePolicyRule) DeepCopy() *ResourcePolicyRule {
if in == nil {
return nil
}
out := new(ResourcePolicyRule)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ServiceAccountSubject) DeepCopyInto(out *ServiceAccountSubject) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceAccountSubject.
func (in *ServiceAccountSubject) DeepCopy() *ServiceAccountSubject {
if in == nil {
return nil
}
out := new(ServiceAccountSubject)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Subject) DeepCopyInto(out *Subject) {
*out = *in
if in.User != nil {
in, out := &in.User, &out.User
*out = new(UserSubject)
**out = **in
}
if in.Group != nil {
in, out := &in.Group, &out.Group
*out = new(GroupSubject)
**out = **in
}
if in.ServiceAccount != nil {
in, out := &in.ServiceAccount, &out.ServiceAccount
*out = new(ServiceAccountSubject)
**out = **in
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Subject.
func (in *Subject) DeepCopy() *Subject {
if in == nil {
return nil
}
out := new(Subject)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *UserSubject) DeepCopyInto(out *UserSubject) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserSubject.
func (in *UserSubject) DeepCopy() *UserSubject {
if in == nil {
return nil
}
out := new(UserSubject)
in.DeepCopyInto(out)
return out
}

View File

@ -0,0 +1,93 @@
// +build !ignore_autogenerated
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by prerelease-lifecycle-gen. DO NOT EDIT.
package v1beta1
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
func (in *FlowSchema) APILifecycleIntroduced() (major, minor int) {
return 1, 20
}
// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor.
func (in *FlowSchema) APILifecycleDeprecated() (major, minor int) {
return 1, 23
}
// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor.
func (in *FlowSchema) APILifecycleRemoved() (major, minor int) {
return 1, 26
}
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
func (in *FlowSchemaList) APILifecycleIntroduced() (major, minor int) {
return 1, 20
}
// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor.
func (in *FlowSchemaList) APILifecycleDeprecated() (major, minor int) {
return 1, 23
}
// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor.
func (in *FlowSchemaList) APILifecycleRemoved() (major, minor int) {
return 1, 26
}
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
func (in *PriorityLevelConfiguration) APILifecycleIntroduced() (major, minor int) {
return 1, 20
}
// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor.
func (in *PriorityLevelConfiguration) APILifecycleDeprecated() (major, minor int) {
return 1, 23
}
// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor.
func (in *PriorityLevelConfiguration) APILifecycleRemoved() (major, minor int) {
return 1, 26
}
// APILifecycleIntroduced is an autogenerated function, returning the release in which the API struct was introduced as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:introduced" tags in types.go.
func (in *PriorityLevelConfigurationList) APILifecycleIntroduced() (major, minor int) {
return 1, 20
}
// APILifecycleDeprecated is an autogenerated function, returning the release in which the API struct was or will be deprecated as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:deprecated" tags in types.go or "k8s:prerelease-lifecycle-gen:introduced" plus three minor.
func (in *PriorityLevelConfigurationList) APILifecycleDeprecated() (major, minor int) {
return 1, 23
}
// APILifecycleRemoved is an autogenerated function, returning the release in which the API is no longer served as int versions of major and minor for comparison.
// It is controlled by "k8s:prerelease-lifecycle-gen:removed" tags in types.go or "k8s:prerelease-lifecycle-gen:deprecated" plus three minor.
func (in *PriorityLevelConfigurationList) APILifecycleRemoved() (major, minor int) {
return 1, 26
}

View File

@ -9,7 +9,7 @@ go_library(
deps = [
"//staging/src/k8s.io/api/coordination/v1:go_default_library",
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/api/flowcontrol/v1alpha1:go_default_library",
"//staging/src/k8s.io/api/flowcontrol/v1beta1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/authentication/serviceaccount:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/authentication/user:go_default_library",

View File

@ -19,7 +19,7 @@ package bootstrap
import (
coordinationv1 "k8s.io/api/coordination/v1"
corev1 "k8s.io/api/core/v1"
flowcontrol "k8s.io/api/flowcontrol/v1alpha1"
flowcontrol "k8s.io/api/flowcontrol/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apiserver/pkg/authentication/serviceaccount"
"k8s.io/apiserver/pkg/authentication/user"

View File

@ -181,7 +181,7 @@ var defaultKubernetesFeatureGates = map[featuregate.Feature]featuregate.FeatureS
StorageVersionHash: {Default: true, PreRelease: featuregate.Beta},
StorageVersionAPI: {Default: false, PreRelease: featuregate.Alpha},
WatchBookmark: {Default: true, PreRelease: featuregate.GA, LockToDefault: true},
APIPriorityAndFairness: {Default: false, PreRelease: featuregate.Alpha},
APIPriorityAndFairness: {Default: true, PreRelease: featuregate.Beta},
RemoveSelfLink: {Default: true, PreRelease: featuregate.Beta},
SelectorIndex: {Default: true, PreRelease: featuregate.GA, LockToDefault: true},
WarningHeaders: {Default: true, PreRelease: featuregate.Beta},

View File

@ -785,7 +785,7 @@ func installAPI(s *GenericAPIServer, c *Config) {
if c.EnableDiscovery {
s.Handler.GoRestfulContainer.Add(s.DiscoveryGroupManager.WebService())
}
if feature.DefaultFeatureGate.Enabled(features.APIPriorityAndFairness) {
if c.FlowControl != nil && feature.DefaultFeatureGate.Enabled(features.APIPriorityAndFairness) {
c.FlowControl.Install(s.Handler.NonGoRestfulMux)
}
}

View File

@ -18,7 +18,7 @@ go_test(
],
embed = [":go_default_library"],
deps = [
"//staging/src/k8s.io/api/flowcontrol/v1alpha1:go_default_library",
"//staging/src/k8s.io/api/flowcontrol/v1beta1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
@ -58,7 +58,7 @@ go_library(
importpath = "k8s.io/apiserver/pkg/server/filters",
deps = [
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/api/flowcontrol/v1alpha1:go_default_library",
"//staging/src/k8s.io/api/flowcontrol/v1beta1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/types:go_default_library",

View File

@ -22,7 +22,7 @@ import (
"net/http"
"sync/atomic"
fcv1a1 "k8s.io/api/flowcontrol/v1alpha1"
flowcontrol "k8s.io/api/flowcontrol/v1beta1"
apitypes "k8s.io/apimachinery/pkg/types"
epmetrics "k8s.io/apiserver/pkg/endpoints/metrics"
apirequest "k8s.io/apiserver/pkg/endpoints/request"
@ -92,7 +92,7 @@ func WithPriorityAndFairness(
}
var classification *PriorityAndFairnessClassification
note := func(fs *fcv1a1.FlowSchema, pl *fcv1a1.PriorityLevelConfiguration) {
note := func(fs *flowcontrol.FlowSchema, pl *flowcontrol.PriorityLevelConfiguration) {
classification = &PriorityAndFairnessClassification{
FlowSchemaName: fs.Name,
FlowSchemaUID: fs.UID,
@ -122,8 +122,8 @@ func WithPriorityAndFairness(
served = true
innerCtx := context.WithValue(ctx, priorityAndFairnessKey, classification)
innerReq := r.Clone(innerCtx)
w.Header().Set(fcv1a1.ResponseHeaderMatchedPriorityLevelConfigurationUID, string(classification.PriorityLevelUID))
w.Header().Set(fcv1a1.ResponseHeaderMatchedFlowSchemaUID, string(classification.FlowSchemaUID))
w.Header().Set(flowcontrol.ResponseHeaderMatchedPriorityLevelConfigurationUID, string(classification.PriorityLevelUID))
w.Header().Set(flowcontrol.ResponseHeaderMatchedFlowSchemaUID, string(classification.FlowSchemaUID))
handler.ServeHTTP(w, innerReq)
}
digest := utilflowcontrol.RequestDigest{RequestInfo: requestInfo, User: user}

View File

@ -25,7 +25,7 @@ import (
"testing"
"time"
fctypesv1a1 "k8s.io/api/flowcontrol/v1alpha1"
flowcontrol "k8s.io/api/flowcontrol/v1beta1"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apiserver/pkg/apis/flowcontrol/bootstrap"
"k8s.io/apiserver/pkg/authentication/user"
@ -60,7 +60,7 @@ func (t fakeApfFilter) MaintainObservations(stopCh <-chan struct{}) {
func (t fakeApfFilter) Handle(ctx context.Context,
requestDigest utilflowcontrol.RequestDigest,
noteFn func(fs *fctypesv1a1.FlowSchema, pl *fctypesv1a1.PriorityLevelConfiguration),
noteFn func(fs *flowcontrol.FlowSchema, pl *flowcontrol.PriorityLevelConfiguration),
queueNoteFn fq.QueueNoteFn,
execFn func(),
) {

View File

@ -126,7 +126,7 @@ func (o *RecommendedOptions) ApplyTo(config *server.RecommendedConfig) error {
if feature.DefaultFeatureGate.Enabled(features.APIPriorityAndFairness) {
config.FlowControl = utilflowcontrol.New(
config.SharedInformerFactory,
kubernetes.NewForConfigOrDie(config.ClientConfig).FlowcontrolV1alpha1(),
kubernetes.NewForConfigOrDie(config.ClientConfig).FlowcontrolV1beta1(),
config.MaxRequestsInFlight+config.MaxMutatingRequestsInFlight,
config.RequestTimeout/4,
)

View File

@ -6,7 +6,7 @@ go_library(
importmap = "k8s.io/kubernetes/vendor/k8s.io/apiserver/pkg/util/apihelpers",
importpath = "k8s.io/apiserver/pkg/util/apihelpers",
visibility = ["//visibility:public"],
deps = ["//staging/src/k8s.io/api/flowcontrol/v1alpha1:go_default_library"],
deps = ["//staging/src/k8s.io/api/flowcontrol/v1beta1:go_default_library"],
)
filegroup(

View File

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

View File

@ -13,7 +13,7 @@ go_library(
importpath = "k8s.io/apiserver/pkg/util/flowcontrol",
visibility = ["//visibility:public"],
deps = [
"//staging/src/k8s.io/api/flowcontrol/v1alpha1:go_default_library",
"//staging/src/k8s.io/api/flowcontrol/v1beta1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/api/equality:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/labels:go_default_library",
@ -35,8 +35,8 @@ go_library(
"//staging/src/k8s.io/apiserver/pkg/util/flowcontrol/format:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/util/flowcontrol/metrics:go_default_library",
"//staging/src/k8s.io/client-go/informers:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1:go_default_library",
"//staging/src/k8s.io/client-go/listers/flowcontrol/v1alpha1:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1:go_default_library",
"//staging/src/k8s.io/client-go/listers/flowcontrol/v1beta1:go_default_library",
"//staging/src/k8s.io/client-go/tools/cache:go_default_library",
"//staging/src/k8s.io/client-go/util/workqueue:go_default_library",
"//vendor/github.com/pkg/errors:go_default_library",
@ -75,7 +75,7 @@ go_test(
],
embed = [":go_default_library"],
deps = [
"//staging/src/k8s.io/api/flowcontrol/v1alpha1:go_default_library",
"//staging/src/k8s.io/api/flowcontrol/v1beta1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/sets:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/apis/flowcontrol/bootstrap:go_default_library",
@ -88,7 +88,7 @@ go_test(
"//staging/src/k8s.io/apiserver/pkg/util/flowcontrol/metrics:go_default_library",
"//staging/src/k8s.io/client-go/informers:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes/fake:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1:go_default_library",
"//vendor/k8s.io/klog/v2:go_default_library",
],
)

View File

@ -47,9 +47,9 @@ import (
"k8s.io/client-go/util/workqueue"
"k8s.io/klog/v2"
fctypesv1a1 "k8s.io/api/flowcontrol/v1alpha1"
fcclientv1a1 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1"
fclistersv1a1 "k8s.io/client-go/listers/flowcontrol/v1alpha1"
flowcontrol "k8s.io/api/flowcontrol/v1beta1"
flowcontrolclient "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1"
flowcontrollister "k8s.io/client-go/listers/flowcontrol/v1beta1"
)
// This file contains a simple local (to the apiserver) controller
@ -91,13 +91,13 @@ type configController struct {
// objects need to be reprocessed.
configQueue workqueue.RateLimitingInterface
plLister fclistersv1a1.PriorityLevelConfigurationLister
plLister flowcontrollister.PriorityLevelConfigurationLister
plInformerSynced cache.InformerSynced
fsLister fclistersv1a1.FlowSchemaLister
fsLister flowcontrollister.FlowSchemaLister
fsInformerSynced cache.InformerSynced
flowcontrolClient fcclientv1a1.FlowcontrolV1alpha1Interface
flowcontrolClient flowcontrolclient.FlowcontrolV1beta1Interface
// serverConcurrencyLimit is the limit on the server's total
// number of non-exempt requests being served at once. This comes
@ -127,7 +127,7 @@ type configController struct {
type priorityLevelState struct {
// the API object or prototype prescribing this level. Nothing
// reached through this pointer is mutable.
pl *fctypesv1a1.PriorityLevelConfiguration
pl *flowcontrol.PriorityLevelConfiguration
// qsCompleter holds the QueueSetCompleter derived from `config`
// and `queues` if config is not exempt, nil otherwise.
@ -153,7 +153,7 @@ type priorityLevelState struct {
// NewTestableController is extra flexible to facilitate testing
func newTestableController(
informerFactory kubeinformers.SharedInformerFactory,
flowcontrolClient fcclientv1a1.FlowcontrolV1alpha1Interface,
flowcontrolClient flowcontrolclient.FlowcontrolV1beta1Interface,
serverConcurrencyLimit int,
requestWaitLimit time.Duration,
obsPairGenerator metrics.TimedObserverPairGenerator,
@ -178,7 +178,7 @@ func newTestableController(
// config API objects.
func (cfgCtlr *configController) initializeConfigController(informerFactory kubeinformers.SharedInformerFactory) {
cfgCtlr.configQueue = workqueue.NewNamedRateLimitingQueue(workqueue.NewItemExponentialFailureRateLimiter(200*time.Millisecond, 8*time.Hour), "priority_and_fairness_config_queue")
fci := informerFactory.Flowcontrol().V1alpha1()
fci := informerFactory.Flowcontrol().V1beta1()
pli := fci.PriorityLevelConfigurations()
fsi := fci.FlowSchemas()
cfgCtlr.plLister = pli.Lister()
@ -187,13 +187,13 @@ func (cfgCtlr *configController) initializeConfigController(informerFactory kube
cfgCtlr.fsInformerSynced = fsi.Informer().HasSynced
pli.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
AddFunc: func(obj interface{}) {
pl := obj.(*fctypesv1a1.PriorityLevelConfiguration)
pl := obj.(*flowcontrol.PriorityLevelConfiguration)
klog.V(7).Infof("Triggered API priority and fairness config reloading due to creation of PLC %s", pl.Name)
cfgCtlr.configQueue.Add(0)
},
UpdateFunc: func(oldObj, newObj interface{}) {
newPL := newObj.(*fctypesv1a1.PriorityLevelConfiguration)
oldPL := oldObj.(*fctypesv1a1.PriorityLevelConfiguration)
newPL := newObj.(*flowcontrol.PriorityLevelConfiguration)
oldPL := oldObj.(*flowcontrol.PriorityLevelConfiguration)
if !apiequality.Semantic.DeepEqual(oldPL.Spec, newPL.Spec) {
klog.V(7).Infof("Triggered API priority and fairness config reloading due to spec update of PLC %s", newPL.Name)
cfgCtlr.configQueue.Add(0)
@ -207,13 +207,13 @@ func (cfgCtlr *configController) initializeConfigController(informerFactory kube
}})
fsi.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
AddFunc: func(obj interface{}) {
fs := obj.(*fctypesv1a1.FlowSchema)
fs := obj.(*flowcontrol.FlowSchema)
klog.V(7).Infof("Triggered API priority and fairness config reloading due to creation of FS %s", fs.Name)
cfgCtlr.configQueue.Add(0)
},
UpdateFunc: func(oldObj, newObj interface{}) {
newFS := newObj.(*fctypesv1a1.FlowSchema)
oldFS := oldObj.(*fctypesv1a1.FlowSchema)
newFS := newObj.(*flowcontrol.FlowSchema)
oldFS := oldObj.(*flowcontrol.FlowSchema)
if !apiequality.Semantic.DeepEqual(oldFS.Spec, newFS.Spec) {
klog.V(7).Infof("Triggered API priority and fairness config reloading due to spec update of FS %s", newFS.Name)
cfgCtlr.configQueue.Add(0)
@ -332,14 +332,14 @@ type cfgMeal struct {
// A buffered set of status updates for a FlowSchema
type fsStatusUpdate struct {
flowSchema *fctypesv1a1.FlowSchema
condition fctypesv1a1.FlowSchemaCondition
oldValue fctypesv1a1.FlowSchemaCondition
flowSchema *flowcontrol.FlowSchema
condition flowcontrol.FlowSchemaCondition
oldValue flowcontrol.FlowSchemaCondition
}
// digestConfigObjects is given all the API objects that configure
// cfgCtlr and writes its consequent new configState.
func (cfgCtlr *configController) digestConfigObjects(newPLs []*fctypesv1a1.PriorityLevelConfiguration, newFSs []*fctypesv1a1.FlowSchema) error {
func (cfgCtlr *configController) digestConfigObjects(newPLs []*flowcontrol.PriorityLevelConfiguration, newFSs []*flowcontrol.FlowSchema) error {
fsStatusUpdates := cfgCtlr.lockAndDigestConfigObjects(newPLs, newFSs)
var errs []error
for _, fsu := range fsStatusUpdates {
@ -360,7 +360,7 @@ func (cfgCtlr *configController) digestConfigObjects(newPLs []*fctypesv1a1.Prior
return apierrors.NewAggregate(errs)
}
func (cfgCtlr *configController) lockAndDigestConfigObjects(newPLs []*fctypesv1a1.PriorityLevelConfiguration, newFSs []*fctypesv1a1.FlowSchema) []fsStatusUpdate {
func (cfgCtlr *configController) lockAndDigestConfigObjects(newPLs []*flowcontrol.PriorityLevelConfiguration, newFSs []*flowcontrol.FlowSchema) []fsStatusUpdate {
cfgCtlr.lock.Lock()
defer cfgCtlr.lock.Unlock()
meal := cfgMeal{
@ -390,7 +390,7 @@ func (cfgCtlr *configController) lockAndDigestConfigObjects(newPLs []*fctypesv1a
// Digest the new set of PriorityLevelConfiguration objects.
// Pretend broken ones do not exist.
func (meal *cfgMeal) digestNewPLsLocked(newPLs []*fctypesv1a1.PriorityLevelConfiguration) {
func (meal *cfgMeal) digestNewPLsLocked(newPLs []*flowcontrol.PriorityLevelConfiguration) {
for _, pl := range newPLs {
state := meal.cfgCtlr.priorityLevelStates[pl.Name]
if state == nil {
@ -411,8 +411,8 @@ func (meal *cfgMeal) digestNewPLsLocked(newPLs []*fctypesv1a1.PriorityLevelConfi
if state.pl.Spec.Limited != nil {
meal.shareSum += float64(state.pl.Spec.Limited.AssuredConcurrencyShares)
}
meal.haveExemptPL = meal.haveExemptPL || pl.Name == fctypesv1a1.PriorityLevelConfigurationNameExempt
meal.haveCatchAllPL = meal.haveCatchAllPL || pl.Name == fctypesv1a1.PriorityLevelConfigurationNameCatchAll
meal.haveExemptPL = meal.haveExemptPL || pl.Name == flowcontrol.PriorityLevelConfigurationNameExempt
meal.haveCatchAllPL = meal.haveCatchAllPL || pl.Name == flowcontrol.PriorityLevelConfigurationNameCatchAll
}
}
@ -423,9 +423,9 @@ func (meal *cfgMeal) digestNewPLsLocked(newPLs []*fctypesv1a1.PriorityLevelConfi
// reflect this. This function also adds any missing mandatory
// FlowSchema objects. The given objects must all have distinct
// names.
func (meal *cfgMeal) digestFlowSchemasLocked(newFSs []*fctypesv1a1.FlowSchema) {
func (meal *cfgMeal) digestFlowSchemasLocked(newFSs []*flowcontrol.FlowSchema) {
fsSeq := make(apihelpers.FlowSchemaSequence, 0, len(newFSs))
fsMap := make(map[string]*fctypesv1a1.FlowSchema, len(newFSs))
fsMap := make(map[string]*flowcontrol.FlowSchema, len(newFSs))
var haveExemptFS, haveCatchAllFS bool
for i, fs := range newFSs {
otherFS := fsMap[fs.Name]
@ -448,8 +448,8 @@ func (meal *cfgMeal) digestFlowSchemasLocked(newFSs []*fctypesv1a1.FlowSchema) {
continue
}
fsSeq = append(fsSeq, newFSs[i])
haveExemptFS = haveExemptFS || fs.Name == fctypesv1a1.FlowSchemaNameExempt
haveCatchAllFS = haveCatchAllFS || fs.Name == fctypesv1a1.FlowSchemaNameCatchAll
haveExemptFS = haveExemptFS || fs.Name == flowcontrol.FlowSchemaNameExempt
haveCatchAllFS = haveCatchAllFS || fs.Name == flowcontrol.FlowSchemaNameCatchAll
}
// sort into the order to be used for matching
sort.Sort(fsSeq)
@ -481,7 +481,7 @@ func (meal *cfgMeal) processOldPLsLocked() {
// Still desired and already updated
continue
}
if plName == fctypesv1a1.PriorityLevelConfigurationNameExempt && !meal.haveExemptPL || plName == fctypesv1a1.PriorityLevelConfigurationNameCatchAll && !meal.haveCatchAllPL {
if plName == flowcontrol.PriorityLevelConfigurationNameExempt && !meal.haveExemptPL || plName == flowcontrol.PriorityLevelConfigurationNameCatchAll && !meal.haveCatchAllPL {
// BTW, we know the Spec has not changed because the
// mandatory objects have immutable Specs
klog.V(3).Infof("Retaining mandatory priority level %q despite lack of API object", plName)
@ -513,8 +513,8 @@ func (meal *cfgMeal) processOldPLsLocked() {
// regular way.
meal.shareSum += float64(plState.pl.Spec.Limited.AssuredConcurrencyShares)
}
meal.haveExemptPL = meal.haveExemptPL || plName == fctypesv1a1.PriorityLevelConfigurationNameExempt
meal.haveCatchAllPL = meal.haveCatchAllPL || plName == fctypesv1a1.PriorityLevelConfigurationNameCatchAll
meal.haveExemptPL = meal.haveExemptPL || plName == flowcontrol.PriorityLevelConfigurationNameExempt
meal.haveCatchAllPL = meal.haveCatchAllPL || plName == flowcontrol.PriorityLevelConfigurationNameCatchAll
meal.newPLStates[plName] = plState
}
}
@ -548,18 +548,18 @@ func (meal *cfgMeal) finishQueueSetReconfigsLocked() {
// given priority level configuration. Returns nil if that config
// does not call for limiting. Returns nil and an error if the given
// object is malformed in a way that is a problem for this package.
func queueSetCompleterForPL(qsf fq.QueueSetFactory, queues fq.QueueSet, pl *fctypesv1a1.PriorityLevelConfiguration, requestWaitLimit time.Duration, intPair metrics.TimedObserverPair) (fq.QueueSetCompleter, error) {
if (pl.Spec.Type == fctypesv1a1.PriorityLevelEnablementExempt) != (pl.Spec.Limited == nil) {
func queueSetCompleterForPL(qsf fq.QueueSetFactory, queues fq.QueueSet, pl *flowcontrol.PriorityLevelConfiguration, requestWaitLimit time.Duration, intPair metrics.TimedObserverPair) (fq.QueueSetCompleter, error) {
if (pl.Spec.Type == flowcontrol.PriorityLevelEnablementExempt) != (pl.Spec.Limited == nil) {
return nil, errors.New("broken union structure at the top")
}
if (pl.Spec.Type == fctypesv1a1.PriorityLevelEnablementExempt) != (pl.Name == fctypesv1a1.PriorityLevelConfigurationNameExempt) {
if (pl.Spec.Type == flowcontrol.PriorityLevelEnablementExempt) != (pl.Name == flowcontrol.PriorityLevelConfigurationNameExempt) {
// This package does not attempt to cope with a priority level dynamically switching between exempt and not.
return nil, errors.New("non-alignment between name and type")
}
if pl.Spec.Limited == nil {
return nil, nil
}
if (pl.Spec.Limited.LimitResponse.Type == fctypesv1a1.LimitResponseTypeReject) != (pl.Spec.Limited.LimitResponse.Queuing == nil) {
if (pl.Spec.Limited.LimitResponse.Type == flowcontrol.LimitResponseTypeReject) != (pl.Spec.Limited.LimitResponse.Queuing == nil) {
return nil, errors.New("broken union structure for limit response")
}
qcAPI := pl.Spec.Limited.LimitResponse.Queuing
@ -585,17 +585,17 @@ func queueSetCompleterForPL(qsf fq.QueueSetFactory, queues fq.QueueSet, pl *fcty
return qsc, err
}
func (meal *cfgMeal) presyncFlowSchemaStatus(fs *fctypesv1a1.FlowSchema, isDangling bool, plName string) {
danglingCondition := apihelpers.GetFlowSchemaConditionByType(fs, fctypesv1a1.FlowSchemaConditionDangling)
func (meal *cfgMeal) presyncFlowSchemaStatus(fs *flowcontrol.FlowSchema, isDangling bool, plName string) {
danglingCondition := apihelpers.GetFlowSchemaConditionByType(fs, flowcontrol.FlowSchemaConditionDangling)
if danglingCondition == nil {
danglingCondition = &fctypesv1a1.FlowSchemaCondition{
Type: fctypesv1a1.FlowSchemaConditionDangling,
danglingCondition = &flowcontrol.FlowSchemaCondition{
Type: flowcontrol.FlowSchemaConditionDangling,
}
}
desiredStatus := fctypesv1a1.ConditionFalse
desiredStatus := flowcontrol.ConditionFalse
var desiredReason, desiredMessage string
if isDangling {
desiredStatus = fctypesv1a1.ConditionTrue
desiredStatus = flowcontrol.ConditionTrue
desiredReason = "NotFound"
desiredMessage = fmt.Sprintf("This FlowSchema references the PriorityLevelConfiguration object named %q but there is no such object", plName)
} else {
@ -607,8 +607,8 @@ func (meal *cfgMeal) presyncFlowSchemaStatus(fs *fctypesv1a1.FlowSchema, isDangl
}
meal.fsStatusUpdates = append(meal.fsStatusUpdates, fsStatusUpdate{
flowSchema: fs,
condition: fctypesv1a1.FlowSchemaCondition{
Type: fctypesv1a1.FlowSchemaConditionDangling,
condition: flowcontrol.FlowSchemaCondition{
Type: flowcontrol.FlowSchemaConditionDangling,
Status: desiredStatus,
LastTransitionTime: metav1.Now(),
Reason: desiredReason,
@ -619,7 +619,7 @@ func (meal *cfgMeal) presyncFlowSchemaStatus(fs *fctypesv1a1.FlowSchema, isDangl
// imaginePL adds a priority level based on one of the mandatory ones
// that does not actually exist (right now) as a real API object.
func (meal *cfgMeal) imaginePL(proto *fctypesv1a1.PriorityLevelConfiguration, requestWaitLimit time.Duration) {
func (meal *cfgMeal) imaginePL(proto *flowcontrol.PriorityLevelConfiguration, requestWaitLimit time.Duration) {
klog.V(3).Infof("No %s PriorityLevelConfiguration found, imagining one", proto.Name)
obsPair := meal.cfgCtlr.obsPairGenerator.Generate(1, 1, []string{proto.Name})
qsCompleter, err := queueSetCompleterForPL(meal.cfgCtlr.queueSetFactory, nil, proto, requestWaitLimit, obsPair)
@ -651,7 +651,7 @@ func (immediateRequest) Finish(execute func()) bool {
// The returned bool indicates whether the request is exempt from
// limitation. The startWaitingTime is when the request started
// waiting in its queue, or `Time{}` if this did not happen.
func (cfgCtlr *configController) startRequest(ctx context.Context, rd RequestDigest, queueNoteFn fq.QueueNoteFn) (fs *fctypesv1a1.FlowSchema, pl *fctypesv1a1.PriorityLevelConfiguration, isExempt bool, req fq.Request, startWaitingTime time.Time) {
func (cfgCtlr *configController) startRequest(ctx context.Context, rd RequestDigest, queueNoteFn fq.QueueNoteFn) (fs *flowcontrol.FlowSchema, pl *flowcontrol.PriorityLevelConfiguration, isExempt bool, req fq.Request, startWaitingTime time.Time) {
klog.V(7).Infof("startRequest(%#+v)", rd)
cfgCtlr.lock.Lock()
defer cfgCtlr.lock.Unlock()
@ -659,12 +659,12 @@ func (cfgCtlr *configController) startRequest(ctx context.Context, rd RequestDig
if matchesFlowSchema(rd, fs) {
plName := fs.Spec.PriorityLevelConfiguration.Name
plState := cfgCtlr.priorityLevelStates[plName]
if plState.pl.Spec.Type == fctypesv1a1.PriorityLevelEnablementExempt {
if plState.pl.Spec.Type == flowcontrol.PriorityLevelEnablementExempt {
klog.V(7).Infof("startRequest(%#+v) => fsName=%q, distMethod=%#+v, plName=%q, immediate", rd, fs.Name, fs.Spec.DistinguisherMethod, plName)
return fs, plState.pl, true, immediateRequest{}, time.Time{}
}
var numQueues int32
if plState.pl.Spec.Limited.LimitResponse.Type == fctypesv1a1.LimitResponseTypeQueue {
if plState.pl.Spec.Limited.LimitResponse.Type == flowcontrol.LimitResponseTypeQueue {
numQueues = plState.pl.Spec.Limited.LimitResponse.Queuing.Queues
}
@ -686,9 +686,9 @@ func (cfgCtlr *configController) startRequest(ctx context.Context, rd RequestDig
// This can never happen because every configState has a
// FlowSchema that matches everything. If somehow control reaches
// here, panic with some relevant information.
var catchAll *fctypesv1a1.FlowSchema
var catchAll *flowcontrol.FlowSchema
for _, fs := range cfgCtlr.flowSchemas {
if fs.Name == fctypesv1a1.FlowSchemaNameCatchAll {
if fs.Name == flowcontrol.FlowSchemaNameCatchAll {
catchAll = fs
}
}
@ -726,14 +726,14 @@ func (cfgCtlr *configController) maybeReapLocked(plName string, plState *priorit
}
// computeFlowDistinguisher extracts the flow distinguisher according to the given method
func computeFlowDistinguisher(rd RequestDigest, method *fctypesv1a1.FlowDistinguisherMethod) string {
func computeFlowDistinguisher(rd RequestDigest, method *flowcontrol.FlowDistinguisherMethod) string {
if method == nil {
return ""
}
switch method.Type {
case fctypesv1a1.FlowDistinguisherMethodByUserType:
case flowcontrol.FlowDistinguisherMethodByUserType:
return rd.User.GetName()
case fctypesv1a1.FlowDistinguisherMethodByNamespaceType:
case flowcontrol.FlowDistinguisherMethodByNamespaceType:
return rd.RequestInfo.Namespace
default:
// this line shall never reach

View File

@ -30,8 +30,8 @@ import (
kubeinformers "k8s.io/client-go/informers"
"k8s.io/klog/v2"
fctypesv1a1 "k8s.io/api/flowcontrol/v1alpha1"
fcclientv1a1 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1"
flowcontrol "k8s.io/api/flowcontrol/v1beta1"
flowcontrolclient "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1"
)
// Interface defines how the API Priority and Fairness filter interacts with the underlying system.
@ -47,7 +47,7 @@ type Interface interface {
// not be invoked.
Handle(ctx context.Context,
requestDigest RequestDigest,
noteFn func(fs *fctypesv1a1.FlowSchema, pl *fctypesv1a1.PriorityLevelConfiguration),
noteFn func(fs *flowcontrol.FlowSchema, pl *flowcontrol.PriorityLevelConfiguration),
queueNoteFn fq.QueueNoteFn,
execFn func(),
)
@ -69,7 +69,7 @@ type Interface interface {
// New creates a new instance to implement API priority and fairness
func New(
informerFactory kubeinformers.SharedInformerFactory,
flowcontrolClient fcclientv1a1.FlowcontrolV1alpha1Interface,
flowcontrolClient flowcontrolclient.FlowcontrolV1beta1Interface,
serverConcurrencyLimit int,
requestWaitLimit time.Duration,
) Interface {
@ -87,7 +87,7 @@ func New(
// NewTestable is extra flexible to facilitate testing
func NewTestable(
informerFactory kubeinformers.SharedInformerFactory,
flowcontrolClient fcclientv1a1.FlowcontrolV1alpha1Interface,
flowcontrolClient flowcontrolclient.FlowcontrolV1beta1Interface,
serverConcurrencyLimit int,
requestWaitLimit time.Duration,
obsPairGenerator metrics.TimedObserverPairGenerator,
@ -97,7 +97,7 @@ func NewTestable(
}
func (cfgCtlr *configController) Handle(ctx context.Context, requestDigest RequestDigest,
noteFn func(fs *fctypesv1a1.FlowSchema, pl *fctypesv1a1.PriorityLevelConfiguration),
noteFn func(fs *flowcontrol.FlowSchema, pl *flowcontrol.PriorityLevelConfiguration),
queueNoteFn fq.QueueNoteFn,
execFn func()) {
fs, pl, isExempt, req, startWaitingTime := cfgCtlr.startRequest(ctx, requestDigest, queueNoteFn)

View File

@ -25,7 +25,7 @@ import (
"testing"
"time"
fcv1a1 "k8s.io/api/flowcontrol/v1alpha1"
flowcontrol "k8s.io/api/flowcontrol/v1beta1"
"k8s.io/apimachinery/pkg/util/sets"
fcboot "k8s.io/apiserver/pkg/apis/flowcontrol/bootstrap"
"k8s.io/apiserver/pkg/util/flowcontrol/debug"
@ -34,7 +34,7 @@ import (
"k8s.io/apiserver/pkg/util/flowcontrol/metrics"
"k8s.io/client-go/informers"
clientsetfake "k8s.io/client-go/kubernetes/fake"
fcclient "k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1"
fcclient "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1"
"k8s.io/klog/v2"
)
@ -43,8 +43,8 @@ func TestMain(m *testing.M) {
os.Exit(m.Run())
}
var mandPLs = func() map[string]*fcv1a1.PriorityLevelConfiguration {
ans := make(map[string]*fcv1a1.PriorityLevelConfiguration)
var mandPLs = func() map[string]*flowcontrol.PriorityLevelConfiguration {
ans := make(map[string]*flowcontrol.PriorityLevelConfiguration)
for _, mand := range fcboot.MandatoryPriorityLevelConfigurations {
ans[mand.Name] = mand
}
@ -54,9 +54,9 @@ var mandPLs = func() map[string]*fcv1a1.PriorityLevelConfiguration {
type ctlrTestState struct {
t *testing.T
cfgCtlr *configController
fcIfc fcclient.FlowcontrolV1alpha1Interface
existingPLs map[string]*fcv1a1.PriorityLevelConfiguration
existingFSs map[string]*fcv1a1.FlowSchema
fcIfc fcclient.FlowcontrolV1beta1Interface
existingPLs map[string]*flowcontrol.PriorityLevelConfiguration
existingFSs map[string]*flowcontrol.FlowSchema
heldRequestsMap map[string][]heldRequest
requestWG sync.WaitGroup
lock sync.Mutex
@ -206,7 +206,7 @@ var mandQueueSetNames, exclQueueSetNames = func() (sets.String, sets.String) {
mandQueueSetNames := sets.NewString()
exclQueueSetNames := sets.NewString()
for _, mpl := range fcboot.MandatoryPriorityLevelConfigurations {
if mpl.Spec.Type == fcv1a1.PriorityLevelEnablementExempt {
if mpl.Spec.Type == flowcontrol.PriorityLevelEnablementExempt {
exclQueueSetNames.Insert(mpl.Name)
} else {
mandQueueSetNames.Insert(mpl.Name)
@ -222,11 +222,11 @@ func TestConfigConsumer(t *testing.T) {
t.Run(fmt.Sprintf("trial%d:", i), func(t *testing.T) {
clientset := clientsetfake.NewSimpleClientset()
informerFactory := informers.NewSharedInformerFactory(clientset, 0)
flowcontrolClient := clientset.FlowcontrolV1alpha1()
flowcontrolClient := clientset.FlowcontrolV1beta1()
cts := &ctlrTestState{t: t,
fcIfc: flowcontrolClient,
existingFSs: map[string]*fcv1a1.FlowSchema{},
existingPLs: map[string]*fcv1a1.PriorityLevelConfiguration{},
existingFSs: map[string]*flowcontrol.FlowSchema{},
existingPLs: map[string]*flowcontrol.PriorityLevelConfiguration{},
heldRequestsMap: map[string][]heldRequest{},
queues: map[string]*ctlrTestQueueSet{},
}
@ -284,8 +284,8 @@ func TestConfigConsumer(t *testing.T) {
// Now create a new config and digest it
trialStep = fmt.Sprintf("trial%d-%d", i, j)
var newPLs []*fcv1a1.PriorityLevelConfiguration
var newFSs []*fcv1a1.FlowSchema
var newPLs []*flowcontrol.PriorityLevelConfiguration
var newFSs []*flowcontrol.FlowSchema
newPLs, _, desiredPLNames, newBadPLNames = genPLs(rng, trialStep, persistingPLNames, 1+rng.Intn(4))
newFSs, _, newFTRs, newCatchAlls = genFSs(t, rng, trialStep, desiredPLNames, newBadPLNames, 1+rng.Intn(6))
@ -307,7 +307,7 @@ func TestConfigConsumer(t *testing.T) {
}
}
func checkNewFS(cts *ctlrTestState, rng *rand.Rand, trialName string, ftr *fsTestingRecord, catchAlls map[bool]*fcv1a1.FlowSchema) {
func checkNewFS(cts *ctlrTestState, rng *rand.Rand, trialName string, ftr *fsTestingRecord, catchAlls map[bool]*flowcontrol.FlowSchema) {
t := cts.t
ctlr := cts.cfgCtlr
fs := ftr.fs
@ -325,8 +325,8 @@ func checkNewFS(cts *ctlrTestState, rng *rand.Rand, trialName string, ftr *fsTes
startWG.Add(1)
go func(matches, isResource bool, rdu RequestDigest) {
expectedMatch := matches && ftr.wellFormed && (fsPrecedes(fs, catchAlls[isResource]) || fs.Name == catchAlls[isResource].Name)
ctlr.Handle(ctx, rdu, func(matchFS *fcv1a1.FlowSchema, matchPL *fcv1a1.PriorityLevelConfiguration) {
matchIsExempt := matchPL.Spec.Type == fcv1a1.PriorityLevelEnablementExempt
ctlr.Handle(ctx, rdu, func(matchFS *flowcontrol.FlowSchema, matchPL *flowcontrol.PriorityLevelConfiguration) {
matchIsExempt := matchPL.Spec.Type == flowcontrol.PriorityLevelEnablementExempt
t.Logf("Considering FlowSchema %s, expectedMatch=%v, isResource=%v: Handle(%#+v) => note(fs=%s, pl=%s, isExempt=%v)", fs.Name, expectedMatch, isResource, rdu, matchFS.Name, matchPL.Name, matchIsExempt)
if a := matchFS.Name == fs.Name; expectedMatch != a {
t.Errorf("Fail at %s/%s: rd=%#+v, expectedMatch=%v, actualMatch=%v, matchFSName=%q, catchAlls=%#+v", trialName, fs.Name, rdu, expectedMatch, a, matchFS.Name, catchAlls)
@ -355,12 +355,12 @@ func checkNewFS(cts *ctlrTestState, rng *rand.Rand, trialName string, ftr *fsTes
startWG.Wait()
}
func genPLs(rng *rand.Rand, trial string, oldPLNames sets.String, n int) (pls []*fcv1a1.PriorityLevelConfiguration, plMap map[string]*fcv1a1.PriorityLevelConfiguration, goodNames, badNames sets.String) {
pls = make([]*fcv1a1.PriorityLevelConfiguration, 0, n)
plMap = make(map[string]*fcv1a1.PriorityLevelConfiguration, n)
func genPLs(rng *rand.Rand, trial string, oldPLNames sets.String, n int) (pls []*flowcontrol.PriorityLevelConfiguration, plMap map[string]*flowcontrol.PriorityLevelConfiguration, goodNames, badNames sets.String) {
pls = make([]*flowcontrol.PriorityLevelConfiguration, 0, n)
plMap = make(map[string]*flowcontrol.PriorityLevelConfiguration, n)
goodNames = sets.NewString()
badNames = sets.NewString(trial+"-nopl1", trial+"-nopl2")
addGood := func(pl *fcv1a1.PriorityLevelConfiguration) {
addGood := func(pl *flowcontrol.PriorityLevelConfiguration) {
pls = append(pls, pl)
plMap[pl.Name] = pl
goodNames.Insert(pl.Name)
@ -386,12 +386,12 @@ func genPLs(rng *rand.Rand, trial string, oldPLNames sets.String, n int) (pls []
return
}
func genFSs(t *testing.T, rng *rand.Rand, trial string, goodPLNames, badPLNames sets.String, n int) (newFSs []*fcv1a1.FlowSchema, newFSMap map[string]*fcv1a1.FlowSchema, newFTRs map[string]*fsTestingRecord, catchAlls map[bool]*fcv1a1.FlowSchema) {
func genFSs(t *testing.T, rng *rand.Rand, trial string, goodPLNames, badPLNames sets.String, n int) (newFSs []*flowcontrol.FlowSchema, newFSMap map[string]*flowcontrol.FlowSchema, newFTRs map[string]*fsTestingRecord, catchAlls map[bool]*flowcontrol.FlowSchema) {
newFTRs = map[string]*fsTestingRecord{}
catchAlls = map[bool]*fcv1a1.FlowSchema{
catchAlls = map[bool]*flowcontrol.FlowSchema{
false: fcboot.MandatoryFlowSchemaCatchAll,
true: fcboot.MandatoryFlowSchemaCatchAll}
newFSMap = map[string]*fcv1a1.FlowSchema{}
newFSMap = map[string]*flowcontrol.FlowSchema{}
add := func(ftr *fsTestingRecord) {
newFSs = append(newFSs, ftr.fs)
newFSMap[ftr.fs.Name] = ftr.fs
@ -419,7 +419,7 @@ func genFSs(t *testing.T, rng *rand.Rand, trial string, goodPLNames, badPLNames
return
}
func fsPrecedes(a, b *fcv1a1.FlowSchema) bool {
func fsPrecedes(a, b *flowcontrol.FlowSchema) bool {
if a.Spec.MatchingPrecedence < b.Spec.MatchingPrecedence {
return true
}

View File

@ -17,8 +17,9 @@ limitations under the License.
package debug
import (
"k8s.io/apiserver/pkg/endpoints/request"
"time"
"k8s.io/apiserver/pkg/endpoints/request"
)
// QueueSetDump is an instant dump of queue-set.

View File

@ -7,7 +7,7 @@ go_library(
importpath = "k8s.io/apiserver/pkg/util/flowcontrol/format",
visibility = ["//visibility:public"],
deps = [
"//staging/src/k8s.io/api/flowcontrol/v1alpha1:go_default_library",
"//staging/src/k8s.io/api/flowcontrol/v1beta1:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/authentication/user:go_default_library",
"//staging/src/k8s.io/apiserver/pkg/endpoints/request:go_default_library",
],

View File

@ -21,7 +21,7 @@ import (
"encoding/json"
"fmt"
fcv1a1 "k8s.io/api/flowcontrol/v1alpha1"
flowcontrol "k8s.io/api/flowcontrol/v1beta1"
"k8s.io/apiserver/pkg/authentication/user"
"k8s.io/apiserver/pkg/endpoints/request"
)
@ -46,25 +46,25 @@ func (sr Stringer) String() string {
return "nil"
}
switch typed := sr.val.(type) {
case *fcv1a1.FlowSchema,
fcv1a1.FlowSchema,
fcv1a1.FlowSchemaSpec,
fcv1a1.FlowDistinguisherMethod,
*fcv1a1.FlowDistinguisherMethod,
*fcv1a1.PolicyRulesWithSubjects,
fcv1a1.PolicyRulesWithSubjects,
fcv1a1.Subject,
fcv1a1.ResourcePolicyRule,
fcv1a1.NonResourcePolicyRule,
fcv1a1.FlowSchemaCondition,
*fcv1a1.PriorityLevelConfiguration,
fcv1a1.PriorityLevelConfiguration,
fcv1a1.PriorityLevelConfigurationSpec,
*fcv1a1.LimitedPriorityLevelConfiguration,
fcv1a1.LimitedPriorityLevelConfiguration,
fcv1a1.LimitResponse,
*fcv1a1.QueuingConfiguration,
fcv1a1.QueuingConfiguration:
case *flowcontrol.FlowSchema,
flowcontrol.FlowSchema,
flowcontrol.FlowSchemaSpec,
flowcontrol.FlowDistinguisherMethod,
*flowcontrol.FlowDistinguisherMethod,
*flowcontrol.PolicyRulesWithSubjects,
flowcontrol.PolicyRulesWithSubjects,
flowcontrol.Subject,
flowcontrol.ResourcePolicyRule,
flowcontrol.NonResourcePolicyRule,
flowcontrol.FlowSchemaCondition,
*flowcontrol.PriorityLevelConfiguration,
flowcontrol.PriorityLevelConfiguration,
flowcontrol.PriorityLevelConfigurationSpec,
*flowcontrol.LimitedPriorityLevelConfiguration,
flowcontrol.LimitedPriorityLevelConfiguration,
flowcontrol.LimitResponse,
*flowcontrol.QueuingConfiguration,
flowcontrol.QueuingConfiguration:
return ToJSON(sr.val)
case []user.Info:
return FmtUsers(typed)
@ -88,12 +88,12 @@ func ToJSON(val interface{}) string {
// FmtPriorityLevelConfiguration returns a golang source expression
// equivalent to the given value
func FmtPriorityLevelConfiguration(pl *fcv1a1.PriorityLevelConfiguration) string {
func FmtPriorityLevelConfiguration(pl *flowcontrol.PriorityLevelConfiguration) string {
if pl == nil {
return "nil"
}
var buf bytes.Buffer
buf.WriteString(fmt.Sprintf("&v1alpha1.PriorityLevelConfiguration{ObjectMeta: %#+v, Spec: ",
buf.WriteString(fmt.Sprintf("&flowcontrolv1beta1.PriorityLevelConfiguration{ObjectMeta: %#+v, Spec: ",
pl.ObjectMeta))
BufferPriorityLevelConfigurationSpec(&buf, &pl.Spec)
buf.WriteString(fmt.Sprintf(", Status: %#+v}", pl.Status))
@ -102,7 +102,7 @@ func FmtPriorityLevelConfiguration(pl *fcv1a1.PriorityLevelConfiguration) string
// FmtPriorityLevelConfigurationSpec returns a golang source
// expression equivalent to the given value
func FmtPriorityLevelConfigurationSpec(plSpec *fcv1a1.PriorityLevelConfigurationSpec) string {
func FmtPriorityLevelConfigurationSpec(plSpec *flowcontrol.PriorityLevelConfigurationSpec) string {
var buf bytes.Buffer
BufferPriorityLevelConfigurationSpec(&buf, plSpec)
return buf.String()
@ -110,10 +110,10 @@ func FmtPriorityLevelConfigurationSpec(plSpec *fcv1a1.PriorityLevelConfiguration
// BufferPriorityLevelConfigurationSpec writes a golang source
// expression for the given value to the given buffer
func BufferPriorityLevelConfigurationSpec(buf *bytes.Buffer, plSpec *fcv1a1.PriorityLevelConfigurationSpec) {
buf.WriteString(fmt.Sprintf("v1alpha1.PriorityLevelConfigurationSpec{Type: %#v", plSpec.Type))
func BufferPriorityLevelConfigurationSpec(buf *bytes.Buffer, plSpec *flowcontrol.PriorityLevelConfigurationSpec) {
buf.WriteString(fmt.Sprintf("flowcontrolv1beta1.PriorityLevelConfigurationSpec{Type: %#v", plSpec.Type))
if plSpec.Limited != nil {
buf.WriteString(fmt.Sprintf(", Limited: &v1alpha1.LimitedPriorityLevelConfiguration{AssuredConcurrencyShares:%d, LimitResponse:v1alpha1.LimitResponse{Type:%#v", plSpec.Limited.AssuredConcurrencyShares, plSpec.Limited.LimitResponse.Type))
buf.WriteString(fmt.Sprintf(", Limited: &flowcontrol.LimitedPriorityLevelConfiguration{AssuredConcurrencyShares:%d, LimitResponse:flowcontrol.LimitResponse{Type:%#v", plSpec.Limited.AssuredConcurrencyShares, plSpec.Limited.LimitResponse.Type))
if plSpec.Limited.LimitResponse.Queuing != nil {
buf.WriteString(fmt.Sprintf(", Queuing:&%#+v", *plSpec.Limited.LimitResponse.Queuing))
}
@ -123,12 +123,12 @@ func BufferPriorityLevelConfigurationSpec(buf *bytes.Buffer, plSpec *fcv1a1.Prio
}
// FmtFlowSchema produces a golang source expression of the value.
func FmtFlowSchema(fs *fcv1a1.FlowSchema) string {
func FmtFlowSchema(fs *flowcontrol.FlowSchema) string {
if fs == nil {
return "nil"
}
var buf bytes.Buffer
buf.WriteString(fmt.Sprintf("&v1alpha1.FlowSchema{ObjectMeta: %#+v, Spec: ",
buf.WriteString(fmt.Sprintf("&flowcontrolv1beta1.FlowSchema{ObjectMeta: %#+v, Spec: ",
fs.ObjectMeta))
BufferFlowSchemaSpec(&buf, &fs.Spec)
buf.WriteString(fmt.Sprintf(", Status: %#+v}", fs.Status))
@ -137,7 +137,7 @@ func FmtFlowSchema(fs *fcv1a1.FlowSchema) string {
// FmtFlowSchemaSpec produces a golang source expression equivalent to
// the given spec
func FmtFlowSchemaSpec(fsSpec *fcv1a1.FlowSchemaSpec) string {
func FmtFlowSchemaSpec(fsSpec *flowcontrol.FlowSchemaSpec) string {
var buf bytes.Buffer
BufferFlowSchemaSpec(&buf, fsSpec)
return buf.String()
@ -145,8 +145,8 @@ func FmtFlowSchemaSpec(fsSpec *fcv1a1.FlowSchemaSpec) string {
// BufferFlowSchemaSpec writes a golang source expression for the
// given value to the given buffer
func BufferFlowSchemaSpec(buf *bytes.Buffer, fsSpec *fcv1a1.FlowSchemaSpec) {
buf.WriteString(fmt.Sprintf("v1alpha1.FlowSchemaSpec{PriorityLevelConfiguration: %#+v, MatchingPrecedence: %d, DistinguisherMethod: ",
func BufferFlowSchemaSpec(buf *bytes.Buffer, fsSpec *flowcontrol.FlowSchemaSpec) {
buf.WriteString(fmt.Sprintf("flowcontrolv1beta1.FlowSchemaSpec{PriorityLevelConfiguration: %#+v, MatchingPrecedence: %d, DistinguisherMethod: ",
fsSpec.PriorityLevelConfiguration,
fsSpec.MatchingPrecedence))
if fsSpec.DistinguisherMethod == nil {
@ -154,7 +154,7 @@ func BufferFlowSchemaSpec(buf *bytes.Buffer, fsSpec *fcv1a1.FlowSchemaSpec) {
} else {
buf.WriteString(fmt.Sprintf("&%#+v", *fsSpec.DistinguisherMethod))
}
buf.WriteString(", Rules: []v1alpha1.PolicyRulesWithSubjects{")
buf.WriteString(", Rules: []flowcontrol.PolicyRulesWithSubjects{")
for idx, rule := range fsSpec.Rules {
if idx > 0 {
buf.WriteString(", ")
@ -165,14 +165,14 @@ func BufferFlowSchemaSpec(buf *bytes.Buffer, fsSpec *fcv1a1.FlowSchemaSpec) {
}
// FmtPolicyRulesWithSubjects produces a golang source expression of the value.
func FmtPolicyRulesWithSubjects(rule fcv1a1.PolicyRulesWithSubjects) string {
return "v1alpha1.PolicyRulesWithSubjects" + FmtPolicyRulesWithSubjectsSlim(rule)
func FmtPolicyRulesWithSubjects(rule flowcontrol.PolicyRulesWithSubjects) string {
return "flowcontrolv1beta1.PolicyRulesWithSubjects" + FmtPolicyRulesWithSubjectsSlim(rule)
}
// FmtPolicyRulesWithSubjectsSlim produces a golang source expression
// of the value but without the leading type name. See above for an
// example context where this is useful.
func FmtPolicyRulesWithSubjectsSlim(rule fcv1a1.PolicyRulesWithSubjects) string {
func FmtPolicyRulesWithSubjectsSlim(rule flowcontrol.PolicyRulesWithSubjects) string {
var buf bytes.Buffer
BufferFmtPolicyRulesWithSubjectsSlim(&buf, rule)
return buf.String()
@ -181,8 +181,8 @@ func FmtPolicyRulesWithSubjectsSlim(rule fcv1a1.PolicyRulesWithSubjects) string
// BufferFmtPolicyRulesWithSubjectsSlim writes a golang source
// expression for the given value to the given buffer but excludes the
// leading type name
func BufferFmtPolicyRulesWithSubjectsSlim(buf *bytes.Buffer, rule fcv1a1.PolicyRulesWithSubjects) {
buf.WriteString("{Subjects: []v1alpha1.Subject{")
func BufferFmtPolicyRulesWithSubjectsSlim(buf *bytes.Buffer, rule flowcontrol.PolicyRulesWithSubjects) {
buf.WriteString("{Subjects: []flowcontrolv1beta1.Subject{")
for jdx, subj := range rule.Subjects {
if jdx > 0 {
buf.WriteString(", ")

View File

@ -23,7 +23,7 @@ import (
"testing"
"time"
fcv1a1 "k8s.io/api/flowcontrol/v1alpha1"
flowcontrol "k8s.io/api/flowcontrol/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/sets"
fcboot "k8s.io/apiserver/pkg/apis/flowcontrol/bootstrap"
@ -39,19 +39,19 @@ var noRestraintQSF = fqtesting.NewNoRestraintFactory()
// genPL creates a valid PriorityLevelConfiguration with the given
// name and randomly generated spec. The given name must not be one
// of the mandatory ones.
func genPL(rng *rand.Rand, name string) *fcv1a1.PriorityLevelConfiguration {
plc := &fcv1a1.PriorityLevelConfiguration{
func genPL(rng *rand.Rand, name string) *flowcontrol.PriorityLevelConfiguration {
plc := &flowcontrol.PriorityLevelConfiguration{
ObjectMeta: metav1.ObjectMeta{Name: name},
Spec: fcv1a1.PriorityLevelConfigurationSpec{
Type: fcv1a1.PriorityLevelEnablementLimited,
Limited: &fcv1a1.LimitedPriorityLevelConfiguration{
Spec: flowcontrol.PriorityLevelConfigurationSpec{
Type: flowcontrol.PriorityLevelEnablementLimited,
Limited: &flowcontrol.LimitedPriorityLevelConfiguration{
AssuredConcurrencyShares: rng.Int31n(100) + 1,
LimitResponse: fcv1a1.LimitResponse{
Type: fcv1a1.LimitResponseTypeReject}}}}
LimitResponse: flowcontrol.LimitResponse{
Type: flowcontrol.LimitResponseTypeReject}}}}
if rng.Float32() < 0.95 {
plc.Spec.Limited.LimitResponse.Type = fcv1a1.LimitResponseTypeQueue
plc.Spec.Limited.LimitResponse.Type = flowcontrol.LimitResponseTypeQueue
hs := rng.Int31n(5) + 1
plc.Spec.Limited.LimitResponse.Queuing = &fcv1a1.QueuingConfiguration{
plc.Spec.Limited.LimitResponse.Queuing = &flowcontrol.QueuingConfiguration{
Queues: hs + rng.Int31n(20),
HandSize: hs,
QueueLengthLimit: 5}
@ -65,7 +65,7 @@ func genPL(rng *rand.Rand, name string) *fcv1a1.PriorityLevelConfiguration {
// A FlowSchema together with characteristics relevant to testing
type fsTestingRecord struct {
fs *fcv1a1.FlowSchema
fs *flowcontrol.FlowSchema
// Does this reference an existing priority level?
wellFormed bool
matchesAllResourceRequests bool
@ -85,8 +85,8 @@ func (ftr *fsTestingRecord) addDigests(digests []RequestDigest, matches bool) {
}
var flowDistinguisherMethodTypes = sets.NewString(
string(fcv1a1.FlowDistinguisherMethodByUserType),
string(fcv1a1.FlowDistinguisherMethodByNamespaceType),
string(flowcontrol.FlowDistinguisherMethodByUserType),
string(flowcontrol.FlowDistinguisherMethodByNamespaceType),
)
var mandFTRExempt = &fsTestingRecord{
@ -189,9 +189,9 @@ var mandFTRCatchAll = &fsTestingRecord{
// formed spec references a priority level drawn from badPLNames.
// goodPLNames may be empty, but badPLNames may not.
func genFS(t *testing.T, rng *rand.Rand, name string, mayMatchClusterScope bool, goodPLNames, badPLNames sets.String) *fsTestingRecord {
fs := &fcv1a1.FlowSchema{
fs := &flowcontrol.FlowSchema{
ObjectMeta: metav1.ObjectMeta{Name: name},
Spec: fcv1a1.FlowSchemaSpec{}}
Spec: flowcontrol.FlowSchemaSpec{}}
// 5% chance of zero rules, otherwise draw from 1--6 biased low
nRules := (1 + rng.Intn(3)) * (1 + rng.Intn(2)) * ((19 + rng.Intn(20)) / 20)
ftr := &fsTestingRecord{fs: fs,
@ -202,23 +202,23 @@ func genFS(t *testing.T, rng *rand.Rand, name string, mayMatchClusterScope bool,
false: {false: {}, true: {}},
true: {false: {}, true: {}}},
}
dangleStatus := fcv1a1.ConditionFalse
dangleStatus := flowcontrol.ConditionFalse
if rng.Float32() < 0.9 && len(goodPLNames) > 0 {
fs.Spec.PriorityLevelConfiguration = fcv1a1.PriorityLevelConfigurationReference{pickSetString(rng, goodPLNames)}
fs.Spec.PriorityLevelConfiguration = flowcontrol.PriorityLevelConfigurationReference{pickSetString(rng, goodPLNames)}
} else {
fs.Spec.PriorityLevelConfiguration = fcv1a1.PriorityLevelConfigurationReference{pickSetString(rng, badPLNames)}
fs.Spec.PriorityLevelConfiguration = flowcontrol.PriorityLevelConfigurationReference{pickSetString(rng, badPLNames)}
ftr.wellFormed = false
dangleStatus = fcv1a1.ConditionTrue
dangleStatus = flowcontrol.ConditionTrue
}
fs.Status.Conditions = []fcv1a1.FlowSchemaCondition{{
Type: fcv1a1.FlowSchemaConditionDangling,
fs.Status.Conditions = []flowcontrol.FlowSchemaCondition{{
Type: flowcontrol.FlowSchemaConditionDangling,
Status: dangleStatus}}
fs.Spec.MatchingPrecedence = rng.Int31n(9997) + 2
if rng.Float32() < 0.8 {
fdmt := fcv1a1.FlowDistinguisherMethodType(pickSetString(rng, flowDistinguisherMethodTypes))
fs.Spec.DistinguisherMethod = &fcv1a1.FlowDistinguisherMethod{fdmt}
fdmt := flowcontrol.FlowDistinguisherMethodType(pickSetString(rng, flowDistinguisherMethodTypes))
fs.Spec.DistinguisherMethod = &flowcontrol.FlowDistinguisherMethod{fdmt}
}
fs.Spec.Rules = []fcv1a1.PolicyRulesWithSubjects{}
fs.Spec.Rules = []flowcontrol.PolicyRulesWithSubjects{}
everyResourceMatcher := -1
if ftr.matchesAllResourceRequests {
if mayMatchClusterScope {
@ -275,12 +275,12 @@ var noextra = make(map[string][]string)
// cluster-scoped request. Thus, these are normally excluded. When
// mayMatchClusterScope==true the generated rule may be cluster-scoped
// and there is no promise of cross-rule exclusion.
func genPolicyRuleWithSubjects(t *testing.T, rng *rand.Rand, pfx string, mayMatchClusterScope, someMatchesAllResourceRequests, someMatchesAllNonResourceRequests, matchAllResourceRequests, matchAllNonResourceRequests bool) (fcv1a1.PolicyRulesWithSubjects, []RequestDigest, []RequestDigest, []RequestDigest, []RequestDigest) {
subjects := []fcv1a1.Subject{}
func genPolicyRuleWithSubjects(t *testing.T, rng *rand.Rand, pfx string, mayMatchClusterScope, someMatchesAllResourceRequests, someMatchesAllNonResourceRequests, matchAllResourceRequests, matchAllNonResourceRequests bool) (flowcontrol.PolicyRulesWithSubjects, []RequestDigest, []RequestDigest, []RequestDigest, []RequestDigest) {
subjects := []flowcontrol.Subject{}
matchingUIs := []user.Info{}
skippingUIs := []user.Info{}
resourceRules := []fcv1a1.ResourcePolicyRule{}
nonResourceRules := []fcv1a1.NonResourcePolicyRule{}
resourceRules := []flowcontrol.ResourcePolicyRule{}
nonResourceRules := []flowcontrol.NonResourcePolicyRule{}
matchingRRIs := []*request.RequestInfo{}
skippingRRIs := []*request.RequestInfo{}
matchingNRIs := []*request.RequestInfo{}
@ -341,7 +341,7 @@ func genPolicyRuleWithSubjects(t *testing.T, rng *rand.Rand, pfx string, mayMatc
if nRR == 0 {
_, _, skippingNRIs = genNonResourceRule(rng, pfx+"-o", false, someMatchesAllNonResourceRequests)
}
rule := fcv1a1.PolicyRulesWithSubjects{subjects, resourceRules, nonResourceRules}
rule := flowcontrol.PolicyRulesWithSubjects{subjects, resourceRules, nonResourceRules}
t.Logf("For pfx=%s, mayMatchClusterScope=%v, someMatchesAllResourceRequests=%v, someMatchesAllNonResourceRequests=%v, marr=%v, manrr=%v: generated prws=%s, mu=%s, su=%s, mrr=%s, mnr=%s, srr=%s, snr=%s", pfx, mayMatchClusterScope, someMatchesAllResourceRequests, someMatchesAllNonResourceRequests, matchAllResourceRequests, matchAllNonResourceRequests, fcfmt.Fmt(rule), fcfmt.Fmt(matchingUIs), fcfmt.Fmt(skippingUIs), fcfmt.Fmt(matchingRRIs), fcfmt.Fmt(matchingNRIs), fcfmt.Fmt(skippingRRIs), fcfmt.Fmt(skippingNRIs))
matchingRDigests := cross(matchingUIs, matchingRRIs)
skippingRDigests := append(append(cross(matchingUIs, skippingRRIs),
@ -368,7 +368,7 @@ func cross(uis []user.Info, ris []*request.RequestInfo) []RequestDigest {
return ans
}
func shuffleAndTakeDigests(t *testing.T, rng *rand.Rand, rule *fcv1a1.PolicyRulesWithSubjects, toMatch bool, digests []RequestDigest, n int) []RequestDigest {
func shuffleAndTakeDigests(t *testing.T, rng *rand.Rand, rule *flowcontrol.PolicyRulesWithSubjects, toMatch bool, digests []RequestDigest, n int) []RequestDigest {
ans := make([]RequestDigest, 0, n)
for len(ans) < n && len(digests) > 0 {
i := rng.Intn(len(digests))
@ -409,25 +409,25 @@ func uniqify(in RequestDigest) RequestDigest {
// names that begin with the given prefix. The second returned list
// contains members that mismatch the generated Subject and involve
// names that begin with the given prefix.
func genSubject(rng *rand.Rand, pfx string) (fcv1a1.Subject, []user.Info, []user.Info) {
subject := fcv1a1.Subject{}
func genSubject(rng *rand.Rand, pfx string) (flowcontrol.Subject, []user.Info, []user.Info) {
subject := flowcontrol.Subject{}
var matchingUIs, skippingUIs []user.Info
x := rng.Float32()
switch {
case x < 0.33:
subject.Kind = fcv1a1.SubjectKindUser
subject.Kind = flowcontrol.SubjectKindUser
subject.User, matchingUIs, skippingUIs = genUser(rng, pfx)
case x < 0.67:
subject.Kind = fcv1a1.SubjectKindGroup
subject.Kind = flowcontrol.SubjectKindGroup
subject.Group, matchingUIs, skippingUIs = genGroup(rng, pfx)
default:
subject.Kind = fcv1a1.SubjectKindServiceAccount
subject.Kind = flowcontrol.SubjectKindServiceAccount
subject.ServiceAccount, matchingUIs, skippingUIs = genServiceAccount(rng, pfx)
}
return subject, matchingUIs, skippingUIs
}
func genUser(rng *rand.Rand, pfx string) (*fcv1a1.UserSubject, []user.Info, []user.Info) {
func genUser(rng *rand.Rand, pfx string) (*flowcontrol.UserSubject, []user.Info, []user.Info) {
mui := &user.DefaultInfo{
Name: pfx + "-u",
UID: "good-id",
@ -438,7 +438,7 @@ func genUser(rng *rand.Rand, pfx string) (*fcv1a1.UserSubject, []user.Info, []us
UID: mui.UID,
Groups: mui.Groups,
Extra: mui.Extra}}
return &fcv1a1.UserSubject{mui.Name}, []user.Info{mui}, skips
return &flowcontrol.UserSubject{mui.Name}, []user.Info{mui}, skips
}
var groupCover = []string{"system:authenticated", "system:unauthenticated"}
@ -447,21 +447,21 @@ func mg(rng *rand.Rand) string {
return groupCover[rng.Intn(len(groupCover))]
}
func mkUserSubject(username string) fcv1a1.Subject {
return fcv1a1.Subject{
Kind: fcv1a1.SubjectKindUser,
User: &fcv1a1.UserSubject{username},
func mkUserSubject(username string) flowcontrol.Subject {
return flowcontrol.Subject{
Kind: flowcontrol.SubjectKindUser,
User: &flowcontrol.UserSubject{username},
}
}
func mkGroupSubject(group string) fcv1a1.Subject {
return fcv1a1.Subject{
Kind: fcv1a1.SubjectKindGroup,
Group: &fcv1a1.GroupSubject{group},
func mkGroupSubject(group string) flowcontrol.Subject {
return flowcontrol.Subject{
Kind: flowcontrol.SubjectKindGroup,
Group: &flowcontrol.GroupSubject{group},
}
}
func genGroup(rng *rand.Rand, pfx string) (*fcv1a1.GroupSubject, []user.Info, []user.Info) {
func genGroup(rng *rand.Rand, pfx string) (*flowcontrol.GroupSubject, []user.Info, []user.Info) {
name := pfx + "-g"
ui := &user.DefaultInfo{
Name: pfx + "-u",
@ -487,10 +487,10 @@ func genGroup(rng *rand.Rand, pfx string) (*fcv1a1.GroupSubject, []user.Info, []
if rng.Intn(2) == 0 {
skipper.Groups = append(skipper.Groups, pfx+"-k")
}
return &fcv1a1.GroupSubject{name}, []user.Info{ui}, []user.Info{skipper}
return &flowcontrol.GroupSubject{name}, []user.Info{ui}, []user.Info{skipper}
}
func genServiceAccount(rng *rand.Rand, pfx string) (*fcv1a1.ServiceAccountSubject, []user.Info, []user.Info) {
func genServiceAccount(rng *rand.Rand, pfx string) (*flowcontrol.ServiceAccountSubject, []user.Info, []user.Info) {
ns := pfx + "-ns"
name := pfx + "-n"
mname := name
@ -516,19 +516,19 @@ func genServiceAccount(rng *rand.Rand, pfx string) (*fcv1a1.ServiceAccountSubjec
Groups: mui.Groups,
Extra: mui.Extra}}
}
return &fcv1a1.ServiceAccountSubject{Namespace: ns, Name: mname}, []user.Info{mui}, skips
return &flowcontrol.ServiceAccountSubject{Namespace: ns, Name: mname}, []user.Info{mui}, skips
}
// genResourceRule randomly generates a valid ResourcePolicyRule and lists
// of matching and non-matching `*request.RequestInfo`.
func genResourceRule(rng *rand.Rand, pfx string, mayMatchClusterScope, matchAllResources, someMatchesAllResources bool) (fcv1a1.ResourcePolicyRule, []*request.RequestInfo, []*request.RequestInfo) {
func genResourceRule(rng *rand.Rand, pfx string, mayMatchClusterScope, matchAllResources, someMatchesAllResources bool) (flowcontrol.ResourcePolicyRule, []*request.RequestInfo, []*request.RequestInfo) {
namespaces := []string{pfx + "-n1", pfx + "-n2", pfx + "-n3"}
rnamespaces := namespaces
if mayMatchClusterScope && rng.Float32() < 0.1 {
namespaces[0] = ""
rnamespaces = namespaces[1:]
}
rr := fcv1a1.ResourcePolicyRule{
rr := flowcontrol.ResourcePolicyRule{
Verbs: []string{pfx + "-v1", pfx + "-v2", pfx + "-v3"},
APIGroups: []string{pfx + ".g1", pfx + ".g2", pfx + ".g3"},
Resources: []string{pfx + "-r1s", pfx + "-r2s", pfx + "-r3s"},
@ -550,17 +550,17 @@ func genResourceRule(rng *rand.Rand, pfx string, mayMatchClusterScope, matchAllR
// choose a proper subset of fields to wildcard; only matters if not matching all
starMask := rng.Intn(15)
if matchAllResources || starMask&1 == 1 && rng.Float32() < 0.1 {
rr.Verbs = []string{fcv1a1.VerbAll}
rr.Verbs = []string{flowcontrol.VerbAll}
}
if matchAllResources || starMask&2 == 2 && rng.Float32() < 0.1 {
rr.APIGroups = []string{fcv1a1.APIGroupAll}
rr.APIGroups = []string{flowcontrol.APIGroupAll}
}
if matchAllResources || starMask&4 == 4 && rng.Float32() < 0.1 {
rr.Resources = []string{fcv1a1.ResourceAll}
rr.Resources = []string{flowcontrol.ResourceAll}
}
if matchAllResources || starMask&8 == 8 && rng.Float32() < 0.1 {
rr.ClusterScope = true
rr.Namespaces = []string{fcv1a1.NamespaceEvery}
rr.Namespaces = []string{flowcontrol.NamespaceEvery}
}
return rr, matchingRIs, skippingRIs
}
@ -616,8 +616,8 @@ func chooseInts(rng *rand.Rand, n, m int) []int {
// genNonResourceRule returns a randomly generated valid
// NonResourcePolicyRule and lists of matching and non-matching
// `*request.RequestInfo`.
func genNonResourceRule(rng *rand.Rand, pfx string, matchAllNonResources, someMatchesAllNonResources bool) (fcv1a1.NonResourcePolicyRule, []*request.RequestInfo, []*request.RequestInfo) {
nrr := fcv1a1.NonResourcePolicyRule{
func genNonResourceRule(rng *rand.Rand, pfx string, matchAllNonResources, someMatchesAllNonResources bool) (flowcontrol.NonResourcePolicyRule, []*request.RequestInfo, []*request.RequestInfo) {
nrr := flowcontrol.NonResourcePolicyRule{
Verbs: []string{pfx + "-v1", pfx + "-v2", pfx + "-v3"},
NonResourceURLs: []string{"/" + pfx + "/g/p1", "/" + pfx + "/g/p2", "/" + pfx + "/g/p3"},
}
@ -631,7 +631,7 @@ func genNonResourceRule(rng *rand.Rand, pfx string, matchAllNonResources, someMa
// choose a proper subset of fields to consider wildcarding; only matters if not matching all
starMask := rng.Intn(3)
if matchAllNonResources || starMask&1 == 1 && rng.Float32() < 0.1 {
nrr.Verbs = []string{fcv1a1.VerbAll}
nrr.Verbs = []string{flowcontrol.VerbAll}
}
if matchAllNonResources || starMask&2 == 2 && rng.Float32() < 0.1 {
nrr.NonResourceURLs = []string{"*"}

View File

@ -21,7 +21,7 @@ import (
"math/rand"
"testing"
fcv1a1 "k8s.io/api/flowcontrol/v1alpha1"
flowcontrol "k8s.io/api/flowcontrol/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/sets"
"k8s.io/apiserver/pkg/authentication/user"
@ -116,204 +116,204 @@ func TestLiterals(t *testing.T) {
Path: "/openapi/v2",
Verb: "goodverb"},
ui}
checkRules(t, true, reqRN, []fcv1a1.PolicyRulesWithSubjects{{
Subjects: []fcv1a1.Subject{{Kind: fcv1a1.SubjectKindUser,
User: &fcv1a1.UserSubject{"goodu"}}},
ResourceRules: []fcv1a1.ResourcePolicyRule{{
checkRules(t, true, reqRN, []flowcontrol.PolicyRulesWithSubjects{{
Subjects: []flowcontrol.Subject{{Kind: flowcontrol.SubjectKindUser,
User: &flowcontrol.UserSubject{"goodu"}}},
ResourceRules: []flowcontrol.ResourcePolicyRule{{
Verbs: []string{"goodverb"},
APIGroups: []string{"goodapig"},
Resources: []string{"goodrscs"},
Namespaces: []string{"goodns"}}}}, {
Subjects: []fcv1a1.Subject{{Kind: fcv1a1.SubjectKindGroup,
Group: &fcv1a1.GroupSubject{"goodg1"}}},
ResourceRules: []fcv1a1.ResourcePolicyRule{{
Subjects: []flowcontrol.Subject{{Kind: flowcontrol.SubjectKindGroup,
Group: &flowcontrol.GroupSubject{"goodg1"}}},
ResourceRules: []flowcontrol.ResourcePolicyRule{{
Verbs: []string{"goodverb"},
APIGroups: []string{"goodapig"},
Resources: []string{"goodrscs"},
Namespaces: []string{"goodns"}}}}, {
Subjects: []fcv1a1.Subject{{Kind: fcv1a1.SubjectKindUser,
User: &fcv1a1.UserSubject{"*"}}},
ResourceRules: []fcv1a1.ResourcePolicyRule{{
Subjects: []flowcontrol.Subject{{Kind: flowcontrol.SubjectKindUser,
User: &flowcontrol.UserSubject{"*"}}},
ResourceRules: []flowcontrol.ResourcePolicyRule{{
Verbs: []string{"goodverb"},
APIGroups: []string{"goodapig"},
Resources: []string{"goodrscs"},
Namespaces: []string{"goodns"}}}}, {
Subjects: []fcv1a1.Subject{{Kind: fcv1a1.SubjectKindGroup,
Group: &fcv1a1.GroupSubject{"*"}}},
ResourceRules: []fcv1a1.ResourcePolicyRule{{
Subjects: []flowcontrol.Subject{{Kind: flowcontrol.SubjectKindGroup,
Group: &flowcontrol.GroupSubject{"*"}}},
ResourceRules: []flowcontrol.ResourcePolicyRule{{
Verbs: []string{"goodverb"},
APIGroups: []string{"goodapig"},
Resources: []string{"goodrscs"},
Namespaces: []string{"goodns"}}}}, {
Subjects: []fcv1a1.Subject{{Kind: fcv1a1.SubjectKindUser,
User: &fcv1a1.UserSubject{"goodu"}}},
ResourceRules: []fcv1a1.ResourcePolicyRule{{
Subjects: []flowcontrol.Subject{{Kind: flowcontrol.SubjectKindUser,
User: &flowcontrol.UserSubject{"goodu"}}},
ResourceRules: []flowcontrol.ResourcePolicyRule{{
Verbs: []string{"*"},
APIGroups: []string{"goodapig"},
Resources: []string{"goodrscs"},
Namespaces: []string{"goodns"}}}}, {
Subjects: []fcv1a1.Subject{{Kind: fcv1a1.SubjectKindUser,
User: &fcv1a1.UserSubject{"goodu"}}},
ResourceRules: []fcv1a1.ResourcePolicyRule{{
Subjects: []flowcontrol.Subject{{Kind: flowcontrol.SubjectKindUser,
User: &flowcontrol.UserSubject{"goodu"}}},
ResourceRules: []flowcontrol.ResourcePolicyRule{{
Verbs: []string{"goodverb"},
APIGroups: []string{"*"},
Resources: []string{"goodrscs"},
Namespaces: []string{"goodns"}}}}, {
Subjects: []fcv1a1.Subject{{Kind: fcv1a1.SubjectKindUser,
User: &fcv1a1.UserSubject{"goodu"}}},
ResourceRules: []fcv1a1.ResourcePolicyRule{{
Subjects: []flowcontrol.Subject{{Kind: flowcontrol.SubjectKindUser,
User: &flowcontrol.UserSubject{"goodu"}}},
ResourceRules: []flowcontrol.ResourcePolicyRule{{
Verbs: []string{"goodverb"},
APIGroups: []string{"goodapig"},
Resources: []string{"*"},
Namespaces: []string{"goodns"}}}}, {
Subjects: []fcv1a1.Subject{{Kind: fcv1a1.SubjectKindUser,
User: &fcv1a1.UserSubject{"goodu"}}},
ResourceRules: []fcv1a1.ResourcePolicyRule{{
Subjects: []flowcontrol.Subject{{Kind: flowcontrol.SubjectKindUser,
User: &flowcontrol.UserSubject{"goodu"}}},
ResourceRules: []flowcontrol.ResourcePolicyRule{{
Verbs: []string{"goodverb"},
APIGroups: []string{"goodapig"},
Resources: []string{"goodrscs"},
Namespaces: []string{"*"}}}},
})
checkRules(t, false, reqRN, []fcv1a1.PolicyRulesWithSubjects{{
Subjects: []fcv1a1.Subject{{Kind: fcv1a1.SubjectKindUser,
User: &fcv1a1.UserSubject{"badu"}}},
ResourceRules: []fcv1a1.ResourcePolicyRule{{
checkRules(t, false, reqRN, []flowcontrol.PolicyRulesWithSubjects{{
Subjects: []flowcontrol.Subject{{Kind: flowcontrol.SubjectKindUser,
User: &flowcontrol.UserSubject{"badu"}}},
ResourceRules: []flowcontrol.ResourcePolicyRule{{
Verbs: []string{"goodverb"},
APIGroups: []string{"goodapig"},
Resources: []string{"goodrscs"},
Namespaces: []string{"goodns"}}}}, {
Subjects: []fcv1a1.Subject{{Kind: fcv1a1.SubjectKindGroup,
Group: &fcv1a1.GroupSubject{"badg"}}},
ResourceRules: []fcv1a1.ResourcePolicyRule{{
Subjects: []flowcontrol.Subject{{Kind: flowcontrol.SubjectKindGroup,
Group: &flowcontrol.GroupSubject{"badg"}}},
ResourceRules: []flowcontrol.ResourcePolicyRule{{
Verbs: []string{"goodverb"},
APIGroups: []string{"goodapig"},
Resources: []string{"goodrscs"},
Namespaces: []string{"goodns"}}}}, {
Subjects: []fcv1a1.Subject{{Kind: fcv1a1.SubjectKindUser,
User: &fcv1a1.UserSubject{"goodu"}}},
ResourceRules: []fcv1a1.ResourcePolicyRule{{
Subjects: []flowcontrol.Subject{{Kind: flowcontrol.SubjectKindUser,
User: &flowcontrol.UserSubject{"goodu"}}},
ResourceRules: []flowcontrol.ResourcePolicyRule{{
Verbs: []string{"badverb"},
APIGroups: []string{"goodapig"},
Resources: []string{"goodrscs"},
Namespaces: []string{"goodns"}}}}, {
Subjects: []fcv1a1.Subject{{Kind: fcv1a1.SubjectKindUser,
User: &fcv1a1.UserSubject{"goodu"}}},
ResourceRules: []fcv1a1.ResourcePolicyRule{{
Subjects: []flowcontrol.Subject{{Kind: flowcontrol.SubjectKindUser,
User: &flowcontrol.UserSubject{"goodu"}}},
ResourceRules: []flowcontrol.ResourcePolicyRule{{
Verbs: []string{"goodverb"},
APIGroups: []string{"badapig"},
Resources: []string{"goodrscs"},
Namespaces: []string{"goodns"}}}}, {
Subjects: []fcv1a1.Subject{{Kind: fcv1a1.SubjectKindUser,
User: &fcv1a1.UserSubject{"goodu"}}},
ResourceRules: []fcv1a1.ResourcePolicyRule{{
Subjects: []flowcontrol.Subject{{Kind: flowcontrol.SubjectKindUser,
User: &flowcontrol.UserSubject{"goodu"}}},
ResourceRules: []flowcontrol.ResourcePolicyRule{{
Verbs: []string{"goodverb"},
APIGroups: []string{"goodapig"},
Resources: []string{"badrscs"},
Namespaces: []string{"goodns"}}}}, {
Subjects: []fcv1a1.Subject{{Kind: fcv1a1.SubjectKindUser,
User: &fcv1a1.UserSubject{"goodu"}}},
ResourceRules: []fcv1a1.ResourcePolicyRule{{
Subjects: []flowcontrol.Subject{{Kind: flowcontrol.SubjectKindUser,
User: &flowcontrol.UserSubject{"goodu"}}},
ResourceRules: []flowcontrol.ResourcePolicyRule{{
Verbs: []string{"goodverb"},
APIGroups: []string{"goodapig"},
Resources: []string{"goodrscs"},
Namespaces: []string{"badns"}}}},
})
checkRules(t, true, reqRU, []fcv1a1.PolicyRulesWithSubjects{{
Subjects: []fcv1a1.Subject{{Kind: fcv1a1.SubjectKindUser,
User: &fcv1a1.UserSubject{"goodu"}}},
ResourceRules: []fcv1a1.ResourcePolicyRule{{
checkRules(t, true, reqRU, []flowcontrol.PolicyRulesWithSubjects{{
Subjects: []flowcontrol.Subject{{Kind: flowcontrol.SubjectKindUser,
User: &flowcontrol.UserSubject{"goodu"}}},
ResourceRules: []flowcontrol.ResourcePolicyRule{{
Verbs: []string{"goodverb"},
APIGroups: []string{"goodapig"},
Resources: []string{"goodrscs"},
ClusterScope: true}}}, {
Subjects: []fcv1a1.Subject{{Kind: fcv1a1.SubjectKindUser,
User: &fcv1a1.UserSubject{"goodu"}}},
ResourceRules: []fcv1a1.ResourcePolicyRule{{
Subjects: []flowcontrol.Subject{{Kind: flowcontrol.SubjectKindUser,
User: &flowcontrol.UserSubject{"goodu"}}},
ResourceRules: []flowcontrol.ResourcePolicyRule{{
Verbs: []string{"*"},
APIGroups: []string{"goodapig"},
Resources: []string{"goodrscs"},
ClusterScope: true}}}, {
Subjects: []fcv1a1.Subject{{Kind: fcv1a1.SubjectKindUser,
User: &fcv1a1.UserSubject{"goodu"}}},
ResourceRules: []fcv1a1.ResourcePolicyRule{{
Subjects: []flowcontrol.Subject{{Kind: flowcontrol.SubjectKindUser,
User: &flowcontrol.UserSubject{"goodu"}}},
ResourceRules: []flowcontrol.ResourcePolicyRule{{
Verbs: []string{"goodverb"},
APIGroups: []string{"*"},
Resources: []string{"goodrscs"},
ClusterScope: true}}}, {
Subjects: []fcv1a1.Subject{{Kind: fcv1a1.SubjectKindUser,
User: &fcv1a1.UserSubject{"goodu"}}},
ResourceRules: []fcv1a1.ResourcePolicyRule{{
Subjects: []flowcontrol.Subject{{Kind: flowcontrol.SubjectKindUser,
User: &flowcontrol.UserSubject{"goodu"}}},
ResourceRules: []flowcontrol.ResourcePolicyRule{{
Verbs: []string{"goodverb"},
APIGroups: []string{"goodapig"},
Resources: []string{"*"},
ClusterScope: true}}}})
checkRules(t, false, reqRU, []fcv1a1.PolicyRulesWithSubjects{{
Subjects: []fcv1a1.Subject{{Kind: fcv1a1.SubjectKindUser,
User: &fcv1a1.UserSubject{"goodu"}}},
ResourceRules: []fcv1a1.ResourcePolicyRule{{
checkRules(t, false, reqRU, []flowcontrol.PolicyRulesWithSubjects{{
Subjects: []flowcontrol.Subject{{Kind: flowcontrol.SubjectKindUser,
User: &flowcontrol.UserSubject{"goodu"}}},
ResourceRules: []flowcontrol.ResourcePolicyRule{{
Verbs: []string{"badverb"},
APIGroups: []string{"goodapig"},
Resources: []string{"goodrscs"},
ClusterScope: true}}}, {
Subjects: []fcv1a1.Subject{{Kind: fcv1a1.SubjectKindUser,
User: &fcv1a1.UserSubject{"goodu"}}},
ResourceRules: []fcv1a1.ResourcePolicyRule{{
Subjects: []flowcontrol.Subject{{Kind: flowcontrol.SubjectKindUser,
User: &flowcontrol.UserSubject{"goodu"}}},
ResourceRules: []flowcontrol.ResourcePolicyRule{{
Verbs: []string{"goodverb"},
APIGroups: []string{"badapig"},
Resources: []string{"goodrscs"},
ClusterScope: true}}}, {
Subjects: []fcv1a1.Subject{{Kind: fcv1a1.SubjectKindUser,
User: &fcv1a1.UserSubject{"goodu"}}},
ResourceRules: []fcv1a1.ResourcePolicyRule{{
Subjects: []flowcontrol.Subject{{Kind: flowcontrol.SubjectKindUser,
User: &flowcontrol.UserSubject{"goodu"}}},
ResourceRules: []flowcontrol.ResourcePolicyRule{{
Verbs: []string{"goodverb"},
APIGroups: []string{"goodapig"},
Resources: []string{"badrscs"},
ClusterScope: true}}}, {
Subjects: []fcv1a1.Subject{{Kind: fcv1a1.SubjectKindUser,
User: &fcv1a1.UserSubject{"goodu"}}},
ResourceRules: []fcv1a1.ResourcePolicyRule{{
Subjects: []flowcontrol.Subject{{Kind: flowcontrol.SubjectKindUser,
User: &flowcontrol.UserSubject{"goodu"}}},
ResourceRules: []flowcontrol.ResourcePolicyRule{{
Verbs: []string{"goodverb"},
APIGroups: []string{"goodapig"},
Resources: []string{"goodrscs"},
ClusterScope: false}}},
})
checkRules(t, true, reqN, []fcv1a1.PolicyRulesWithSubjects{{
Subjects: []fcv1a1.Subject{{Kind: fcv1a1.SubjectKindUser,
User: &fcv1a1.UserSubject{"goodu"}}},
NonResourceRules: []fcv1a1.NonResourcePolicyRule{{
checkRules(t, true, reqN, []flowcontrol.PolicyRulesWithSubjects{{
Subjects: []flowcontrol.Subject{{Kind: flowcontrol.SubjectKindUser,
User: &flowcontrol.UserSubject{"goodu"}}},
NonResourceRules: []flowcontrol.NonResourcePolicyRule{{
Verbs: []string{"goodverb"},
NonResourceURLs: []string{"/openapi/v2"}}}}, {
Subjects: []fcv1a1.Subject{{Kind: fcv1a1.SubjectKindUser,
User: &fcv1a1.UserSubject{"goodu"}}},
NonResourceRules: []fcv1a1.NonResourcePolicyRule{{
Subjects: []flowcontrol.Subject{{Kind: flowcontrol.SubjectKindUser,
User: &flowcontrol.UserSubject{"goodu"}}},
NonResourceRules: []flowcontrol.NonResourcePolicyRule{{
Verbs: []string{"*"},
NonResourceURLs: []string{"/openapi/v2"}}}}, {
Subjects: []fcv1a1.Subject{{Kind: fcv1a1.SubjectKindUser,
User: &fcv1a1.UserSubject{"goodu"}}},
NonResourceRules: []fcv1a1.NonResourcePolicyRule{{
Subjects: []flowcontrol.Subject{{Kind: flowcontrol.SubjectKindUser,
User: &flowcontrol.UserSubject{"goodu"}}},
NonResourceRules: []flowcontrol.NonResourcePolicyRule{{
Verbs: []string{"goodverb"},
NonResourceURLs: []string{"*"}}}},
})
checkRules(t, false, reqN, []fcv1a1.PolicyRulesWithSubjects{{
Subjects: []fcv1a1.Subject{{Kind: fcv1a1.SubjectKindUser,
User: &fcv1a1.UserSubject{"goodu"}}},
NonResourceRules: []fcv1a1.NonResourcePolicyRule{{
checkRules(t, false, reqN, []flowcontrol.PolicyRulesWithSubjects{{
Subjects: []flowcontrol.Subject{{Kind: flowcontrol.SubjectKindUser,
User: &flowcontrol.UserSubject{"goodu"}}},
NonResourceRules: []flowcontrol.NonResourcePolicyRule{{
Verbs: []string{"badverb"},
NonResourceURLs: []string{"/openapi/v2"}}}}, {
Subjects: []fcv1a1.Subject{{Kind: fcv1a1.SubjectKindUser,
User: &fcv1a1.UserSubject{"goodu"}}},
NonResourceRules: []fcv1a1.NonResourcePolicyRule{{
Subjects: []flowcontrol.Subject{{Kind: flowcontrol.SubjectKindUser,
User: &flowcontrol.UserSubject{"goodu"}}},
NonResourceRules: []flowcontrol.NonResourcePolicyRule{{
Verbs: []string{"goodverb"},
NonResourceURLs: []string{"/closedapi/v2"}}}},
})
}
func checkRules(t *testing.T, expectMatch bool, digest RequestDigest, rules []fcv1a1.PolicyRulesWithSubjects) {
func checkRules(t *testing.T, expectMatch bool, digest RequestDigest, rules []flowcontrol.PolicyRulesWithSubjects) {
for idx, rule := range rules {
fs := &fcv1a1.FlowSchema{
fs := &flowcontrol.FlowSchema{
ObjectMeta: metav1.ObjectMeta{Name: fmt.Sprintf("rule%d", idx)},
Spec: fcv1a1.FlowSchemaSpec{
Rules: []fcv1a1.PolicyRulesWithSubjects{rule}}}
Spec: flowcontrol.FlowSchemaSpec{
Rules: []flowcontrol.PolicyRulesWithSubjects{rule}}}
actualMatch := matchesFlowSchema(digest, fs)
if expectMatch != actualMatch {
t.Errorf("expectMatch=%v, actualMatch=%v, digest=%#+v, fs=%s", expectMatch, actualMatch, digest, fcfmt.Fmt(fs))

View File

@ -19,7 +19,7 @@ package flowcontrol
import (
"strings"
fctypesv1a1 "k8s.io/api/flowcontrol/v1alpha1"
flowcontrol "k8s.io/api/flowcontrol/v1beta1"
"k8s.io/apiserver/pkg/authentication/serviceaccount"
"k8s.io/apiserver/pkg/authentication/user"
"k8s.io/apiserver/pkg/endpoints/request"
@ -27,7 +27,7 @@ import (
// Tests whether a given request and FlowSchema match. Nobody mutates
// either input.
func matchesFlowSchema(digest RequestDigest, flowSchema *fctypesv1a1.FlowSchema) bool {
func matchesFlowSchema(digest RequestDigest, flowSchema *flowcontrol.FlowSchema) bool {
for _, policyRule := range flowSchema.Spec.Rules {
if matchesPolicyRule(digest, &policyRule) {
return true
@ -36,7 +36,7 @@ func matchesFlowSchema(digest RequestDigest, flowSchema *fctypesv1a1.FlowSchema)
return false
}
func matchesPolicyRule(digest RequestDigest, policyRule *fctypesv1a1.PolicyRulesWithSubjects) bool {
func matchesPolicyRule(digest RequestDigest, policyRule *flowcontrol.PolicyRulesWithSubjects) bool {
if !matchesASubject(digest.User, policyRule.Subjects) {
return false
}
@ -46,7 +46,7 @@ func matchesPolicyRule(digest RequestDigest, policyRule *fctypesv1a1.PolicyRules
return matchesANonResourceRule(digest.RequestInfo, policyRule.NonResourceRules)
}
func matchesASubject(user user.Info, subjects []fctypesv1a1.Subject) bool {
func matchesASubject(user user.Info, subjects []flowcontrol.Subject) bool {
for _, subject := range subjects {
if matchesSubject(user, subject) {
return true
@ -55,11 +55,11 @@ func matchesASubject(user user.Info, subjects []fctypesv1a1.Subject) bool {
return false
}
func matchesSubject(user user.Info, subject fctypesv1a1.Subject) bool {
func matchesSubject(user user.Info, subject flowcontrol.Subject) bool {
switch subject.Kind {
case fctypesv1a1.SubjectKindUser:
return subject.User != nil && (subject.User.Name == fctypesv1a1.NameAll || subject.User.Name == user.GetName())
case fctypesv1a1.SubjectKindGroup:
case flowcontrol.SubjectKindUser:
return subject.User != nil && (subject.User.Name == flowcontrol.NameAll || subject.User.Name == user.GetName())
case flowcontrol.SubjectKindGroup:
if subject.Group == nil {
return false
}
@ -73,11 +73,11 @@ func matchesSubject(user user.Info, subject fctypesv1a1.Subject) bool {
}
}
return false
case fctypesv1a1.SubjectKindServiceAccount:
case flowcontrol.SubjectKindServiceAccount:
if subject.ServiceAccount == nil {
return false
}
if subject.ServiceAccount.Name == fctypesv1a1.NameAll {
if subject.ServiceAccount.Name == flowcontrol.NameAll {
return serviceAccountMatchesNamespace(subject.ServiceAccount.Namespace, user.GetName())
}
return serviceaccount.MatchesUsername(subject.ServiceAccount.Namespace, subject.ServiceAccount.Name, user.GetName())
@ -107,7 +107,7 @@ func serviceAccountMatchesNamespace(namespace string, username string) bool {
return strings.HasPrefix(username, ServiceAccountUsernameSeparator)
}
func matchesAResourceRule(ri *request.RequestInfo, rules []fctypesv1a1.ResourcePolicyRule) bool {
func matchesAResourceRule(ri *request.RequestInfo, rules []flowcontrol.ResourcePolicyRule) bool {
for _, rr := range rules {
if matchesResourcePolicyRule(ri, rr) {
return true
@ -116,7 +116,7 @@ func matchesAResourceRule(ri *request.RequestInfo, rules []fctypesv1a1.ResourceP
return false
}
func matchesResourcePolicyRule(ri *request.RequestInfo, policyRule fctypesv1a1.ResourcePolicyRule) bool {
func matchesResourcePolicyRule(ri *request.RequestInfo, policyRule flowcontrol.ResourcePolicyRule) bool {
if !matchPolicyRuleVerb(policyRule.Verbs, ri.Verb) {
return false
}
@ -129,10 +129,10 @@ func matchesResourcePolicyRule(ri *request.RequestInfo, policyRule fctypesv1a1.R
if len(ri.Namespace) == 0 {
return policyRule.ClusterScope
}
return containsString(ri.Namespace, policyRule.Namespaces, fctypesv1a1.NamespaceEvery)
return containsString(ri.Namespace, policyRule.Namespaces, flowcontrol.NamespaceEvery)
}
func matchesANonResourceRule(ri *request.RequestInfo, rules []fctypesv1a1.NonResourcePolicyRule) bool {
func matchesANonResourceRule(ri *request.RequestInfo, rules []flowcontrol.NonResourcePolicyRule) bool {
for _, rr := range rules {
if matchesNonResourcePolicyRule(ri, rr) {
return true
@ -141,7 +141,7 @@ func matchesANonResourceRule(ri *request.RequestInfo, rules []fctypesv1a1.NonRes
return false
}
func matchesNonResourcePolicyRule(ri *request.RequestInfo, policyRule fctypesv1a1.NonResourcePolicyRule) bool {
func matchesNonResourcePolicyRule(ri *request.RequestInfo, policyRule flowcontrol.NonResourcePolicyRule) bool {
if !matchPolicyRuleVerb(policyRule.Verbs, ri.Verb) {
return false
}
@ -149,12 +149,12 @@ func matchesNonResourcePolicyRule(ri *request.RequestInfo, policyRule fctypesv1a
}
func matchPolicyRuleVerb(policyRuleVerbs []string, requestVerb string) bool {
return containsString(requestVerb, policyRuleVerbs, fctypesv1a1.VerbAll)
return containsString(requestVerb, policyRuleVerbs, flowcontrol.VerbAll)
}
func matchPolicyRuleNonResourceURL(policyRuleRequestURLs []string, requestPath string) bool {
for _, rulePath := range policyRuleRequestURLs {
if rulePath == fctypesv1a1.NonResourceAll || rulePath == requestPath {
if rulePath == flowcontrol.NonResourceAll || rulePath == requestPath {
return true
}
rulePrefix := strings.TrimSuffix(rulePath, "*")
@ -169,7 +169,7 @@ func matchPolicyRuleNonResourceURL(policyRuleRequestURLs []string, requestPath s
}
func matchPolicyRuleAPIGroup(policyRuleAPIGroups []string, requestAPIGroup string) bool {
return containsString(requestAPIGroup, policyRuleAPIGroups, fctypesv1a1.APIGroupAll)
return containsString(requestAPIGroup, policyRuleAPIGroups, flowcontrol.APIGroupAll)
}
func rsJoin(requestResource, requestSubresource string) string {
@ -181,7 +181,7 @@ func rsJoin(requestResource, requestSubresource string) string {
}
func matchPolicyRuleResource(policyRuleRequestResources []string, requestResource, requestSubresource string) bool {
return containsString(rsJoin(requestResource, requestSubresource), policyRuleRequestResources, fctypesv1a1.ResourceAll)
return containsString(rsJoin(requestResource, requestSubresource), policyRuleRequestResources, flowcontrol.ResourceAll)
}
// containsString returns true if either `x` or `wildcard` is in

View File

@ -48,6 +48,7 @@ filegroup(
"//staging/src/k8s.io/client-go/listers/events/v1beta1:all-srcs",
"//staging/src/k8s.io/client-go/listers/extensions/v1beta1:all-srcs",
"//staging/src/k8s.io/client-go/listers/flowcontrol/v1alpha1:all-srcs",
"//staging/src/k8s.io/client-go/listers/flowcontrol/v1beta1:all-srcs",
"//staging/src/k8s.io/client-go/listers/imagepolicy/v1alpha1:all-srcs",
"//staging/src/k8s.io/client-go/listers/networking/v1:all-srcs",
"//staging/src/k8s.io/client-go/listers/networking/v1beta1:all-srcs",

View File

@ -33,6 +33,7 @@ go_library(
"//staging/src/k8s.io/api/events/v1beta1:go_default_library",
"//staging/src/k8s.io/api/extensions/v1beta1:go_default_library",
"//staging/src/k8s.io/api/flowcontrol/v1alpha1:go_default_library",
"//staging/src/k8s.io/api/flowcontrol/v1beta1:go_default_library",
"//staging/src/k8s.io/api/networking/v1:go_default_library",
"//staging/src/k8s.io/api/networking/v1beta1:go_default_library",
"//staging/src/k8s.io/api/node/v1:go_default_library",

View File

@ -8,6 +8,7 @@ go_library(
visibility = ["//visibility:public"],
deps = [
"//staging/src/k8s.io/client-go/informers/flowcontrol/v1alpha1:go_default_library",
"//staging/src/k8s.io/client-go/informers/flowcontrol/v1beta1:go_default_library",
"//staging/src/k8s.io/client-go/informers/internalinterfaces:go_default_library",
],
)
@ -24,6 +25,7 @@ filegroup(
srcs = [
":package-srcs",
"//staging/src/k8s.io/client-go/informers/flowcontrol/v1alpha1:all-srcs",
"//staging/src/k8s.io/client-go/informers/flowcontrol/v1beta1:all-srcs",
],
tags = ["automanaged"],
visibility = ["//visibility:public"],

View File

@ -20,6 +20,7 @@ package flowcontrol
import (
v1alpha1 "k8s.io/client-go/informers/flowcontrol/v1alpha1"
v1beta1 "k8s.io/client-go/informers/flowcontrol/v1beta1"
internalinterfaces "k8s.io/client-go/informers/internalinterfaces"
)
@ -27,6 +28,8 @@ import (
type Interface interface {
// V1alpha1 provides access to shared informers for resources in V1alpha1.
V1alpha1() v1alpha1.Interface
// V1beta1 provides access to shared informers for resources in V1beta1.
V1beta1() v1beta1.Interface
}
type group struct {
@ -44,3 +47,8 @@ func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakList
func (g *group) V1alpha1() v1alpha1.Interface {
return v1alpha1.New(g.factory, g.namespace, g.tweakListOptions)
}
// V1beta1 returns a new v1beta1.Interface.
func (g *group) V1beta1() v1beta1.Interface {
return v1beta1.New(g.factory, g.namespace, g.tweakListOptions)
}

View File

@ -0,0 +1,37 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = [
"flowschema.go",
"interface.go",
"prioritylevelconfiguration.go",
],
importmap = "k8s.io/kubernetes/vendor/k8s.io/client-go/informers/flowcontrol/v1beta1",
importpath = "k8s.io/client-go/informers/flowcontrol/v1beta1",
visibility = ["//visibility:public"],
deps = [
"//staging/src/k8s.io/api/flowcontrol/v1beta1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/watch:go_default_library",
"//staging/src/k8s.io/client-go/informers/internalinterfaces:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes:go_default_library",
"//staging/src/k8s.io/client-go/listers/flowcontrol/v1beta1:go_default_library",
"//staging/src/k8s.io/client-go/tools/cache:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,89 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by informer-gen. DO NOT EDIT.
package v1beta1
import (
"context"
time "time"
flowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
internalinterfaces "k8s.io/client-go/informers/internalinterfaces"
kubernetes "k8s.io/client-go/kubernetes"
v1beta1 "k8s.io/client-go/listers/flowcontrol/v1beta1"
cache "k8s.io/client-go/tools/cache"
)
// FlowSchemaInformer provides access to a shared informer and lister for
// FlowSchemas.
type FlowSchemaInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1beta1.FlowSchemaLister
}
type flowSchemaInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
}
// NewFlowSchemaInformer constructs a new informer for FlowSchema type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredFlowSchemaInformer(client, resyncPeriod, indexers, nil)
}
// NewFilteredFlowSchemaInformer constructs a new informer for FlowSchema type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewFilteredFlowSchemaInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
return cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.FlowcontrolV1beta1().FlowSchemas().List(context.TODO(), options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.FlowcontrolV1beta1().FlowSchemas().Watch(context.TODO(), options)
},
},
&flowcontrolv1beta1.FlowSchema{},
resyncPeriod,
indexers,
)
}
func (f *flowSchemaInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredFlowSchemaInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *flowSchemaInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&flowcontrolv1beta1.FlowSchema{}, f.defaultInformer)
}
func (f *flowSchemaInformer) Lister() v1beta1.FlowSchemaLister {
return v1beta1.NewFlowSchemaLister(f.Informer().GetIndexer())
}

View File

@ -0,0 +1,52 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by informer-gen. DO NOT EDIT.
package v1beta1
import (
internalinterfaces "k8s.io/client-go/informers/internalinterfaces"
)
// Interface provides access to all the informers in this group version.
type Interface interface {
// FlowSchemas returns a FlowSchemaInformer.
FlowSchemas() FlowSchemaInformer
// PriorityLevelConfigurations returns a PriorityLevelConfigurationInformer.
PriorityLevelConfigurations() PriorityLevelConfigurationInformer
}
type version struct {
factory internalinterfaces.SharedInformerFactory
namespace string
tweakListOptions internalinterfaces.TweakListOptionsFunc
}
// New returns a new Interface.
func New(f internalinterfaces.SharedInformerFactory, namespace string, tweakListOptions internalinterfaces.TweakListOptionsFunc) Interface {
return &version{factory: f, namespace: namespace, tweakListOptions: tweakListOptions}
}
// FlowSchemas returns a FlowSchemaInformer.
func (v *version) FlowSchemas() FlowSchemaInformer {
return &flowSchemaInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
}
// PriorityLevelConfigurations returns a PriorityLevelConfigurationInformer.
func (v *version) PriorityLevelConfigurations() PriorityLevelConfigurationInformer {
return &priorityLevelConfigurationInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
}

View File

@ -0,0 +1,89 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by informer-gen. DO NOT EDIT.
package v1beta1
import (
"context"
time "time"
flowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
watch "k8s.io/apimachinery/pkg/watch"
internalinterfaces "k8s.io/client-go/informers/internalinterfaces"
kubernetes "k8s.io/client-go/kubernetes"
v1beta1 "k8s.io/client-go/listers/flowcontrol/v1beta1"
cache "k8s.io/client-go/tools/cache"
)
// PriorityLevelConfigurationInformer provides access to a shared informer and lister for
// PriorityLevelConfigurations.
type PriorityLevelConfigurationInformer interface {
Informer() cache.SharedIndexInformer
Lister() v1beta1.PriorityLevelConfigurationLister
}
type priorityLevelConfigurationInformer struct {
factory internalinterfaces.SharedInformerFactory
tweakListOptions internalinterfaces.TweakListOptionsFunc
}
// NewPriorityLevelConfigurationInformer constructs a new informer for PriorityLevelConfiguration type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
return NewFilteredPriorityLevelConfigurationInformer(client, resyncPeriod, indexers, nil)
}
// NewFilteredPriorityLevelConfigurationInformer constructs a new informer for PriorityLevelConfiguration type.
// Always prefer using an informer factory to get a shared informer instead of getting an independent
// one. This reduces memory footprint and number of connections to the server.
func NewFilteredPriorityLevelConfigurationInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
return cache.NewSharedIndexInformer(
&cache.ListWatch{
ListFunc: func(options v1.ListOptions) (runtime.Object, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.FlowcontrolV1beta1().PriorityLevelConfigurations().List(context.TODO(), options)
},
WatchFunc: func(options v1.ListOptions) (watch.Interface, error) {
if tweakListOptions != nil {
tweakListOptions(&options)
}
return client.FlowcontrolV1beta1().PriorityLevelConfigurations().Watch(context.TODO(), options)
},
},
&flowcontrolv1beta1.PriorityLevelConfiguration{},
resyncPeriod,
indexers,
)
}
func (f *priorityLevelConfigurationInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
return NewFilteredPriorityLevelConfigurationInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions)
}
func (f *priorityLevelConfigurationInformer) Informer() cache.SharedIndexInformer {
return f.factory.InformerFor(&flowcontrolv1beta1.PriorityLevelConfiguration{}, f.defaultInformer)
}
func (f *priorityLevelConfigurationInformer) Lister() v1beta1.PriorityLevelConfigurationLister {
return v1beta1.NewPriorityLevelConfigurationLister(f.Informer().GetIndexer())
}

View File

@ -44,6 +44,7 @@ import (
eventsv1beta1 "k8s.io/api/events/v1beta1"
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
flowcontrolv1alpha1 "k8s.io/api/flowcontrol/v1alpha1"
flowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1"
networkingv1 "k8s.io/api/networking/v1"
networkingv1beta1 "k8s.io/api/networking/v1beta1"
nodev1 "k8s.io/api/node/v1"
@ -243,6 +244,12 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
case flowcontrolv1alpha1.SchemeGroupVersion.WithResource("prioritylevelconfigurations"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Flowcontrol().V1alpha1().PriorityLevelConfigurations().Informer()}, nil
// Group=flowcontrol.apiserver.k8s.io, Version=v1beta1
case flowcontrolv1beta1.SchemeGroupVersion.WithResource("flowschemas"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Flowcontrol().V1beta1().FlowSchemas().Informer()}, nil
case flowcontrolv1beta1.SchemeGroupVersion.WithResource("prioritylevelconfigurations"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Flowcontrol().V1beta1().PriorityLevelConfigurations().Informer()}, nil
// Group=internal.apiserver.k8s.io, Version=v1alpha1
case apiserverinternalv1alpha1.SchemeGroupVersion.WithResource("storageversions"):
return &genericInformer{resource: resource.GroupResource(), informer: f.Internal().V1alpha1().StorageVersions().Informer()}, nil

View File

@ -39,6 +39,7 @@ go_library(
"//staging/src/k8s.io/client-go/kubernetes/typed/events/v1beta1:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes/typed/extensions/v1beta1:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes/typed/networking/v1:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes/typed/networking/v1beta1:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes/typed/node/v1:go_default_library",
@ -99,6 +100,7 @@ filegroup(
"//staging/src/k8s.io/client-go/kubernetes/typed/events/v1beta1:all-srcs",
"//staging/src/k8s.io/client-go/kubernetes/typed/extensions/v1beta1:all-srcs",
"//staging/src/k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1:all-srcs",
"//staging/src/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1:all-srcs",
"//staging/src/k8s.io/client-go/kubernetes/typed/networking/v1:all-srcs",
"//staging/src/k8s.io/client-go/kubernetes/typed/networking/v1beta1:all-srcs",
"//staging/src/k8s.io/client-go/kubernetes/typed/node/v1:all-srcs",

View File

@ -49,6 +49,7 @@ import (
eventsv1beta1 "k8s.io/client-go/kubernetes/typed/events/v1beta1"
extensionsv1beta1 "k8s.io/client-go/kubernetes/typed/extensions/v1beta1"
flowcontrolv1alpha1 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1"
flowcontrolv1beta1 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1"
networkingv1 "k8s.io/client-go/kubernetes/typed/networking/v1"
networkingv1beta1 "k8s.io/client-go/kubernetes/typed/networking/v1beta1"
nodev1 "k8s.io/client-go/kubernetes/typed/node/v1"
@ -97,6 +98,7 @@ type Interface interface {
EventsV1beta1() eventsv1beta1.EventsV1beta1Interface
ExtensionsV1beta1() extensionsv1beta1.ExtensionsV1beta1Interface
FlowcontrolV1alpha1() flowcontrolv1alpha1.FlowcontrolV1alpha1Interface
FlowcontrolV1beta1() flowcontrolv1beta1.FlowcontrolV1beta1Interface
NetworkingV1() networkingv1.NetworkingV1Interface
NetworkingV1beta1() networkingv1beta1.NetworkingV1beta1Interface
NodeV1() nodev1.NodeV1Interface
@ -145,6 +147,7 @@ type Clientset struct {
eventsV1beta1 *eventsv1beta1.EventsV1beta1Client
extensionsV1beta1 *extensionsv1beta1.ExtensionsV1beta1Client
flowcontrolV1alpha1 *flowcontrolv1alpha1.FlowcontrolV1alpha1Client
flowcontrolV1beta1 *flowcontrolv1beta1.FlowcontrolV1beta1Client
networkingV1 *networkingv1.NetworkingV1Client
networkingV1beta1 *networkingv1beta1.NetworkingV1beta1Client
nodeV1 *nodev1.NodeV1Client
@ -297,6 +300,11 @@ func (c *Clientset) FlowcontrolV1alpha1() flowcontrolv1alpha1.FlowcontrolV1alpha
return c.flowcontrolV1alpha1
}
// FlowcontrolV1beta1 retrieves the FlowcontrolV1beta1Client
func (c *Clientset) FlowcontrolV1beta1() flowcontrolv1beta1.FlowcontrolV1beta1Interface {
return c.flowcontrolV1beta1
}
// NetworkingV1 retrieves the NetworkingV1Client
func (c *Clientset) NetworkingV1() networkingv1.NetworkingV1Interface {
return c.networkingV1
@ -501,6 +509,10 @@ func NewForConfig(c *rest.Config) (*Clientset, error) {
if err != nil {
return nil, err
}
cs.flowcontrolV1beta1, err = flowcontrolv1beta1.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
}
cs.networkingV1, err = networkingv1.NewForConfig(&configShallowCopy)
if err != nil {
return nil, err
@ -600,6 +612,7 @@ func NewForConfigOrDie(c *rest.Config) *Clientset {
cs.eventsV1beta1 = eventsv1beta1.NewForConfigOrDie(c)
cs.extensionsV1beta1 = extensionsv1beta1.NewForConfigOrDie(c)
cs.flowcontrolV1alpha1 = flowcontrolv1alpha1.NewForConfigOrDie(c)
cs.flowcontrolV1beta1 = flowcontrolv1beta1.NewForConfigOrDie(c)
cs.networkingV1 = networkingv1.NewForConfigOrDie(c)
cs.networkingV1beta1 = networkingv1beta1.NewForConfigOrDie(c)
cs.nodeV1 = nodev1.NewForConfigOrDie(c)
@ -650,6 +663,7 @@ func New(c rest.Interface) *Clientset {
cs.eventsV1beta1 = eventsv1beta1.New(c)
cs.extensionsV1beta1 = extensionsv1beta1.New(c)
cs.flowcontrolV1alpha1 = flowcontrolv1alpha1.New(c)
cs.flowcontrolV1beta1 = flowcontrolv1beta1.New(c)
cs.networkingV1 = networkingv1.New(c)
cs.networkingV1beta1 = networkingv1beta1.New(c)
cs.nodeV1 = nodev1.New(c)

View File

@ -38,6 +38,7 @@ go_library(
"//staging/src/k8s.io/api/events/v1beta1:go_default_library",
"//staging/src/k8s.io/api/extensions/v1beta1:go_default_library",
"//staging/src/k8s.io/api/flowcontrol/v1alpha1:go_default_library",
"//staging/src/k8s.io/api/flowcontrol/v1beta1:go_default_library",
"//staging/src/k8s.io/api/networking/v1:go_default_library",
"//staging/src/k8s.io/api/networking/v1beta1:go_default_library",
"//staging/src/k8s.io/api/node/v1:go_default_library",
@ -116,6 +117,8 @@ go_library(
"//staging/src/k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1/fake:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1/fake:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes/typed/networking/v1:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes/typed/networking/v1/fake:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes/typed/networking/v1beta1:go_default_library",

View File

@ -78,6 +78,8 @@ import (
fakeextensionsv1beta1 "k8s.io/client-go/kubernetes/typed/extensions/v1beta1/fake"
flowcontrolv1alpha1 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1"
fakeflowcontrolv1alpha1 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1alpha1/fake"
flowcontrolv1beta1 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1"
fakeflowcontrolv1beta1 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1/fake"
networkingv1 "k8s.io/client-go/kubernetes/typed/networking/v1"
fakenetworkingv1 "k8s.io/client-go/kubernetes/typed/networking/v1/fake"
networkingv1beta1 "k8s.io/client-go/kubernetes/typed/networking/v1beta1"
@ -293,6 +295,11 @@ func (c *Clientset) FlowcontrolV1alpha1() flowcontrolv1alpha1.FlowcontrolV1alpha
return &fakeflowcontrolv1alpha1.FakeFlowcontrolV1alpha1{Fake: &c.Fake}
}
// FlowcontrolV1beta1 retrieves the FlowcontrolV1beta1Client
func (c *Clientset) FlowcontrolV1beta1() flowcontrolv1beta1.FlowcontrolV1beta1Interface {
return &fakeflowcontrolv1beta1.FakeFlowcontrolV1beta1{Fake: &c.Fake}
}
// NetworkingV1 retrieves the NetworkingV1Client
func (c *Clientset) NetworkingV1() networkingv1.NetworkingV1Interface {
return &fakenetworkingv1.FakeNetworkingV1{Fake: &c.Fake}

View File

@ -46,6 +46,7 @@ import (
eventsv1beta1 "k8s.io/api/events/v1beta1"
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
flowcontrolv1alpha1 "k8s.io/api/flowcontrol/v1alpha1"
flowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1"
networkingv1 "k8s.io/api/networking/v1"
networkingv1beta1 "k8s.io/api/networking/v1beta1"
nodev1 "k8s.io/api/node/v1"
@ -99,6 +100,7 @@ var localSchemeBuilder = runtime.SchemeBuilder{
eventsv1beta1.AddToScheme,
extensionsv1beta1.AddToScheme,
flowcontrolv1alpha1.AddToScheme,
flowcontrolv1beta1.AddToScheme,
networkingv1.AddToScheme,
networkingv1beta1.AddToScheme,
nodev1.AddToScheme,

View File

@ -37,6 +37,7 @@ go_library(
"//staging/src/k8s.io/api/events/v1beta1:go_default_library",
"//staging/src/k8s.io/api/extensions/v1beta1:go_default_library",
"//staging/src/k8s.io/api/flowcontrol/v1alpha1:go_default_library",
"//staging/src/k8s.io/api/flowcontrol/v1beta1:go_default_library",
"//staging/src/k8s.io/api/networking/v1:go_default_library",
"//staging/src/k8s.io/api/networking/v1beta1:go_default_library",
"//staging/src/k8s.io/api/node/v1:go_default_library",

View File

@ -46,6 +46,7 @@ import (
eventsv1beta1 "k8s.io/api/events/v1beta1"
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
flowcontrolv1alpha1 "k8s.io/api/flowcontrol/v1alpha1"
flowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1"
networkingv1 "k8s.io/api/networking/v1"
networkingv1beta1 "k8s.io/api/networking/v1beta1"
nodev1 "k8s.io/api/node/v1"
@ -99,6 +100,7 @@ var localSchemeBuilder = runtime.SchemeBuilder{
eventsv1beta1.AddToScheme,
extensionsv1beta1.AddToScheme,
flowcontrolv1alpha1.AddToScheme,
flowcontrolv1beta1.AddToScheme,
networkingv1.AddToScheme,
networkingv1beta1.AddToScheme,
nodev1.AddToScheme,

View File

@ -0,0 +1,40 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = [
"doc.go",
"flowcontrol_client.go",
"flowschema.go",
"generated_expansion.go",
"prioritylevelconfiguration.go",
],
importmap = "k8s.io/kubernetes/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1",
importpath = "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1",
visibility = ["//visibility:public"],
deps = [
"//staging/src/k8s.io/api/flowcontrol/v1beta1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/types:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/watch:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes/scheme:go_default_library",
"//staging/src/k8s.io/client-go/rest:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [
":package-srcs",
"//staging/src/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1/fake:all-srcs",
],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,20 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
// This package has the automatically generated typed clients.
package v1beta1

View File

@ -0,0 +1,39 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = [
"doc.go",
"fake_flowcontrol_client.go",
"fake_flowschema.go",
"fake_prioritylevelconfiguration.go",
],
importmap = "k8s.io/kubernetes/vendor/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1/fake",
importpath = "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1/fake",
visibility = ["//visibility:public"],
deps = [
"//staging/src/k8s.io/api/flowcontrol/v1beta1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/labels:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/types:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/watch:go_default_library",
"//staging/src/k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1:go_default_library",
"//staging/src/k8s.io/client-go/rest:go_default_library",
"//staging/src/k8s.io/client-go/testing:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,20 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
// Package fake has the automatically generated clients.
package fake

View File

@ -0,0 +1,44 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
v1beta1 "k8s.io/client-go/kubernetes/typed/flowcontrol/v1beta1"
rest "k8s.io/client-go/rest"
testing "k8s.io/client-go/testing"
)
type FakeFlowcontrolV1beta1 struct {
*testing.Fake
}
func (c *FakeFlowcontrolV1beta1) FlowSchemas() v1beta1.FlowSchemaInterface {
return &FakeFlowSchemas{c}
}
func (c *FakeFlowcontrolV1beta1) PriorityLevelConfigurations() v1beta1.PriorityLevelConfigurationInterface {
return &FakePriorityLevelConfigurations{c}
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FakeFlowcontrolV1beta1) RESTClient() rest.Interface {
var ret *rest.RESTClient
return ret
}

View File

@ -0,0 +1,133 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
v1beta1 "k8s.io/api/flowcontrol/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
)
// FakeFlowSchemas implements FlowSchemaInterface
type FakeFlowSchemas struct {
Fake *FakeFlowcontrolV1beta1
}
var flowschemasResource = schema.GroupVersionResource{Group: "flowcontrol.apiserver.k8s.io", Version: "v1beta1", Resource: "flowschemas"}
var flowschemasKind = schema.GroupVersionKind{Group: "flowcontrol.apiserver.k8s.io", Version: "v1beta1", Kind: "FlowSchema"}
// Get takes name of the flowSchema, and returns the corresponding flowSchema object, and an error if there is any.
func (c *FakeFlowSchemas) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.FlowSchema, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootGetAction(flowschemasResource, name), &v1beta1.FlowSchema{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.FlowSchema), err
}
// List takes label and field selectors, and returns the list of FlowSchemas that match those selectors.
func (c *FakeFlowSchemas) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.FlowSchemaList, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootListAction(flowschemasResource, flowschemasKind, opts), &v1beta1.FlowSchemaList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta1.FlowSchemaList{ListMeta: obj.(*v1beta1.FlowSchemaList).ListMeta}
for _, item := range obj.(*v1beta1.FlowSchemaList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested flowSchemas.
func (c *FakeFlowSchemas) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchAction(flowschemasResource, opts))
}
// Create takes the representation of a flowSchema and creates it. Returns the server's representation of the flowSchema, and an error, if there is any.
func (c *FakeFlowSchemas) Create(ctx context.Context, flowSchema *v1beta1.FlowSchema, opts v1.CreateOptions) (result *v1beta1.FlowSchema, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootCreateAction(flowschemasResource, flowSchema), &v1beta1.FlowSchema{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.FlowSchema), err
}
// Update takes the representation of a flowSchema and updates it. Returns the server's representation of the flowSchema, and an error, if there is any.
func (c *FakeFlowSchemas) Update(ctx context.Context, flowSchema *v1beta1.FlowSchema, opts v1.UpdateOptions) (result *v1beta1.FlowSchema, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootUpdateAction(flowschemasResource, flowSchema), &v1beta1.FlowSchema{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.FlowSchema), err
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakeFlowSchemas) UpdateStatus(ctx context.Context, flowSchema *v1beta1.FlowSchema, opts v1.UpdateOptions) (*v1beta1.FlowSchema, error) {
obj, err := c.Fake.
Invokes(testing.NewRootUpdateSubresourceAction(flowschemasResource, "status", flowSchema), &v1beta1.FlowSchema{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.FlowSchema), err
}
// Delete takes name of the flowSchema and deletes it. Returns an error if one occurs.
func (c *FakeFlowSchemas) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteAction(flowschemasResource, name), &v1beta1.FlowSchema{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakeFlowSchemas) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewRootDeleteCollectionAction(flowschemasResource, listOpts)
_, err := c.Fake.Invokes(action, &v1beta1.FlowSchemaList{})
return err
}
// Patch applies the patch and returns the patched flowSchema.
func (c *FakeFlowSchemas) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.FlowSchema, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceAction(flowschemasResource, name, pt, data, subresources...), &v1beta1.FlowSchema{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.FlowSchema), err
}

View File

@ -0,0 +1,133 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package fake
import (
"context"
v1beta1 "k8s.io/api/flowcontrol/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
labels "k8s.io/apimachinery/pkg/labels"
schema "k8s.io/apimachinery/pkg/runtime/schema"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
testing "k8s.io/client-go/testing"
)
// FakePriorityLevelConfigurations implements PriorityLevelConfigurationInterface
type FakePriorityLevelConfigurations struct {
Fake *FakeFlowcontrolV1beta1
}
var prioritylevelconfigurationsResource = schema.GroupVersionResource{Group: "flowcontrol.apiserver.k8s.io", Version: "v1beta1", Resource: "prioritylevelconfigurations"}
var prioritylevelconfigurationsKind = schema.GroupVersionKind{Group: "flowcontrol.apiserver.k8s.io", Version: "v1beta1", Kind: "PriorityLevelConfiguration"}
// Get takes name of the priorityLevelConfiguration, and returns the corresponding priorityLevelConfiguration object, and an error if there is any.
func (c *FakePriorityLevelConfigurations) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.PriorityLevelConfiguration, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootGetAction(prioritylevelconfigurationsResource, name), &v1beta1.PriorityLevelConfiguration{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.PriorityLevelConfiguration), err
}
// List takes label and field selectors, and returns the list of PriorityLevelConfigurations that match those selectors.
func (c *FakePriorityLevelConfigurations) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.PriorityLevelConfigurationList, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootListAction(prioritylevelconfigurationsResource, prioritylevelconfigurationsKind, opts), &v1beta1.PriorityLevelConfigurationList{})
if obj == nil {
return nil, err
}
label, _, _ := testing.ExtractFromListOptions(opts)
if label == nil {
label = labels.Everything()
}
list := &v1beta1.PriorityLevelConfigurationList{ListMeta: obj.(*v1beta1.PriorityLevelConfigurationList).ListMeta}
for _, item := range obj.(*v1beta1.PriorityLevelConfigurationList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
}
// Watch returns a watch.Interface that watches the requested priorityLevelConfigurations.
func (c *FakePriorityLevelConfigurations) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
return c.Fake.
InvokesWatch(testing.NewRootWatchAction(prioritylevelconfigurationsResource, opts))
}
// Create takes the representation of a priorityLevelConfiguration and creates it. Returns the server's representation of the priorityLevelConfiguration, and an error, if there is any.
func (c *FakePriorityLevelConfigurations) Create(ctx context.Context, priorityLevelConfiguration *v1beta1.PriorityLevelConfiguration, opts v1.CreateOptions) (result *v1beta1.PriorityLevelConfiguration, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootCreateAction(prioritylevelconfigurationsResource, priorityLevelConfiguration), &v1beta1.PriorityLevelConfiguration{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.PriorityLevelConfiguration), err
}
// Update takes the representation of a priorityLevelConfiguration and updates it. Returns the server's representation of the priorityLevelConfiguration, and an error, if there is any.
func (c *FakePriorityLevelConfigurations) Update(ctx context.Context, priorityLevelConfiguration *v1beta1.PriorityLevelConfiguration, opts v1.UpdateOptions) (result *v1beta1.PriorityLevelConfiguration, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootUpdateAction(prioritylevelconfigurationsResource, priorityLevelConfiguration), &v1beta1.PriorityLevelConfiguration{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.PriorityLevelConfiguration), err
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *FakePriorityLevelConfigurations) UpdateStatus(ctx context.Context, priorityLevelConfiguration *v1beta1.PriorityLevelConfiguration, opts v1.UpdateOptions) (*v1beta1.PriorityLevelConfiguration, error) {
obj, err := c.Fake.
Invokes(testing.NewRootUpdateSubresourceAction(prioritylevelconfigurationsResource, "status", priorityLevelConfiguration), &v1beta1.PriorityLevelConfiguration{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.PriorityLevelConfiguration), err
}
// Delete takes name of the priorityLevelConfiguration and deletes it. Returns an error if one occurs.
func (c *FakePriorityLevelConfigurations) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
_, err := c.Fake.
Invokes(testing.NewRootDeleteAction(prioritylevelconfigurationsResource, name), &v1beta1.PriorityLevelConfiguration{})
return err
}
// DeleteCollection deletes a collection of objects.
func (c *FakePriorityLevelConfigurations) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
action := testing.NewRootDeleteCollectionAction(prioritylevelconfigurationsResource, listOpts)
_, err := c.Fake.Invokes(action, &v1beta1.PriorityLevelConfigurationList{})
return err
}
// Patch applies the patch and returns the patched priorityLevelConfiguration.
func (c *FakePriorityLevelConfigurations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.PriorityLevelConfiguration, err error) {
obj, err := c.Fake.
Invokes(testing.NewRootPatchSubresourceAction(prioritylevelconfigurationsResource, name, pt, data, subresources...), &v1beta1.PriorityLevelConfiguration{})
if obj == nil {
return nil, err
}
return obj.(*v1beta1.PriorityLevelConfiguration), err
}

View File

@ -0,0 +1,94 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1beta1
import (
v1beta1 "k8s.io/api/flowcontrol/v1beta1"
"k8s.io/client-go/kubernetes/scheme"
rest "k8s.io/client-go/rest"
)
type FlowcontrolV1beta1Interface interface {
RESTClient() rest.Interface
FlowSchemasGetter
PriorityLevelConfigurationsGetter
}
// FlowcontrolV1beta1Client is used to interact with features provided by the flowcontrol.apiserver.k8s.io group.
type FlowcontrolV1beta1Client struct {
restClient rest.Interface
}
func (c *FlowcontrolV1beta1Client) FlowSchemas() FlowSchemaInterface {
return newFlowSchemas(c)
}
func (c *FlowcontrolV1beta1Client) PriorityLevelConfigurations() PriorityLevelConfigurationInterface {
return newPriorityLevelConfigurations(c)
}
// NewForConfig creates a new FlowcontrolV1beta1Client for the given config.
func NewForConfig(c *rest.Config) (*FlowcontrolV1beta1Client, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := rest.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &FlowcontrolV1beta1Client{client}, nil
}
// NewForConfigOrDie creates a new FlowcontrolV1beta1Client for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *FlowcontrolV1beta1Client {
client, err := NewForConfig(c)
if err != nil {
panic(err)
}
return client
}
// New creates a new FlowcontrolV1beta1Client for the given RESTClient.
func New(c rest.Interface) *FlowcontrolV1beta1Client {
return &FlowcontrolV1beta1Client{c}
}
func setConfigDefaults(config *rest.Config) error {
gv := v1beta1.SchemeGroupVersion
config.GroupVersion = &gv
config.APIPath = "/apis"
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
if config.UserAgent == "" {
config.UserAgent = rest.DefaultKubernetesUserAgent()
}
return nil
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *FlowcontrolV1beta1Client) RESTClient() rest.Interface {
if c == nil {
return nil
}
return c.restClient
}

View File

@ -0,0 +1,184 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1beta1
import (
"context"
"time"
v1beta1 "k8s.io/api/flowcontrol/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
scheme "k8s.io/client-go/kubernetes/scheme"
rest "k8s.io/client-go/rest"
)
// FlowSchemasGetter has a method to return a FlowSchemaInterface.
// A group's client should implement this interface.
type FlowSchemasGetter interface {
FlowSchemas() FlowSchemaInterface
}
// FlowSchemaInterface has methods to work with FlowSchema resources.
type FlowSchemaInterface interface {
Create(ctx context.Context, flowSchema *v1beta1.FlowSchema, opts v1.CreateOptions) (*v1beta1.FlowSchema, error)
Update(ctx context.Context, flowSchema *v1beta1.FlowSchema, opts v1.UpdateOptions) (*v1beta1.FlowSchema, error)
UpdateStatus(ctx context.Context, flowSchema *v1beta1.FlowSchema, opts v1.UpdateOptions) (*v1beta1.FlowSchema, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.FlowSchema, error)
List(ctx context.Context, opts v1.ListOptions) (*v1beta1.FlowSchemaList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.FlowSchema, err error)
FlowSchemaExpansion
}
// flowSchemas implements FlowSchemaInterface
type flowSchemas struct {
client rest.Interface
}
// newFlowSchemas returns a FlowSchemas
func newFlowSchemas(c *FlowcontrolV1beta1Client) *flowSchemas {
return &flowSchemas{
client: c.RESTClient(),
}
}
// Get takes name of the flowSchema, and returns the corresponding flowSchema object, and an error if there is any.
func (c *flowSchemas) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.FlowSchema, err error) {
result = &v1beta1.FlowSchema{}
err = c.client.Get().
Resource("flowschemas").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of FlowSchemas that match those selectors.
func (c *flowSchemas) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.FlowSchemaList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1beta1.FlowSchemaList{}
err = c.client.Get().
Resource("flowschemas").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested flowSchemas.
func (c *flowSchemas) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Resource("flowschemas").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a flowSchema and creates it. Returns the server's representation of the flowSchema, and an error, if there is any.
func (c *flowSchemas) Create(ctx context.Context, flowSchema *v1beta1.FlowSchema, opts v1.CreateOptions) (result *v1beta1.FlowSchema, err error) {
result = &v1beta1.FlowSchema{}
err = c.client.Post().
Resource("flowschemas").
VersionedParams(&opts, scheme.ParameterCodec).
Body(flowSchema).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a flowSchema and updates it. Returns the server's representation of the flowSchema, and an error, if there is any.
func (c *flowSchemas) Update(ctx context.Context, flowSchema *v1beta1.FlowSchema, opts v1.UpdateOptions) (result *v1beta1.FlowSchema, err error) {
result = &v1beta1.FlowSchema{}
err = c.client.Put().
Resource("flowschemas").
Name(flowSchema.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(flowSchema).
Do(ctx).
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *flowSchemas) UpdateStatus(ctx context.Context, flowSchema *v1beta1.FlowSchema, opts v1.UpdateOptions) (result *v1beta1.FlowSchema, err error) {
result = &v1beta1.FlowSchema{}
err = c.client.Put().
Resource("flowschemas").
Name(flowSchema.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(flowSchema).
Do(ctx).
Into(result)
return
}
// Delete takes name of the flowSchema and deletes it. Returns an error if one occurs.
func (c *flowSchemas) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Resource("flowschemas").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *flowSchemas) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Resource("flowschemas").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched flowSchema.
func (c *flowSchemas) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.FlowSchema, err error) {
result = &v1beta1.FlowSchema{}
err = c.client.Patch(pt).
Resource("flowschemas").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}

View File

@ -0,0 +1,23 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1beta1
type FlowSchemaExpansion interface{}
type PriorityLevelConfigurationExpansion interface{}

View File

@ -0,0 +1,184 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by client-gen. DO NOT EDIT.
package v1beta1
import (
"context"
"time"
v1beta1 "k8s.io/api/flowcontrol/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
scheme "k8s.io/client-go/kubernetes/scheme"
rest "k8s.io/client-go/rest"
)
// PriorityLevelConfigurationsGetter has a method to return a PriorityLevelConfigurationInterface.
// A group's client should implement this interface.
type PriorityLevelConfigurationsGetter interface {
PriorityLevelConfigurations() PriorityLevelConfigurationInterface
}
// PriorityLevelConfigurationInterface has methods to work with PriorityLevelConfiguration resources.
type PriorityLevelConfigurationInterface interface {
Create(ctx context.Context, priorityLevelConfiguration *v1beta1.PriorityLevelConfiguration, opts v1.CreateOptions) (*v1beta1.PriorityLevelConfiguration, error)
Update(ctx context.Context, priorityLevelConfiguration *v1beta1.PriorityLevelConfiguration, opts v1.UpdateOptions) (*v1beta1.PriorityLevelConfiguration, error)
UpdateStatus(ctx context.Context, priorityLevelConfiguration *v1beta1.PriorityLevelConfiguration, opts v1.UpdateOptions) (*v1beta1.PriorityLevelConfiguration, error)
Delete(ctx context.Context, name string, opts v1.DeleteOptions) error
DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error
Get(ctx context.Context, name string, opts v1.GetOptions) (*v1beta1.PriorityLevelConfiguration, error)
List(ctx context.Context, opts v1.ListOptions) (*v1beta1.PriorityLevelConfigurationList, error)
Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error)
Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.PriorityLevelConfiguration, err error)
PriorityLevelConfigurationExpansion
}
// priorityLevelConfigurations implements PriorityLevelConfigurationInterface
type priorityLevelConfigurations struct {
client rest.Interface
}
// newPriorityLevelConfigurations returns a PriorityLevelConfigurations
func newPriorityLevelConfigurations(c *FlowcontrolV1beta1Client) *priorityLevelConfigurations {
return &priorityLevelConfigurations{
client: c.RESTClient(),
}
}
// Get takes name of the priorityLevelConfiguration, and returns the corresponding priorityLevelConfiguration object, and an error if there is any.
func (c *priorityLevelConfigurations) Get(ctx context.Context, name string, options v1.GetOptions) (result *v1beta1.PriorityLevelConfiguration, err error) {
result = &v1beta1.PriorityLevelConfiguration{}
err = c.client.Get().
Resource("prioritylevelconfigurations").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do(ctx).
Into(result)
return
}
// List takes label and field selectors, and returns the list of PriorityLevelConfigurations that match those selectors.
func (c *priorityLevelConfigurations) List(ctx context.Context, opts v1.ListOptions) (result *v1beta1.PriorityLevelConfigurationList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1beta1.PriorityLevelConfigurationList{}
err = c.client.Get().
Resource("prioritylevelconfigurations").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do(ctx).
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested priorityLevelConfigurations.
func (c *priorityLevelConfigurations) Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Resource("prioritylevelconfigurations").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch(ctx)
}
// Create takes the representation of a priorityLevelConfiguration and creates it. Returns the server's representation of the priorityLevelConfiguration, and an error, if there is any.
func (c *priorityLevelConfigurations) Create(ctx context.Context, priorityLevelConfiguration *v1beta1.PriorityLevelConfiguration, opts v1.CreateOptions) (result *v1beta1.PriorityLevelConfiguration, err error) {
result = &v1beta1.PriorityLevelConfiguration{}
err = c.client.Post().
Resource("prioritylevelconfigurations").
VersionedParams(&opts, scheme.ParameterCodec).
Body(priorityLevelConfiguration).
Do(ctx).
Into(result)
return
}
// Update takes the representation of a priorityLevelConfiguration and updates it. Returns the server's representation of the priorityLevelConfiguration, and an error, if there is any.
func (c *priorityLevelConfigurations) Update(ctx context.Context, priorityLevelConfiguration *v1beta1.PriorityLevelConfiguration, opts v1.UpdateOptions) (result *v1beta1.PriorityLevelConfiguration, err error) {
result = &v1beta1.PriorityLevelConfiguration{}
err = c.client.Put().
Resource("prioritylevelconfigurations").
Name(priorityLevelConfiguration.Name).
VersionedParams(&opts, scheme.ParameterCodec).
Body(priorityLevelConfiguration).
Do(ctx).
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *priorityLevelConfigurations) UpdateStatus(ctx context.Context, priorityLevelConfiguration *v1beta1.PriorityLevelConfiguration, opts v1.UpdateOptions) (result *v1beta1.PriorityLevelConfiguration, err error) {
result = &v1beta1.PriorityLevelConfiguration{}
err = c.client.Put().
Resource("prioritylevelconfigurations").
Name(priorityLevelConfiguration.Name).
SubResource("status").
VersionedParams(&opts, scheme.ParameterCodec).
Body(priorityLevelConfiguration).
Do(ctx).
Into(result)
return
}
// Delete takes name of the priorityLevelConfiguration and deletes it. Returns an error if one occurs.
func (c *priorityLevelConfigurations) Delete(ctx context.Context, name string, opts v1.DeleteOptions) error {
return c.client.Delete().
Resource("prioritylevelconfigurations").
Name(name).
Body(&opts).
Do(ctx).
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *priorityLevelConfigurations) DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error {
var timeout time.Duration
if listOpts.TimeoutSeconds != nil {
timeout = time.Duration(*listOpts.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Resource("prioritylevelconfigurations").
VersionedParams(&listOpts, scheme.ParameterCodec).
Timeout(timeout).
Body(&opts).
Do(ctx).
Error()
}
// Patch applies the patch and returns the patched priorityLevelConfiguration.
func (c *priorityLevelConfigurations) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *v1beta1.PriorityLevelConfiguration, err error) {
result = &v1beta1.PriorityLevelConfiguration{}
err = c.client.Patch(pt).
Resource("prioritylevelconfigurations").
Name(name).
SubResource(subresources...).
VersionedParams(&opts, scheme.ParameterCodec).
Body(data).
Do(ctx).
Into(result)
return
}

View File

@ -0,0 +1,33 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = [
"expansion_generated.go",
"flowschema.go",
"prioritylevelconfiguration.go",
],
importmap = "k8s.io/kubernetes/vendor/k8s.io/client-go/listers/flowcontrol/v1beta1",
importpath = "k8s.io/client-go/listers/flowcontrol/v1beta1",
visibility = ["//visibility:public"],
deps = [
"//staging/src/k8s.io/api/flowcontrol/v1beta1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/api/errors:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/labels:go_default_library",
"//staging/src/k8s.io/client-go/tools/cache:go_default_library",
],
)
filegroup(
name = "package-srcs",
srcs = glob(["**"]),
tags = ["automanaged"],
visibility = ["//visibility:private"],
)
filegroup(
name = "all-srcs",
srcs = [":package-srcs"],
tags = ["automanaged"],
visibility = ["//visibility:public"],
)

View File

@ -0,0 +1,27 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by lister-gen. DO NOT EDIT.
package v1beta1
// FlowSchemaListerExpansion allows custom methods to be added to
// FlowSchemaLister.
type FlowSchemaListerExpansion interface{}
// PriorityLevelConfigurationListerExpansion allows custom methods to be added to
// PriorityLevelConfigurationLister.
type PriorityLevelConfigurationListerExpansion interface{}

View File

@ -0,0 +1,68 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by lister-gen. DO NOT EDIT.
package v1beta1
import (
v1beta1 "k8s.io/api/flowcontrol/v1beta1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
)
// FlowSchemaLister helps list FlowSchemas.
// All objects returned here must be treated as read-only.
type FlowSchemaLister interface {
// List lists all FlowSchemas in the indexer.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1beta1.FlowSchema, err error)
// Get retrieves the FlowSchema from the index for a given name.
// Objects returned here must be treated as read-only.
Get(name string) (*v1beta1.FlowSchema, error)
FlowSchemaListerExpansion
}
// flowSchemaLister implements the FlowSchemaLister interface.
type flowSchemaLister struct {
indexer cache.Indexer
}
// NewFlowSchemaLister returns a new FlowSchemaLister.
func NewFlowSchemaLister(indexer cache.Indexer) FlowSchemaLister {
return &flowSchemaLister{indexer: indexer}
}
// List lists all FlowSchemas in the indexer.
func (s *flowSchemaLister) List(selector labels.Selector) (ret []*v1beta1.FlowSchema, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1beta1.FlowSchema))
})
return ret, err
}
// Get retrieves the FlowSchema from the index for a given name.
func (s *flowSchemaLister) Get(name string) (*v1beta1.FlowSchema, error) {
obj, exists, err := s.indexer.GetByKey(name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1beta1.Resource("flowschema"), name)
}
return obj.(*v1beta1.FlowSchema), nil
}

View File

@ -0,0 +1,68 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by lister-gen. DO NOT EDIT.
package v1beta1
import (
v1beta1 "k8s.io/api/flowcontrol/v1beta1"
"k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/client-go/tools/cache"
)
// PriorityLevelConfigurationLister helps list PriorityLevelConfigurations.
// All objects returned here must be treated as read-only.
type PriorityLevelConfigurationLister interface {
// List lists all PriorityLevelConfigurations in the indexer.
// Objects returned here must be treated as read-only.
List(selector labels.Selector) (ret []*v1beta1.PriorityLevelConfiguration, err error)
// Get retrieves the PriorityLevelConfiguration from the index for a given name.
// Objects returned here must be treated as read-only.
Get(name string) (*v1beta1.PriorityLevelConfiguration, error)
PriorityLevelConfigurationListerExpansion
}
// priorityLevelConfigurationLister implements the PriorityLevelConfigurationLister interface.
type priorityLevelConfigurationLister struct {
indexer cache.Indexer
}
// NewPriorityLevelConfigurationLister returns a new PriorityLevelConfigurationLister.
func NewPriorityLevelConfigurationLister(indexer cache.Indexer) PriorityLevelConfigurationLister {
return &priorityLevelConfigurationLister{indexer: indexer}
}
// List lists all PriorityLevelConfigurations in the indexer.
func (s *priorityLevelConfigurationLister) List(selector labels.Selector) (ret []*v1beta1.PriorityLevelConfiguration, err error) {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1beta1.PriorityLevelConfiguration))
})
return ret, err
}
// Get retrieves the PriorityLevelConfiguration from the index for a given name.
func (s *priorityLevelConfigurationLister) Get(name string) (*v1beta1.PriorityLevelConfiguration, error) {
obj, exists, err := s.indexer.GetByKey(name)
if err != nil {
return nil, err
}
if !exists {
return nil, errors.NewNotFound(v1beta1.Resource("prioritylevelconfiguration"), name)
}
return obj.(*v1beta1.PriorityLevelConfiguration), nil
}

View File

@ -42,7 +42,7 @@ go_library(
"//staging/src/k8s.io/api/batch/v1:go_default_library",
"//staging/src/k8s.io/api/batch/v1beta1:go_default_library",
"//staging/src/k8s.io/api/core/v1:go_default_library",
"//staging/src/k8s.io/api/flowcontrol/v1alpha1:go_default_library",
"//staging/src/k8s.io/api/flowcontrol/v1beta1:go_default_library",
"//staging/src/k8s.io/api/rbac/v1:go_default_library",
"//staging/src/k8s.io/api/scheduling/v1:go_default_library",
"//staging/src/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions:go_default_library",

View File

@ -30,7 +30,7 @@ import (
"github.com/prometheus/common/expfmt"
"github.com/prometheus/common/model"
flowcontrolv1alpha1 "k8s.io/api/flowcontrol/v1alpha1"
flowcontrol "k8s.io/api/flowcontrol/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/client-go/rest"
"k8s.io/kubernetes/test/e2e/framework"
@ -41,7 +41,7 @@ const (
requestConcurrencyLimitMetricLabelName = "priorityLevel"
)
var _ = SIGDescribe("[Feature:APIPriorityAndFairness]", func() {
var _ = SIGDescribe("API priority and fairness", func() {
f := framework.NewDefaultFramework("flowschemas")
ginkgo.It("should ensure that requests can be classified by testing flow-schemas/priority-levels", func() {
@ -51,18 +51,18 @@ var _ = SIGDescribe("[Feature:APIPriorityAndFairness]", func() {
nonMatchingUsername := "foo"
ginkgo.By("creating a testing prioritylevel")
createdPriorityLevel, err := f.ClientSet.FlowcontrolV1alpha1().PriorityLevelConfigurations().Create(
createdPriorityLevel, err := f.ClientSet.FlowcontrolV1beta1().PriorityLevelConfigurations().Create(
context.TODO(),
&flowcontrolv1alpha1.PriorityLevelConfiguration{
&flowcontrol.PriorityLevelConfiguration{
ObjectMeta: metav1.ObjectMeta{
Name: testingPriorityLevelName,
},
Spec: flowcontrolv1alpha1.PriorityLevelConfigurationSpec{
Type: flowcontrolv1alpha1.PriorityLevelEnablementLimited,
Limited: &flowcontrolv1alpha1.LimitedPriorityLevelConfiguration{
Spec: flowcontrol.PriorityLevelConfigurationSpec{
Type: flowcontrol.PriorityLevelEnablementLimited,
Limited: &flowcontrol.LimitedPriorityLevelConfiguration{
AssuredConcurrencyShares: 1, // will have at minimum 1 concurrency share
LimitResponse: flowcontrolv1alpha1.LimitResponse{
Type: flowcontrolv1alpha1.LimitResponseTypeReject,
LimitResponse: flowcontrol.LimitResponse{
Type: flowcontrol.LimitResponseTypeReject,
},
},
},
@ -72,41 +72,41 @@ var _ = SIGDescribe("[Feature:APIPriorityAndFairness]", func() {
defer func() {
// clean-ups
err := f.ClientSet.FlowcontrolV1alpha1().PriorityLevelConfigurations().Delete(context.TODO(), testingPriorityLevelName, metav1.DeleteOptions{})
err := f.ClientSet.FlowcontrolV1beta1().PriorityLevelConfigurations().Delete(context.TODO(), testingPriorityLevelName, metav1.DeleteOptions{})
framework.ExpectNoError(err)
err = f.ClientSet.FlowcontrolV1alpha1().FlowSchemas().Delete(context.TODO(), testingFlowSchemaName, metav1.DeleteOptions{})
err = f.ClientSet.FlowcontrolV1beta1().FlowSchemas().Delete(context.TODO(), testingFlowSchemaName, metav1.DeleteOptions{})
framework.ExpectNoError(err)
}()
ginkgo.By("creating a testing flowschema")
createdFlowSchema, err := f.ClientSet.FlowcontrolV1alpha1().FlowSchemas().Create(
createdFlowSchema, err := f.ClientSet.FlowcontrolV1beta1().FlowSchemas().Create(
context.TODO(),
&flowcontrolv1alpha1.FlowSchema{
&flowcontrol.FlowSchema{
ObjectMeta: metav1.ObjectMeta{
Name: testingFlowSchemaName,
},
Spec: flowcontrolv1alpha1.FlowSchemaSpec{
Spec: flowcontrol.FlowSchemaSpec{
MatchingPrecedence: 1000, // a rather higher precedence to ensure it make effect
PriorityLevelConfiguration: flowcontrolv1alpha1.PriorityLevelConfigurationReference{
PriorityLevelConfiguration: flowcontrol.PriorityLevelConfigurationReference{
Name: testingPriorityLevelName,
},
DistinguisherMethod: &flowcontrolv1alpha1.FlowDistinguisherMethod{
Type: flowcontrolv1alpha1.FlowDistinguisherMethodByUserType,
DistinguisherMethod: &flowcontrol.FlowDistinguisherMethod{
Type: flowcontrol.FlowDistinguisherMethodByUserType,
},
Rules: []flowcontrolv1alpha1.PolicyRulesWithSubjects{
Rules: []flowcontrol.PolicyRulesWithSubjects{
{
Subjects: []flowcontrolv1alpha1.Subject{
Subjects: []flowcontrol.Subject{
{
Kind: flowcontrolv1alpha1.SubjectKindUser,
User: &flowcontrolv1alpha1.UserSubject{
Kind: flowcontrol.SubjectKindUser,
User: &flowcontrol.UserSubject{
Name: matchingUsername,
},
},
},
NonResourceRules: []flowcontrolv1alpha1.NonResourcePolicyRule{
NonResourceRules: []flowcontrol.NonResourcePolicyRule{
{
Verbs: []string{flowcontrolv1alpha1.VerbAll},
NonResourceURLs: []string{flowcontrolv1alpha1.NonResourceAll},
Verbs: []string{flowcontrol.VerbAll},
NonResourceURLs: []string{flowcontrol.NonResourceAll},
},
},
},
@ -154,18 +154,18 @@ var _ = SIGDescribe("[Feature:APIPriorityAndFairness]", func() {
for i := range clients {
clients[i].priorityLevelName = fmt.Sprintf("%s-%s", priorityLevelNamePrefix, clients[i].username)
framework.Logf("creating PriorityLevel %q", clients[i].priorityLevelName)
_, err := f.ClientSet.FlowcontrolV1alpha1().PriorityLevelConfigurations().Create(
_, err := f.ClientSet.FlowcontrolV1beta1().PriorityLevelConfigurations().Create(
context.TODO(),
&flowcontrolv1alpha1.PriorityLevelConfiguration{
&flowcontrol.PriorityLevelConfiguration{
ObjectMeta: metav1.ObjectMeta{
Name: clients[i].priorityLevelName,
},
Spec: flowcontrolv1alpha1.PriorityLevelConfigurationSpec{
Type: flowcontrolv1alpha1.PriorityLevelEnablementLimited,
Limited: &flowcontrolv1alpha1.LimitedPriorityLevelConfiguration{
Spec: flowcontrol.PriorityLevelConfigurationSpec{
Type: flowcontrol.PriorityLevelEnablementLimited,
Limited: &flowcontrol.LimitedPriorityLevelConfiguration{
AssuredConcurrencyShares: 1,
LimitResponse: flowcontrolv1alpha1.LimitResponse{
Type: flowcontrolv1alpha1.LimitResponseTypeReject,
LimitResponse: flowcontrol.LimitResponse{
Type: flowcontrol.LimitResponseTypeReject,
},
},
},
@ -173,38 +173,38 @@ var _ = SIGDescribe("[Feature:APIPriorityAndFairness]", func() {
metav1.CreateOptions{})
framework.ExpectNoError(err)
defer func(name string) {
framework.ExpectNoError(f.ClientSet.FlowcontrolV1alpha1().PriorityLevelConfigurations().Delete(context.TODO(), name, metav1.DeleteOptions{}))
framework.ExpectNoError(f.ClientSet.FlowcontrolV1beta1().PriorityLevelConfigurations().Delete(context.TODO(), name, metav1.DeleteOptions{}))
}(clients[i].priorityLevelName)
clients[i].flowSchemaName = fmt.Sprintf("%s-%s", flowSchemaNamePrefix, clients[i].username)
framework.Logf("creating FlowSchema %q", clients[i].flowSchemaName)
_, err = f.ClientSet.FlowcontrolV1alpha1().FlowSchemas().Create(
_, err = f.ClientSet.FlowcontrolV1beta1().FlowSchemas().Create(
context.TODO(),
&flowcontrolv1alpha1.FlowSchema{
&flowcontrol.FlowSchema{
ObjectMeta: metav1.ObjectMeta{
Name: clients[i].flowSchemaName,
},
Spec: flowcontrolv1alpha1.FlowSchemaSpec{
Spec: flowcontrol.FlowSchemaSpec{
MatchingPrecedence: clients[i].matchingPrecedence,
PriorityLevelConfiguration: flowcontrolv1alpha1.PriorityLevelConfigurationReference{
PriorityLevelConfiguration: flowcontrol.PriorityLevelConfigurationReference{
Name: clients[i].priorityLevelName,
},
DistinguisherMethod: &flowcontrolv1alpha1.FlowDistinguisherMethod{
Type: flowcontrolv1alpha1.FlowDistinguisherMethodByUserType,
DistinguisherMethod: &flowcontrol.FlowDistinguisherMethod{
Type: flowcontrol.FlowDistinguisherMethodByUserType,
},
Rules: []flowcontrolv1alpha1.PolicyRulesWithSubjects{
Rules: []flowcontrol.PolicyRulesWithSubjects{
{
Subjects: []flowcontrolv1alpha1.Subject{
Subjects: []flowcontrol.Subject{
{
Kind: flowcontrolv1alpha1.SubjectKindUser,
User: &flowcontrolv1alpha1.UserSubject{
Kind: flowcontrol.SubjectKindUser,
User: &flowcontrol.UserSubject{
Name: clients[i].username,
},
},
},
NonResourceRules: []flowcontrolv1alpha1.NonResourcePolicyRule{
NonResourceRules: []flowcontrol.NonResourcePolicyRule{
{
Verbs: []string{flowcontrolv1alpha1.VerbAll},
NonResourceURLs: []string{flowcontrolv1alpha1.NonResourceAll},
Verbs: []string{flowcontrol.VerbAll},
NonResourceURLs: []string{flowcontrol.NonResourceAll},
},
},
},
@ -214,7 +214,7 @@ var _ = SIGDescribe("[Feature:APIPriorityAndFairness]", func() {
metav1.CreateOptions{})
framework.ExpectNoError(err)
defer func(name string) {
framework.ExpectNoError(f.ClientSet.FlowcontrolV1alpha1().FlowSchemas().Delete(context.TODO(), name, metav1.DeleteOptions{}))
framework.ExpectNoError(f.ClientSet.FlowcontrolV1beta1().FlowSchemas().Delete(context.TODO(), name, metav1.DeleteOptions{}))
}(clients[i].flowSchemaName)
}
@ -291,10 +291,10 @@ func makeRequest(f *framework.Framework, username string) *http.Response {
func testResponseHeaderMatches(f *framework.Framework, impersonatingUser, plUID, fsUID string) bool {
response := makeRequest(f, impersonatingUser)
if response.Header.Get(flowcontrolv1alpha1.ResponseHeaderMatchedFlowSchemaUID) != fsUID {
if response.Header.Get(flowcontrol.ResponseHeaderMatchedFlowSchemaUID) != fsUID {
return false
}
if response.Header.Get(flowcontrolv1alpha1.ResponseHeaderMatchedPriorityLevelConfigurationUID) != plUID {
if response.Header.Get(flowcontrol.ResponseHeaderMatchedPriorityLevelConfigurationUID) != plUID {
return false
}
return true

View File

@ -38,6 +38,7 @@ go_test(
"//staging/src/k8s.io/api/discovery/v1beta1:go_default_library",
"//staging/src/k8s.io/api/extensions/v1beta1:go_default_library",
"//staging/src/k8s.io/api/flowcontrol/v1alpha1:go_default_library",
"//staging/src/k8s.io/api/flowcontrol/v1beta1:go_default_library",
"//staging/src/k8s.io/api/node/v1:go_default_library",
"//staging/src/k8s.io/api/node/v1alpha1:go_default_library",
"//staging/src/k8s.io/api/node/v1beta1:go_default_library",

View File

@ -9,7 +9,7 @@ go_test(
tags = ["integration"],
deps = [
"//pkg/controlplane:go_default_library",
"//staging/src/k8s.io/api/flowcontrol/v1alpha1:go_default_library",
"//staging/src/k8s.io/api/flowcontrol/v1beta1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/apis/meta/v1:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/runtime/schema:go_default_library",
"//staging/src/k8s.io/apimachinery/pkg/util/wait:go_default_library",

View File

@ -28,7 +28,7 @@ import (
"github.com/prometheus/common/expfmt"
"github.com/prometheus/common/model"
flowcontrolv1alpha1 "k8s.io/api/flowcontrol/v1alpha1"
flowcontrol "k8s.io/api/flowcontrol/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/wait"
@ -234,18 +234,18 @@ func getRequestCountOfPriorityLevel(c clientset.Interface) (map[string]int, map[
}
}
func createPriorityLevelAndBindingFlowSchemaForUser(c clientset.Interface, username string, concurrencyShares, queuelength int) (*flowcontrolv1alpha1.PriorityLevelConfiguration, *flowcontrolv1alpha1.FlowSchema, error) {
pl, err := c.FlowcontrolV1alpha1().PriorityLevelConfigurations().Create(context.Background(), &flowcontrolv1alpha1.PriorityLevelConfiguration{
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{
ObjectMeta: metav1.ObjectMeta{
Name: username,
},
Spec: flowcontrolv1alpha1.PriorityLevelConfigurationSpec{
Type: flowcontrolv1alpha1.PriorityLevelEnablementLimited,
Limited: &flowcontrolv1alpha1.LimitedPriorityLevelConfiguration{
Spec: flowcontrol.PriorityLevelConfigurationSpec{
Type: flowcontrol.PriorityLevelEnablementLimited,
Limited: &flowcontrol.LimitedPriorityLevelConfiguration{
AssuredConcurrencyShares: int32(concurrencyShares),
LimitResponse: flowcontrolv1alpha1.LimitResponse{
Type: flowcontrolv1alpha1.LimitResponseTypeQueue,
Queuing: &flowcontrolv1alpha1.QueuingConfiguration{
LimitResponse: flowcontrol.LimitResponse{
Type: flowcontrol.LimitResponseTypeQueue,
Queuing: &flowcontrol.QueuingConfiguration{
Queues: 100,
HandSize: 1,
QueueLengthLimit: int32(queuelength),
@ -257,33 +257,33 @@ func createPriorityLevelAndBindingFlowSchemaForUser(c clientset.Interface, usern
if err != nil {
return nil, nil, err
}
fs, err := c.FlowcontrolV1alpha1().FlowSchemas().Create(context.TODO(), &flowcontrolv1alpha1.FlowSchema{
fs, err := c.FlowcontrolV1beta1().FlowSchemas().Create(context.TODO(), &flowcontrol.FlowSchema{
ObjectMeta: metav1.ObjectMeta{
Name: username,
},
Spec: flowcontrolv1alpha1.FlowSchemaSpec{
DistinguisherMethod: &flowcontrolv1alpha1.FlowDistinguisherMethod{
Type: flowcontrolv1alpha1.FlowDistinguisherMethodByUserType,
Spec: flowcontrol.FlowSchemaSpec{
DistinguisherMethod: &flowcontrol.FlowDistinguisherMethod{
Type: flowcontrol.FlowDistinguisherMethodByUserType,
},
MatchingPrecedence: 1000,
PriorityLevelConfiguration: flowcontrolv1alpha1.PriorityLevelConfigurationReference{
PriorityLevelConfiguration: flowcontrol.PriorityLevelConfigurationReference{
Name: username,
},
Rules: []flowcontrolv1alpha1.PolicyRulesWithSubjects{
Rules: []flowcontrol.PolicyRulesWithSubjects{
{
ResourceRules: []flowcontrolv1alpha1.ResourcePolicyRule{
ResourceRules: []flowcontrol.ResourcePolicyRule{
{
Verbs: []string{flowcontrolv1alpha1.VerbAll},
APIGroups: []string{flowcontrolv1alpha1.APIGroupAll},
Resources: []string{flowcontrolv1alpha1.ResourceAll},
Namespaces: []string{flowcontrolv1alpha1.NamespaceEvery},
Verbs: []string{flowcontrol.VerbAll},
APIGroups: []string{flowcontrol.APIGroupAll},
Resources: []string{flowcontrol.ResourceAll},
Namespaces: []string{flowcontrol.NamespaceEvery},
ClusterScope: true,
},
},
Subjects: []flowcontrolv1alpha1.Subject{
Subjects: []flowcontrol.Subject{
{
Kind: flowcontrolv1alpha1.SubjectKindUser,
User: &flowcontrolv1alpha1.UserSubject{
Kind: flowcontrol.SubjectKindUser,
User: &flowcontrol.UserSubject{
Name: username,
},
},
@ -297,13 +297,13 @@ func createPriorityLevelAndBindingFlowSchemaForUser(c clientset.Interface, usern
}
return pl, fs, wait.Poll(time.Second, timeout, func() (bool, error) {
fs, err := c.FlowcontrolV1alpha1().FlowSchemas().Get(context.TODO(), username, metav1.GetOptions{})
fs, err := c.FlowcontrolV1beta1().FlowSchemas().Get(context.TODO(), username, metav1.GetOptions{})
if err != nil {
return false, err
}
for _, condition := range fs.Status.Conditions {
if condition.Type == flowcontrolv1alpha1.FlowSchemaConditionDangling {
if condition.Status == flowcontrolv1alpha1.ConditionFalse {
if condition.Type == flowcontrol.FlowSchemaConditionDangling {
if condition.Status == flowcontrol.ConditionFalse {
return true, nil
}
}

View File

@ -33,6 +33,7 @@ import (
discoveryv1beta1 "k8s.io/api/discovery/v1beta1"
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
flowcontrolv1alpha1 "k8s.io/api/flowcontrol/v1alpha1"
flowcontrolv1beta1 "k8s.io/api/flowcontrol/v1beta1"
nodev1 "k8s.io/api/node/v1"
nodev1alpha1 "k8s.io/api/node/v1alpha1"
nodev1beta1 "k8s.io/api/node/v1beta1"
@ -175,6 +176,7 @@ func TestServerSidePrint(t *testing.T) {
nodev1alpha1.SchemeGroupVersion,
nodev1beta1.SchemeGroupVersion,
flowcontrolv1alpha1.SchemeGroupVersion,
flowcontrolv1beta1.SchemeGroupVersion,
apiserverinternalv1alpha1.SchemeGroupVersion,
},
[]schema.GroupVersionResource{},

View File

@ -281,6 +281,7 @@ func GetEtcdStorageDataForNamespace(namespace string) map[schema.GroupVersionRes
gvr("flowcontrol.apiserver.k8s.io", "v1alpha1", "flowschemas"): {
Stub: `{"metadata": {"name": "va1"}, "spec": {"priorityLevelConfiguration": {"name": "name1"}}}`,
ExpectedEtcdPath: "/registry/flowschemas/va1",
ExpectedGVK: gvkP("flowcontrol.apiserver.k8s.io", "v1beta1", "FlowSchema"),
},
// --
@ -288,6 +289,21 @@ func GetEtcdStorageDataForNamespace(namespace string) map[schema.GroupVersionRes
gvr("flowcontrol.apiserver.k8s.io", "v1alpha1", "prioritylevelconfigurations"): {
Stub: `{"metadata": {"name": "conf1"}, "spec": {"type": "Limited", "limited": {"assuredConcurrencyShares":3, "limitResponse": {"type": "Reject"}}}}`,
ExpectedEtcdPath: "/registry/prioritylevelconfigurations/conf1",
ExpectedGVK: gvkP("flowcontrol.apiserver.k8s.io", "v1beta1", "PriorityLevelConfiguration"),
},
// --
// k8s.io/kubernetes/pkg/apis/flowcontrol/v1beta1
gvr("flowcontrol.apiserver.k8s.io", "v1beta1", "flowschemas"): {
Stub: `{"metadata": {"name": "va2"}, "spec": {"priorityLevelConfiguration": {"name": "name1"}}}`,
ExpectedEtcdPath: "/registry/flowschemas/va2",
},
// --
// k8s.io/kubernetes/pkg/apis/flowcontrol/v1beta1
gvr("flowcontrol.apiserver.k8s.io", "v1beta1", "prioritylevelconfigurations"): {
Stub: `{"metadata": {"name": "conf2"}, "spec": {"type": "Limited", "limited": {"assuredConcurrencyShares":3, "limitResponse": {"type": "Reject"}}}}`,
ExpectedEtcdPath: "/registry/prioritylevelconfigurations/conf2",
},
// --

Some files were not shown because too many files have changed in this diff Show More