mirror of
https://github.com/kubernetes/kubernetes.git
synced 2026-04-27 00:58:13 -04:00
Merge pull request #137170 from pohly/dra-device-taints-beta
DRA device taints: graduate to beta
This commit is contained in:
commit
4e2bbc78bf
82 changed files with 6289 additions and 223 deletions
|
|
@ -2017,6 +2017,41 @@
|
|||
"watch"
|
||||
]
|
||||
},
|
||||
{
|
||||
"resource": "devicetaintrules",
|
||||
"responseKind": {
|
||||
"group": "",
|
||||
"kind": "DeviceTaintRule",
|
||||
"version": ""
|
||||
},
|
||||
"scope": "Cluster",
|
||||
"singularResource": "devicetaintrule",
|
||||
"subresources": [
|
||||
{
|
||||
"responseKind": {
|
||||
"group": "",
|
||||
"kind": "DeviceTaintRule",
|
||||
"version": ""
|
||||
},
|
||||
"subresource": "status",
|
||||
"verbs": [
|
||||
"get",
|
||||
"patch",
|
||||
"update"
|
||||
]
|
||||
}
|
||||
],
|
||||
"verbs": [
|
||||
"create",
|
||||
"delete",
|
||||
"deletecollection",
|
||||
"get",
|
||||
"list",
|
||||
"patch",
|
||||
"update",
|
||||
"watch"
|
||||
]
|
||||
},
|
||||
{
|
||||
"resource": "resourceclaims",
|
||||
"responseKind": {
|
||||
|
|
|
|||
|
|
@ -20,6 +20,34 @@
|
|||
"watch"
|
||||
]
|
||||
},
|
||||
{
|
||||
"kind": "DeviceTaintRule",
|
||||
"name": "devicetaintrules",
|
||||
"namespaced": false,
|
||||
"singularName": "devicetaintrule",
|
||||
"storageVersionHash": "DJ3UJ0fj8MI=",
|
||||
"verbs": [
|
||||
"create",
|
||||
"delete",
|
||||
"deletecollection",
|
||||
"get",
|
||||
"list",
|
||||
"patch",
|
||||
"update",
|
||||
"watch"
|
||||
]
|
||||
},
|
||||
{
|
||||
"kind": "DeviceTaintRule",
|
||||
"name": "devicetaintrules/status",
|
||||
"namespaced": false,
|
||||
"singularName": "",
|
||||
"verbs": [
|
||||
"get",
|
||||
"patch",
|
||||
"update"
|
||||
]
|
||||
},
|
||||
{
|
||||
"kind": "ResourceClaim",
|
||||
"name": "resourceclaims",
|
||||
|
|
|
|||
994
api/openapi-spec/swagger.json
generated
994
api/openapi-spec/swagger.json
generated
File diff suppressed because it is too large
Load diff
|
|
@ -401,7 +401,7 @@
|
|||
"description": "NodeSelector defines the nodes where the device is available.\n\nMust use exactly one term.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set."
|
||||
},
|
||||
"taints": {
|
||||
"description": "If specified, these are the driver-defined taints.\n\nThe maximum number of taints is 16. If taints are set for any device in a ResourceSlice, then the maximum number of allowed devices per ResourceSlice is 64 instead of 128.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"description": "If specified, these are the driver-defined taints.\n\nThe maximum number of taints is 16. If taints are set for any device in a ResourceSlice, then the maximum number of allowed devices per ResourceSlice is 64 instead of 128.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"items": {
|
||||
"allOf": [
|
||||
{
|
||||
|
|
@ -877,7 +877,7 @@
|
|||
"type": "string"
|
||||
},
|
||||
"tolerations": {
|
||||
"description": "A copy of all tolerations specified in the request at the time when the device got allocated.\n\nThe maximum number of tolerations is 16.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"description": "A copy of all tolerations specified in the request at the time when the device got allocated.\n\nThe maximum number of tolerations is 16.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"items": {
|
||||
"allOf": [
|
||||
{
|
||||
|
|
@ -956,7 +956,7 @@
|
|||
"x-kubernetes-list-type": "atomic"
|
||||
},
|
||||
"tolerations": {
|
||||
"description": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"description": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"items": {
|
||||
"allOf": [
|
||||
{
|
||||
|
|
@ -1078,7 +1078,7 @@
|
|||
"x-kubernetes-list-type": "atomic"
|
||||
},
|
||||
"tolerations": {
|
||||
"description": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"description": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"items": {
|
||||
"allOf": [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -262,7 +262,7 @@
|
|||
"description": "NodeSelector defines the nodes where the device is available.\n\nMust use exactly one term.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set."
|
||||
},
|
||||
"taints": {
|
||||
"description": "If specified, these are the driver-defined taints.\n\nThe maximum number of taints is 16. If taints are set for any device in a ResourceSlice, then the maximum number of allowed devices per ResourceSlice is 64 instead of 128.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"description": "If specified, these are the driver-defined taints.\n\nThe maximum number of taints is 16. If taints are set for any device in a ResourceSlice, then the maximum number of allowed devices per ResourceSlice is 64 instead of 128.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"items": {
|
||||
"allOf": [
|
||||
{
|
||||
|
|
@ -860,7 +860,7 @@
|
|||
"x-kubernetes-list-type": "atomic"
|
||||
},
|
||||
"tolerations": {
|
||||
"description": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis field can only be set when deviceClassName is set and no subrequests are specified in the firstAvailable list.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"description": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis field can only be set when deviceClassName is set and no subrequests are specified in the firstAvailable list.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"items": {
|
||||
"allOf": [
|
||||
{
|
||||
|
|
@ -935,7 +935,7 @@
|
|||
"type": "string"
|
||||
},
|
||||
"tolerations": {
|
||||
"description": "A copy of all tolerations specified in the request at the time when the device got allocated.\n\nThe maximum number of tolerations is 16.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"description": "A copy of all tolerations specified in the request at the time when the device got allocated.\n\nThe maximum number of tolerations is 16.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"items": {
|
||||
"allOf": [
|
||||
{
|
||||
|
|
@ -1014,7 +1014,7 @@
|
|||
"x-kubernetes-list-type": "atomic"
|
||||
},
|
||||
"tolerations": {
|
||||
"description": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"description": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"items": {
|
||||
"allOf": [
|
||||
{
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -271,7 +271,7 @@ func newDeviceTaintEvictionController(ctx context.Context, controllerContext Con
|
|||
controllerContext.InformerFactory.Core().V1().Pods(),
|
||||
controllerContext.InformerFactory.Resource().V1().ResourceClaims(),
|
||||
controllerContext.InformerFactory.Resource().V1().ResourceSlices(),
|
||||
controllerContext.InformerFactory.Resource().V1alpha3().DeviceTaintRules(),
|
||||
controllerContext.InformerFactory.Resource().V1beta2().DeviceTaintRules(),
|
||||
controllerContext.InformerFactory.Resource().V1().DeviceClasses(),
|
||||
controllerName,
|
||||
)
|
||||
|
|
|
|||
|
|
@ -152,6 +152,8 @@ func TestDefaulting(t *testing.T) {
|
|||
{Group: "resource.k8s.io", Version: "v1beta1", Kind: "ResourceClaimTemplateList"}: {},
|
||||
{Group: "resource.k8s.io", Version: "v1beta1", Kind: "ResourceSlice"}: {},
|
||||
{Group: "resource.k8s.io", Version: "v1beta1", Kind: "ResourceSliceList"}: {},
|
||||
{Group: "resource.k8s.io", Version: "v1beta2", Kind: "DeviceTaintRule"}: {},
|
||||
{Group: "resource.k8s.io", Version: "v1beta2", Kind: "DeviceTaintRuleList"}: {},
|
||||
{Group: "resource.k8s.io", Version: "v1beta2", Kind: "ResourceClaim"}: {},
|
||||
{Group: "resource.k8s.io", Version: "v1beta2", Kind: "ResourceClaimList"}: {},
|
||||
{Group: "resource.k8s.io", Version: "v1beta2", Kind: "ResourceClaimTemplate"}: {},
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ func TestVersionedValidationByFuzzing(t *testing.T) {
|
|||
{Group: "certificates.k8s.io", Version: "v1alpha1"},
|
||||
{Group: "certificates.k8s.io", Version: "v1beta1"},
|
||||
{Group: "resource.k8s.io", Version: "v1"},
|
||||
{Group: "resource.k8s.io", Version: "v1alpha3"},
|
||||
{Group: "resource.k8s.io", Version: "v1beta1"},
|
||||
{Group: "resource.k8s.io", Version: "v1beta2"},
|
||||
{Group: "storage.k8s.io", Version: "v1"},
|
||||
|
|
|
|||
|
|
@ -348,7 +348,7 @@ type Device struct {
|
|||
// any device in a ResourceSlice, then the maximum number of
|
||||
// allowed devices per ResourceSlice is 64 instead of 128.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
//
|
||||
// +optional
|
||||
|
|
@ -914,7 +914,7 @@ type ExactDeviceRequest struct {
|
|||
//
|
||||
// The maximum number of tolerations is 16.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
//
|
||||
// +optional
|
||||
|
|
@ -1025,7 +1025,7 @@ type DeviceSubRequest struct {
|
|||
//
|
||||
// The maximum number of tolerations is 16.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
//
|
||||
// +optional
|
||||
|
|
@ -1546,7 +1546,7 @@ type DeviceRequestAllocationResult struct {
|
|||
//
|
||||
// The maximum number of tolerations is 16.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
//
|
||||
// +optional
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ limitations under the License.
|
|||
// +k8s:conversion-gen-external-types=k8s.io/api/resource/v1alpha3
|
||||
// +k8s:defaulter-gen=TypeMeta
|
||||
// +k8s:defaulter-gen-input=k8s.io/api/resource/v1alpha3
|
||||
// +k8s:validation-gen=TypeMeta
|
||||
// +k8s:validation-gen-input=k8s.io/api/resource/v1alpha3
|
||||
|
||||
// Package v1alpha3 is the v1alpha3 version of the resource API.
|
||||
package v1alpha3
|
||||
|
|
|
|||
137
pkg/apis/resource/v1alpha3/zz_generated.validations.go
generated
Normal file
137
pkg/apis/resource/v1alpha3/zz_generated.validations.go
generated
Normal file
|
|
@ -0,0 +1,137 @@
|
|||
//go:build !ignore_autogenerated
|
||||
// +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 validation-gen. DO NOT EDIT.
|
||||
|
||||
package v1alpha3
|
||||
|
||||
import (
|
||||
context "context"
|
||||
fmt "fmt"
|
||||
|
||||
resourcev1alpha3 "k8s.io/api/resource/v1alpha3"
|
||||
equality "k8s.io/apimachinery/pkg/api/equality"
|
||||
operation "k8s.io/apimachinery/pkg/api/operation"
|
||||
safe "k8s.io/apimachinery/pkg/api/safe"
|
||||
validate "k8s.io/apimachinery/pkg/api/validate"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
sets "k8s.io/apimachinery/pkg/util/sets"
|
||||
field "k8s.io/apimachinery/pkg/util/validation/field"
|
||||
)
|
||||
|
||||
func init() { localSchemeBuilder.Register(RegisterValidations) }
|
||||
|
||||
// RegisterValidations adds validation functions to the given scheme.
|
||||
// Public to allow building arbitrary schemes.
|
||||
func RegisterValidations(scheme *runtime.Scheme) error {
|
||||
// type DeviceTaintRule
|
||||
scheme.AddValidationFunc((*resourcev1alpha3.DeviceTaintRule)(nil), func(ctx context.Context, op operation.Operation, obj, oldObj interface{}) field.ErrorList {
|
||||
switch op.Request.SubresourcePath() {
|
||||
case "/":
|
||||
return Validate_DeviceTaintRule(ctx, op, nil /* fldPath */, obj.(*resourcev1alpha3.DeviceTaintRule), safe.Cast[*resourcev1alpha3.DeviceTaintRule](oldObj))
|
||||
}
|
||||
return field.ErrorList{field.InternalError(nil, fmt.Errorf("no validation found for %T, subresource: %v", obj, op.Request.SubresourcePath()))}
|
||||
})
|
||||
return nil
|
||||
}
|
||||
|
||||
// Validate_DeviceTaint validates an instance of DeviceTaint according
|
||||
// to declarative validation rules in the API schema.
|
||||
func Validate_DeviceTaint(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1alpha3.DeviceTaint) (errs field.ErrorList) {
|
||||
// field resourcev1alpha3.DeviceTaint.Key has no validation
|
||||
// field resourcev1alpha3.DeviceTaint.Value has no validation
|
||||
|
||||
// field resourcev1alpha3.DeviceTaint.Effect
|
||||
errs = append(errs,
|
||||
func(fldPath *field.Path, obj, oldObj *resourcev1alpha3.DeviceTaintEffect, oldValueCorrelated bool) (errs field.ErrorList) {
|
||||
// don't revalidate unchanged data
|
||||
if oldValueCorrelated && op.Type == operation.Update && (obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj)) {
|
||||
return nil
|
||||
}
|
||||
// call field-attached validations
|
||||
earlyReturn := false
|
||||
if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj); len(e) != 0 {
|
||||
errs = append(errs, e...)
|
||||
earlyReturn = true
|
||||
}
|
||||
if earlyReturn {
|
||||
return // do not proceed
|
||||
}
|
||||
// call the type's validation function
|
||||
errs = append(errs, Validate_DeviceTaintEffect(ctx, op, fldPath, obj, oldObj)...)
|
||||
return
|
||||
}(fldPath.Child("effect"), &obj.Effect, safe.Field(oldObj, func(oldObj *resourcev1alpha3.DeviceTaint) *resourcev1alpha3.DeviceTaintEffect { return &oldObj.Effect }), oldObj != nil)...)
|
||||
|
||||
// field resourcev1alpha3.DeviceTaint.TimeAdded has no validation
|
||||
return errs
|
||||
}
|
||||
|
||||
var symbolsForDeviceTaintEffect = sets.New(resourcev1alpha3.DeviceTaintEffectNoExecute, resourcev1alpha3.DeviceTaintEffectNoSchedule, resourcev1alpha3.DeviceTaintEffectNone)
|
||||
|
||||
// Validate_DeviceTaintEffect validates an instance of DeviceTaintEffect according
|
||||
// to declarative validation rules in the API schema.
|
||||
func Validate_DeviceTaintEffect(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1alpha3.DeviceTaintEffect) (errs field.ErrorList) {
|
||||
errs = append(errs, validate.Enum(ctx, op, fldPath, obj, oldObj, symbolsForDeviceTaintEffect, nil)...)
|
||||
|
||||
return errs
|
||||
}
|
||||
|
||||
// Validate_DeviceTaintRule validates an instance of DeviceTaintRule according
|
||||
// to declarative validation rules in the API schema.
|
||||
func Validate_DeviceTaintRule(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1alpha3.DeviceTaintRule) (errs field.ErrorList) {
|
||||
// field resourcev1alpha3.DeviceTaintRule.TypeMeta has no validation
|
||||
// field resourcev1alpha3.DeviceTaintRule.ObjectMeta has no validation
|
||||
|
||||
// field resourcev1alpha3.DeviceTaintRule.Spec
|
||||
errs = append(errs,
|
||||
func(fldPath *field.Path, obj, oldObj *resourcev1alpha3.DeviceTaintRuleSpec, oldValueCorrelated bool) (errs field.ErrorList) {
|
||||
// don't revalidate unchanged data
|
||||
if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) {
|
||||
return nil
|
||||
}
|
||||
// call the type's validation function
|
||||
errs = append(errs, Validate_DeviceTaintRuleSpec(ctx, op, fldPath, obj, oldObj)...)
|
||||
return
|
||||
}(fldPath.Child("spec"), &obj.Spec, safe.Field(oldObj, func(oldObj *resourcev1alpha3.DeviceTaintRule) *resourcev1alpha3.DeviceTaintRuleSpec {
|
||||
return &oldObj.Spec
|
||||
}), oldObj != nil)...)
|
||||
|
||||
// field resourcev1alpha3.DeviceTaintRule.Status has no validation
|
||||
return errs
|
||||
}
|
||||
|
||||
// Validate_DeviceTaintRuleSpec validates an instance of DeviceTaintRuleSpec according
|
||||
// to declarative validation rules in the API schema.
|
||||
func Validate_DeviceTaintRuleSpec(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1alpha3.DeviceTaintRuleSpec) (errs field.ErrorList) {
|
||||
// field resourcev1alpha3.DeviceTaintRuleSpec.DeviceSelector has no validation
|
||||
|
||||
// field resourcev1alpha3.DeviceTaintRuleSpec.Taint
|
||||
errs = append(errs,
|
||||
func(fldPath *field.Path, obj, oldObj *resourcev1alpha3.DeviceTaint, oldValueCorrelated bool) (errs field.ErrorList) {
|
||||
// don't revalidate unchanged data
|
||||
if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) {
|
||||
return nil
|
||||
}
|
||||
// call the type's validation function
|
||||
errs = append(errs, Validate_DeviceTaint(ctx, op, fldPath, obj, oldObj)...)
|
||||
return
|
||||
}(fldPath.Child("taint"), &obj.Taint, safe.Field(oldObj, func(oldObj *resourcev1alpha3.DeviceTaintRuleSpec) *resourcev1alpha3.DeviceTaint { return &oldObj.Taint }), oldObj != nil)...)
|
||||
|
||||
return errs
|
||||
}
|
||||
174
pkg/apis/resource/v1beta2/zz_generated.conversion.go
generated
174
pkg/apis/resource/v1beta2/zz_generated.conversion.go
generated
|
|
@ -312,6 +312,56 @@ func RegisterConversions(s *runtime.Scheme) error {
|
|||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*resourcev1beta2.DeviceTaintRule)(nil), (*resource.DeviceTaintRule)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta2_DeviceTaintRule_To_resource_DeviceTaintRule(a.(*resourcev1beta2.DeviceTaintRule), b.(*resource.DeviceTaintRule), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*resource.DeviceTaintRule)(nil), (*resourcev1beta2.DeviceTaintRule)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_resource_DeviceTaintRule_To_v1beta2_DeviceTaintRule(a.(*resource.DeviceTaintRule), b.(*resourcev1beta2.DeviceTaintRule), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*resourcev1beta2.DeviceTaintRuleList)(nil), (*resource.DeviceTaintRuleList)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta2_DeviceTaintRuleList_To_resource_DeviceTaintRuleList(a.(*resourcev1beta2.DeviceTaintRuleList), b.(*resource.DeviceTaintRuleList), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*resource.DeviceTaintRuleList)(nil), (*resourcev1beta2.DeviceTaintRuleList)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_resource_DeviceTaintRuleList_To_v1beta2_DeviceTaintRuleList(a.(*resource.DeviceTaintRuleList), b.(*resourcev1beta2.DeviceTaintRuleList), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*resourcev1beta2.DeviceTaintRuleSpec)(nil), (*resource.DeviceTaintRuleSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta2_DeviceTaintRuleSpec_To_resource_DeviceTaintRuleSpec(a.(*resourcev1beta2.DeviceTaintRuleSpec), b.(*resource.DeviceTaintRuleSpec), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*resource.DeviceTaintRuleSpec)(nil), (*resourcev1beta2.DeviceTaintRuleSpec)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_resource_DeviceTaintRuleSpec_To_v1beta2_DeviceTaintRuleSpec(a.(*resource.DeviceTaintRuleSpec), b.(*resourcev1beta2.DeviceTaintRuleSpec), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*resourcev1beta2.DeviceTaintRuleStatus)(nil), (*resource.DeviceTaintRuleStatus)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta2_DeviceTaintRuleStatus_To_resource_DeviceTaintRuleStatus(a.(*resourcev1beta2.DeviceTaintRuleStatus), b.(*resource.DeviceTaintRuleStatus), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*resource.DeviceTaintRuleStatus)(nil), (*resourcev1beta2.DeviceTaintRuleStatus)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_resource_DeviceTaintRuleStatus_To_v1beta2_DeviceTaintRuleStatus(a.(*resource.DeviceTaintRuleStatus), b.(*resourcev1beta2.DeviceTaintRuleStatus), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*resourcev1beta2.DeviceTaintSelector)(nil), (*resource.DeviceTaintSelector)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta2_DeviceTaintSelector_To_resource_DeviceTaintSelector(a.(*resourcev1beta2.DeviceTaintSelector), b.(*resource.DeviceTaintSelector), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*resource.DeviceTaintSelector)(nil), (*resourcev1beta2.DeviceTaintSelector)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_resource_DeviceTaintSelector_To_v1beta2_DeviceTaintSelector(a.(*resource.DeviceTaintSelector), b.(*resourcev1beta2.DeviceTaintSelector), scope)
|
||||
}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := s.AddGeneratedConversionFunc((*resourcev1beta2.DeviceToleration)(nil), (*resource.DeviceToleration)(nil), func(a, b interface{}, scope conversion.Scope) error {
|
||||
return Convert_v1beta2_DeviceToleration_To_resource_DeviceToleration(a.(*resourcev1beta2.DeviceToleration), b.(*resource.DeviceToleration), scope)
|
||||
}); err != nil {
|
||||
|
|
@ -1157,6 +1207,130 @@ func Convert_resource_DeviceTaint_To_v1beta2_DeviceTaint(in *resource.DeviceTain
|
|||
return autoConvert_resource_DeviceTaint_To_v1beta2_DeviceTaint(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta2_DeviceTaintRule_To_resource_DeviceTaintRule(in *resourcev1beta2.DeviceTaintRule, out *resource.DeviceTaintRule, s conversion.Scope) error {
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
if err := Convert_v1beta2_DeviceTaintRuleSpec_To_resource_DeviceTaintRuleSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := Convert_v1beta2_DeviceTaintRuleStatus_To_resource_DeviceTaintRuleStatus(&in.Status, &out.Status, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1beta2_DeviceTaintRule_To_resource_DeviceTaintRule is an autogenerated conversion function.
|
||||
func Convert_v1beta2_DeviceTaintRule_To_resource_DeviceTaintRule(in *resourcev1beta2.DeviceTaintRule, out *resource.DeviceTaintRule, s conversion.Scope) error {
|
||||
return autoConvert_v1beta2_DeviceTaintRule_To_resource_DeviceTaintRule(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_resource_DeviceTaintRule_To_v1beta2_DeviceTaintRule(in *resource.DeviceTaintRule, out *resourcev1beta2.DeviceTaintRule, s conversion.Scope) error {
|
||||
out.ObjectMeta = in.ObjectMeta
|
||||
if err := Convert_resource_DeviceTaintRuleSpec_To_v1beta2_DeviceTaintRuleSpec(&in.Spec, &out.Spec, s); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := Convert_resource_DeviceTaintRuleStatus_To_v1beta2_DeviceTaintRuleStatus(&in.Status, &out.Status, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_resource_DeviceTaintRule_To_v1beta2_DeviceTaintRule is an autogenerated conversion function.
|
||||
func Convert_resource_DeviceTaintRule_To_v1beta2_DeviceTaintRule(in *resource.DeviceTaintRule, out *resourcev1beta2.DeviceTaintRule, s conversion.Scope) error {
|
||||
return autoConvert_resource_DeviceTaintRule_To_v1beta2_DeviceTaintRule(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta2_DeviceTaintRuleList_To_resource_DeviceTaintRuleList(in *resourcev1beta2.DeviceTaintRuleList, out *resource.DeviceTaintRuleList, s conversion.Scope) error {
|
||||
out.ListMeta = in.ListMeta
|
||||
out.Items = *(*[]resource.DeviceTaintRule)(unsafe.Pointer(&in.Items))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1beta2_DeviceTaintRuleList_To_resource_DeviceTaintRuleList is an autogenerated conversion function.
|
||||
func Convert_v1beta2_DeviceTaintRuleList_To_resource_DeviceTaintRuleList(in *resourcev1beta2.DeviceTaintRuleList, out *resource.DeviceTaintRuleList, s conversion.Scope) error {
|
||||
return autoConvert_v1beta2_DeviceTaintRuleList_To_resource_DeviceTaintRuleList(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_resource_DeviceTaintRuleList_To_v1beta2_DeviceTaintRuleList(in *resource.DeviceTaintRuleList, out *resourcev1beta2.DeviceTaintRuleList, s conversion.Scope) error {
|
||||
out.ListMeta = in.ListMeta
|
||||
out.Items = *(*[]resourcev1beta2.DeviceTaintRule)(unsafe.Pointer(&in.Items))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_resource_DeviceTaintRuleList_To_v1beta2_DeviceTaintRuleList is an autogenerated conversion function.
|
||||
func Convert_resource_DeviceTaintRuleList_To_v1beta2_DeviceTaintRuleList(in *resource.DeviceTaintRuleList, out *resourcev1beta2.DeviceTaintRuleList, s conversion.Scope) error {
|
||||
return autoConvert_resource_DeviceTaintRuleList_To_v1beta2_DeviceTaintRuleList(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta2_DeviceTaintRuleSpec_To_resource_DeviceTaintRuleSpec(in *resourcev1beta2.DeviceTaintRuleSpec, out *resource.DeviceTaintRuleSpec, s conversion.Scope) error {
|
||||
out.DeviceSelector = (*resource.DeviceTaintSelector)(unsafe.Pointer(in.DeviceSelector))
|
||||
if err := Convert_v1beta2_DeviceTaint_To_resource_DeviceTaint(&in.Taint, &out.Taint, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1beta2_DeviceTaintRuleSpec_To_resource_DeviceTaintRuleSpec is an autogenerated conversion function.
|
||||
func Convert_v1beta2_DeviceTaintRuleSpec_To_resource_DeviceTaintRuleSpec(in *resourcev1beta2.DeviceTaintRuleSpec, out *resource.DeviceTaintRuleSpec, s conversion.Scope) error {
|
||||
return autoConvert_v1beta2_DeviceTaintRuleSpec_To_resource_DeviceTaintRuleSpec(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_resource_DeviceTaintRuleSpec_To_v1beta2_DeviceTaintRuleSpec(in *resource.DeviceTaintRuleSpec, out *resourcev1beta2.DeviceTaintRuleSpec, s conversion.Scope) error {
|
||||
out.DeviceSelector = (*resourcev1beta2.DeviceTaintSelector)(unsafe.Pointer(in.DeviceSelector))
|
||||
if err := Convert_resource_DeviceTaint_To_v1beta2_DeviceTaint(&in.Taint, &out.Taint, s); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_resource_DeviceTaintRuleSpec_To_v1beta2_DeviceTaintRuleSpec is an autogenerated conversion function.
|
||||
func Convert_resource_DeviceTaintRuleSpec_To_v1beta2_DeviceTaintRuleSpec(in *resource.DeviceTaintRuleSpec, out *resourcev1beta2.DeviceTaintRuleSpec, s conversion.Scope) error {
|
||||
return autoConvert_resource_DeviceTaintRuleSpec_To_v1beta2_DeviceTaintRuleSpec(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta2_DeviceTaintRuleStatus_To_resource_DeviceTaintRuleStatus(in *resourcev1beta2.DeviceTaintRuleStatus, out *resource.DeviceTaintRuleStatus, s conversion.Scope) error {
|
||||
out.Conditions = *(*[]v1.Condition)(unsafe.Pointer(&in.Conditions))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1beta2_DeviceTaintRuleStatus_To_resource_DeviceTaintRuleStatus is an autogenerated conversion function.
|
||||
func Convert_v1beta2_DeviceTaintRuleStatus_To_resource_DeviceTaintRuleStatus(in *resourcev1beta2.DeviceTaintRuleStatus, out *resource.DeviceTaintRuleStatus, s conversion.Scope) error {
|
||||
return autoConvert_v1beta2_DeviceTaintRuleStatus_To_resource_DeviceTaintRuleStatus(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_resource_DeviceTaintRuleStatus_To_v1beta2_DeviceTaintRuleStatus(in *resource.DeviceTaintRuleStatus, out *resourcev1beta2.DeviceTaintRuleStatus, s conversion.Scope) error {
|
||||
out.Conditions = *(*[]v1.Condition)(unsafe.Pointer(&in.Conditions))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_resource_DeviceTaintRuleStatus_To_v1beta2_DeviceTaintRuleStatus is an autogenerated conversion function.
|
||||
func Convert_resource_DeviceTaintRuleStatus_To_v1beta2_DeviceTaintRuleStatus(in *resource.DeviceTaintRuleStatus, out *resourcev1beta2.DeviceTaintRuleStatus, s conversion.Scope) error {
|
||||
return autoConvert_resource_DeviceTaintRuleStatus_To_v1beta2_DeviceTaintRuleStatus(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta2_DeviceTaintSelector_To_resource_DeviceTaintSelector(in *resourcev1beta2.DeviceTaintSelector, out *resource.DeviceTaintSelector, s conversion.Scope) error {
|
||||
out.Driver = (*string)(unsafe.Pointer(in.Driver))
|
||||
out.Pool = (*string)(unsafe.Pointer(in.Pool))
|
||||
out.Device = (*string)(unsafe.Pointer(in.Device))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_v1beta2_DeviceTaintSelector_To_resource_DeviceTaintSelector is an autogenerated conversion function.
|
||||
func Convert_v1beta2_DeviceTaintSelector_To_resource_DeviceTaintSelector(in *resourcev1beta2.DeviceTaintSelector, out *resource.DeviceTaintSelector, s conversion.Scope) error {
|
||||
return autoConvert_v1beta2_DeviceTaintSelector_To_resource_DeviceTaintSelector(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_resource_DeviceTaintSelector_To_v1beta2_DeviceTaintSelector(in *resource.DeviceTaintSelector, out *resourcev1beta2.DeviceTaintSelector, s conversion.Scope) error {
|
||||
out.Driver = (*string)(unsafe.Pointer(in.Driver))
|
||||
out.Pool = (*string)(unsafe.Pointer(in.Pool))
|
||||
out.Device = (*string)(unsafe.Pointer(in.Device))
|
||||
return nil
|
||||
}
|
||||
|
||||
// Convert_resource_DeviceTaintSelector_To_v1beta2_DeviceTaintSelector is an autogenerated conversion function.
|
||||
func Convert_resource_DeviceTaintSelector_To_v1beta2_DeviceTaintSelector(in *resource.DeviceTaintSelector, out *resourcev1beta2.DeviceTaintSelector, s conversion.Scope) error {
|
||||
return autoConvert_resource_DeviceTaintSelector_To_v1beta2_DeviceTaintSelector(in, out, s)
|
||||
}
|
||||
|
||||
func autoConvert_v1beta2_DeviceToleration_To_resource_DeviceToleration(in *resourcev1beta2.DeviceToleration, out *resource.DeviceToleration, s conversion.Scope) error {
|
||||
out.Key = in.Key
|
||||
out.Operator = resource.DeviceTolerationOperator(in.Operator)
|
||||
|
|
|
|||
15
pkg/apis/resource/v1beta2/zz_generated.defaults.go
generated
15
pkg/apis/resource/v1beta2/zz_generated.defaults.go
generated
|
|
@ -30,6 +30,10 @@ import (
|
|||
// Public to allow building arbitrary schemes.
|
||||
// All generated defaulters are covering - they call all nested defaulters.
|
||||
func RegisterDefaults(scheme *runtime.Scheme) error {
|
||||
scheme.AddTypeDefaultingFunc(&resourcev1beta2.DeviceTaintRule{}, func(obj interface{}) { SetObjectDefaults_DeviceTaintRule(obj.(*resourcev1beta2.DeviceTaintRule)) })
|
||||
scheme.AddTypeDefaultingFunc(&resourcev1beta2.DeviceTaintRuleList{}, func(obj interface{}) {
|
||||
SetObjectDefaults_DeviceTaintRuleList(obj.(*resourcev1beta2.DeviceTaintRuleList))
|
||||
})
|
||||
scheme.AddTypeDefaultingFunc(&resourcev1beta2.ResourceClaim{}, func(obj interface{}) { SetObjectDefaults_ResourceClaim(obj.(*resourcev1beta2.ResourceClaim)) })
|
||||
scheme.AddTypeDefaultingFunc(&resourcev1beta2.ResourceClaimList{}, func(obj interface{}) { SetObjectDefaults_ResourceClaimList(obj.(*resourcev1beta2.ResourceClaimList)) })
|
||||
scheme.AddTypeDefaultingFunc(&resourcev1beta2.ResourceClaimTemplate{}, func(obj interface{}) {
|
||||
|
|
@ -43,6 +47,17 @@ func RegisterDefaults(scheme *runtime.Scheme) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func SetObjectDefaults_DeviceTaintRule(in *resourcev1beta2.DeviceTaintRule) {
|
||||
SetDefaults_DeviceTaint(&in.Spec.Taint)
|
||||
}
|
||||
|
||||
func SetObjectDefaults_DeviceTaintRuleList(in *resourcev1beta2.DeviceTaintRuleList) {
|
||||
for i := range in.Items {
|
||||
a := &in.Items[i]
|
||||
SetObjectDefaults_DeviceTaintRule(a)
|
||||
}
|
||||
}
|
||||
|
||||
func SetObjectDefaults_ResourceClaim(in *resourcev1beta2.ResourceClaim) {
|
||||
for i := range in.Spec.Devices.Requests {
|
||||
a := &in.Spec.Devices.Requests[i]
|
||||
|
|
|
|||
|
|
@ -50,6 +50,14 @@ func RegisterValidations(scheme *runtime.Scheme) error {
|
|||
}
|
||||
return field.ErrorList{field.InternalError(nil, fmt.Errorf("no validation found for %T, subresource: %v", obj, op.Request.SubresourcePath()))}
|
||||
})
|
||||
// type DeviceTaintRule
|
||||
scheme.AddValidationFunc((*resourcev1beta2.DeviceTaintRule)(nil), func(ctx context.Context, op operation.Operation, obj, oldObj interface{}) field.ErrorList {
|
||||
switch op.Request.SubresourcePath() {
|
||||
case "/":
|
||||
return Validate_DeviceTaintRule(ctx, op, nil /* fldPath */, obj.(*resourcev1beta2.DeviceTaintRule), safe.Cast[*resourcev1beta2.DeviceTaintRule](oldObj))
|
||||
}
|
||||
return field.ErrorList{field.InternalError(nil, fmt.Errorf("no validation found for %T, subresource: %v", obj, op.Request.SubresourcePath()))}
|
||||
})
|
||||
// type ResourceClaim
|
||||
scheme.AddValidationFunc((*resourcev1beta2.ResourceClaim)(nil), func(ctx context.Context, op operation.Operation, obj, oldObj interface{}) field.ErrorList {
|
||||
switch op.Request.SubresourcePath() {
|
||||
|
|
@ -1313,6 +1321,50 @@ func Validate_DeviceTaintEffect(ctx context.Context, op operation.Operation, fld
|
|||
return errs
|
||||
}
|
||||
|
||||
// Validate_DeviceTaintRule validates an instance of DeviceTaintRule according
|
||||
// to declarative validation rules in the API schema.
|
||||
func Validate_DeviceTaintRule(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1beta2.DeviceTaintRule) (errs field.ErrorList) {
|
||||
// field resourcev1beta2.DeviceTaintRule.TypeMeta has no validation
|
||||
// field resourcev1beta2.DeviceTaintRule.ObjectMeta has no validation
|
||||
|
||||
// field resourcev1beta2.DeviceTaintRule.Spec
|
||||
errs = append(errs,
|
||||
func(fldPath *field.Path, obj, oldObj *resourcev1beta2.DeviceTaintRuleSpec, oldValueCorrelated bool) (errs field.ErrorList) {
|
||||
// don't revalidate unchanged data
|
||||
if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) {
|
||||
return nil
|
||||
}
|
||||
// call the type's validation function
|
||||
errs = append(errs, Validate_DeviceTaintRuleSpec(ctx, op, fldPath, obj, oldObj)...)
|
||||
return
|
||||
}(fldPath.Child("spec"), &obj.Spec, safe.Field(oldObj, func(oldObj *resourcev1beta2.DeviceTaintRule) *resourcev1beta2.DeviceTaintRuleSpec {
|
||||
return &oldObj.Spec
|
||||
}), oldObj != nil)...)
|
||||
|
||||
// field resourcev1beta2.DeviceTaintRule.Status has no validation
|
||||
return errs
|
||||
}
|
||||
|
||||
// Validate_DeviceTaintRuleSpec validates an instance of DeviceTaintRuleSpec according
|
||||
// to declarative validation rules in the API schema.
|
||||
func Validate_DeviceTaintRuleSpec(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1beta2.DeviceTaintRuleSpec) (errs field.ErrorList) {
|
||||
// field resourcev1beta2.DeviceTaintRuleSpec.DeviceSelector has no validation
|
||||
|
||||
// field resourcev1beta2.DeviceTaintRuleSpec.Taint
|
||||
errs = append(errs,
|
||||
func(fldPath *field.Path, obj, oldObj *resourcev1beta2.DeviceTaint, oldValueCorrelated bool) (errs field.ErrorList) {
|
||||
// don't revalidate unchanged data
|
||||
if oldValueCorrelated && op.Type == operation.Update && equality.Semantic.DeepEqual(obj, oldObj) {
|
||||
return nil
|
||||
}
|
||||
// call the type's validation function
|
||||
errs = append(errs, Validate_DeviceTaint(ctx, op, fldPath, obj, oldObj)...)
|
||||
return
|
||||
}(fldPath.Child("taint"), &obj.Taint, safe.Field(oldObj, func(oldObj *resourcev1beta2.DeviceTaintRuleSpec) *resourcev1beta2.DeviceTaint { return &oldObj.Taint }), oldObj != nil)...)
|
||||
|
||||
return errs
|
||||
}
|
||||
|
||||
// Validate_DeviceToleration validates an instance of DeviceToleration according
|
||||
// to declarative validation rules in the API schema.
|
||||
func Validate_DeviceToleration(ctx context.Context, op operation.Operation, fldPath *field.Path, obj, oldObj *resourcev1beta2.DeviceToleration) (errs field.ErrorList) {
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ import (
|
|||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
resourceapi "k8s.io/api/resource/v1"
|
||||
resourcealpha "k8s.io/api/resource/v1alpha3"
|
||||
resourcbeta "k8s.io/api/resource/v1beta2"
|
||||
apiequality "k8s.io/apimachinery/pkg/api/equality"
|
||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
|
|
@ -41,15 +41,15 @@ import (
|
|||
"k8s.io/apimachinery/pkg/util/sets"
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
metav1ac "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||
resourceac "k8s.io/client-go/applyconfigurations/resource/v1alpha3"
|
||||
resourceac "k8s.io/client-go/applyconfigurations/resource/v1beta2"
|
||||
coreinformers "k8s.io/client-go/informers/core/v1"
|
||||
resourceinformers "k8s.io/client-go/informers/resource/v1"
|
||||
resourcealphainformers "k8s.io/client-go/informers/resource/v1alpha3"
|
||||
resourcealphainformers "k8s.io/client-go/informers/resource/v1beta2"
|
||||
clientset "k8s.io/client-go/kubernetes"
|
||||
"k8s.io/client-go/kubernetes/scheme"
|
||||
v1core "k8s.io/client-go/kubernetes/typed/core/v1"
|
||||
corelisters "k8s.io/client-go/listers/core/v1"
|
||||
resourcealphalisters "k8s.io/client-go/listers/resource/v1alpha3"
|
||||
resourcealphalisters "k8s.io/client-go/listers/resource/v1beta2"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
"k8s.io/client-go/tools/record"
|
||||
"k8s.io/client-go/util/workqueue"
|
||||
|
|
@ -134,7 +134,7 @@ type Controller struct {
|
|||
pools map[poolID]pool
|
||||
|
||||
// evictingRules tracks all DeviceTaintRules by name which cause pod eviction.
|
||||
evictingRules map[string]*resourcealpha.DeviceTaintRule
|
||||
evictingRules map[string]*resourcbeta.DeviceTaintRule
|
||||
|
||||
// taintRuleStats tracks information about work that was done for a specific DeviceTaintRule instance.
|
||||
//
|
||||
|
|
@ -289,7 +289,7 @@ func (er evictionReason) String() string {
|
|||
// trackedTaint augments a DeviceTaint with a pointer to its origin.
|
||||
// rule and slice are mutually exclusive. Exactly one of them is always set.
|
||||
type trackedTaint struct {
|
||||
rule *resourcealpha.DeviceTaintRule
|
||||
rule *resourcbeta.DeviceTaintRule
|
||||
slice sliceDeviceTaint
|
||||
}
|
||||
|
||||
|
|
@ -372,7 +372,7 @@ type workItem struct {
|
|||
ruleRef tainteviction.NamespacedObject
|
||||
}
|
||||
|
||||
func workItemForRule(rule *resourcealpha.DeviceTaintRule) workItem {
|
||||
func workItemForRule(rule *resourcbeta.DeviceTaintRule) workItem {
|
||||
return workItem{ruleRef: tainteviction.NamespacedObject{NamespacedName: types.NamespacedName{Name: rule.Name}, UID: rule.UID}}
|
||||
}
|
||||
|
||||
|
|
@ -520,7 +520,7 @@ func (tc *Controller) maybeUpdateRuleStatus(ctx context.Context, ruleRef taintev
|
|||
|
||||
// Already set?
|
||||
index := slices.IndexFunc(rule.Status.Conditions, func(condition metav1.Condition) bool {
|
||||
return condition.Type == resourcealpha.DeviceTaintConditionEvictionInProgress
|
||||
return condition.Type == resourcbeta.DeviceTaintConditionEvictionInProgress
|
||||
})
|
||||
|
||||
// LastTransitionTime gets bumped each time we make any change to the condition,
|
||||
|
|
@ -546,7 +546,7 @@ func (tc *Controller) maybeUpdateRuleStatus(ctx context.Context, ruleRef taintev
|
|||
// Checking all pods might be expensive. Only do it if really needed.
|
||||
var numTaintedSliceDevices, numTaintedAllocatedDevices, numPendingPods, numPendingNamespaces int64
|
||||
switch rule.Spec.Taint.Effect {
|
||||
case resourcealpha.DeviceTaintEffectNone:
|
||||
case resourcbeta.DeviceTaintEffectNone:
|
||||
// Temporarily change the effect from None to NoExecute to simulate.
|
||||
// We pretend to do that through informer events. We hold the lock,
|
||||
// so there is no race with real informer events or other goroutines.
|
||||
|
|
@ -554,7 +554,7 @@ func (tc *Controller) maybeUpdateRuleStatus(ctx context.Context, ruleRef taintev
|
|||
// To avoid having a lasting impact on the real controller instance
|
||||
// we make a temporary copy.
|
||||
ruleEvict := rule.DeepCopy()
|
||||
ruleEvict.Spec.Taint.Effect = resourcealpha.DeviceTaintEffectNoExecute
|
||||
ruleEvict.Spec.Taint.Effect = resourcbeta.DeviceTaintEffectNoExecute
|
||||
tc := &Controller{
|
||||
logger: klog.LoggerWithName(logger, "simulation"),
|
||||
podLister: tc.podLister,
|
||||
|
|
@ -562,7 +562,7 @@ func (tc *Controller) maybeUpdateRuleStatus(ctx context.Context, ruleRef taintev
|
|||
deletePodAt: make(map[tainteviction.NamespacedObject]evictionAndReason),
|
||||
allocatedClaims: maps.Clone(tc.allocatedClaims),
|
||||
pools: tc.pools,
|
||||
evictingRules: make(map[string]*resourcealpha.DeviceTaintRule),
|
||||
evictingRules: make(map[string]*resourcbeta.DeviceTaintRule),
|
||||
workqueue: &NOPQueue[workItem]{},
|
||||
}
|
||||
defer tc.workqueue.ShutDown()
|
||||
|
|
@ -570,7 +570,7 @@ func (tc *Controller) maybeUpdateRuleStatus(ctx context.Context, ruleRef taintev
|
|||
tc.handleRuleChange(rule, ruleEvict)
|
||||
numPendingPods, numPendingNamespaces, err = tc.countPendingPods(rule)
|
||||
numTaintedSliceDevices, numTaintedAllocatedDevices = tc.countTaintedDevices(rule)
|
||||
case resourcealpha.DeviceTaintEffectNoExecute:
|
||||
case resourcbeta.DeviceTaintEffectNoExecute:
|
||||
numPendingPods, numPendingNamespaces, err = tc.countPendingPods(rule)
|
||||
default:
|
||||
err = nil
|
||||
|
|
@ -581,14 +581,14 @@ func (tc *Controller) maybeUpdateRuleStatus(ctx context.Context, ruleRef taintev
|
|||
|
||||
// Some fields are tentative and get updated below.
|
||||
newCondition := metav1.Condition{
|
||||
Type: resourcealpha.DeviceTaintConditionEvictionInProgress,
|
||||
Type: resourcbeta.DeviceTaintConditionEvictionInProgress,
|
||||
Status: metav1.ConditionFalse,
|
||||
Reason: string("Effect" + rule.Spec.Taint.Effect),
|
||||
ObservedGeneration: rule.Generation,
|
||||
LastTransitionTime: existingCondition.LastTransitionTime, // To avoid a false "is different" in the comparison, gets updated later.
|
||||
}
|
||||
switch rule.Spec.Taint.Effect {
|
||||
case resourcealpha.DeviceTaintEffectNoExecute:
|
||||
case resourcbeta.DeviceTaintEffectNoExecute:
|
||||
switch {
|
||||
case numPendingPods > 0:
|
||||
newCondition.Reason = "PodsPendingEviction"
|
||||
|
|
@ -608,7 +608,7 @@ func (tc *Controller) maybeUpdateRuleStatus(ctx context.Context, ruleRef taintev
|
|||
default:
|
||||
newCondition.Reason = "NotStarted"
|
||||
}
|
||||
case resourcealpha.DeviceTaintEffectNone:
|
||||
case resourcbeta.DeviceTaintEffectNone:
|
||||
newCondition.Reason = "NoEffect"
|
||||
if numTaintedSliceDevices == 1 {
|
||||
newCondition.Message += "1 published device selected. "
|
||||
|
|
@ -660,7 +660,7 @@ func (tc *Controller) maybeUpdateRuleStatus(ctx context.Context, ruleRef taintev
|
|||
ObservedGeneration: &newCondition.ObservedGeneration,
|
||||
LastTransitionTime: &newCondition.LastTransitionTime,
|
||||
}))
|
||||
if _, err := tc.client.ResourceV1alpha3().DeviceTaintRules().ApplyStatus(ctx, ruleAC, metav1.ApplyOptions{FieldManager: tc.name, Force: true}); err != nil {
|
||||
if _, err := tc.client.ResourceV1beta2().DeviceTaintRules().ApplyStatus(ctx, ruleAC, metav1.ApplyOptions{FieldManager: tc.name, Force: true}); err != nil {
|
||||
return 0, fmt.Errorf("add condition to DeviceTaintRule status: %w", err)
|
||||
}
|
||||
}
|
||||
|
|
@ -669,7 +669,7 @@ func (tc *Controller) maybeUpdateRuleStatus(ctx context.Context, ruleRef taintev
|
|||
return 0, nil
|
||||
}
|
||||
|
||||
func (tc *Controller) countPendingPods(rule *resourcealpha.DeviceTaintRule) (int64, int64, error) {
|
||||
func (tc *Controller) countPendingPods(rule *resourcbeta.DeviceTaintRule) (int64, int64, error) {
|
||||
pods, err := tc.podLister.List(labels.Everything())
|
||||
if err != nil {
|
||||
return -1, -1, fmt.Errorf("list pod: %w", err)
|
||||
|
|
@ -699,7 +699,7 @@ func (tc *Controller) countPendingPods(rule *resourcealpha.DeviceTaintRule) (int
|
|||
|
||||
// countTaintedDevices determines the number of devices in slices matching the rule and
|
||||
// the number of allocated devices matching the rule.
|
||||
func (tc *Controller) countTaintedDevices(rule *resourcealpha.DeviceTaintRule) (numTaintedSliceDevices int64, numTaintedAllocatedDevices int64) {
|
||||
func (tc *Controller) countTaintedDevices(rule *resourcbeta.DeviceTaintRule) (numTaintedSliceDevices int64, numTaintedAllocatedDevices int64) {
|
||||
for poolID, pool := range tc.pools {
|
||||
for _, slice := range pool.slices {
|
||||
if slice.Spec.Pool.Generation != pool.maxGeneration {
|
||||
|
|
@ -741,7 +741,7 @@ func New(c clientset.Interface, podInformer coreinformers.PodInformer, claimInfo
|
|||
deletePodAt: make(map[tainteviction.NamespacedObject]evictionAndReason),
|
||||
allocatedClaims: make(map[types.NamespacedName]allocatedClaim),
|
||||
pools: make(map[poolID]pool),
|
||||
evictingRules: make(map[string]*resourcealpha.DeviceTaintRule),
|
||||
evictingRules: make(map[string]*resourcbeta.DeviceTaintRule),
|
||||
taintRuleStats: make(map[types.UID]taintRuleStats),
|
||||
// Instantiate all informers now to ensure that they get started.
|
||||
haveSynced: []cache.DoneChecker{
|
||||
|
|
@ -916,7 +916,7 @@ func (tc *Controller) Run(ctx context.Context, numWorkers int) error {
|
|||
if tc.ruleInformer != nil {
|
||||
ruleHandler, err := tc.ruleInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
|
||||
AddFunc: func(obj any) {
|
||||
rule, ok := obj.(*resourcealpha.DeviceTaintRule)
|
||||
rule, ok := obj.(*resourcbeta.DeviceTaintRule)
|
||||
if !ok {
|
||||
logger.Error(nil, "Expected DeviceTaintRule", "actual", fmt.Sprintf("%T", obj))
|
||||
return
|
||||
|
|
@ -926,12 +926,12 @@ func (tc *Controller) Run(ctx context.Context, numWorkers int) error {
|
|||
tc.handleRuleChange(nil, rule)
|
||||
},
|
||||
UpdateFunc: func(oldObj, newObj any) {
|
||||
oldRule, ok := oldObj.(*resourcealpha.DeviceTaintRule)
|
||||
oldRule, ok := oldObj.(*resourcbeta.DeviceTaintRule)
|
||||
if !ok {
|
||||
logger.Error(nil, "Expected DeviceTaintRule", "actual", fmt.Sprintf("%T", oldObj))
|
||||
return
|
||||
}
|
||||
newRule, ok := newObj.(*resourcealpha.DeviceTaintRule)
|
||||
newRule, ok := newObj.(*resourcbeta.DeviceTaintRule)
|
||||
if !ok {
|
||||
logger.Error(nil, "Expected DeviceTaintRule", "actual", fmt.Sprintf("%T", newObj))
|
||||
}
|
||||
|
|
@ -943,7 +943,7 @@ func (tc *Controller) Run(ctx context.Context, numWorkers int) error {
|
|||
if tombstone, ok := obj.(cache.DeletedFinalStateUnknown); ok {
|
||||
obj = tombstone.Obj
|
||||
}
|
||||
rule, ok := obj.(*resourcealpha.DeviceTaintRule)
|
||||
rule, ok := obj.(*resourcbeta.DeviceTaintRule)
|
||||
if !ok {
|
||||
logger.Error(nil, "Expected DeviceTaintRule", "actual", fmt.Sprintf("%T", obj))
|
||||
return
|
||||
|
|
@ -1270,7 +1270,7 @@ func (tc *Controller) allEvictingDeviceTaints(allocatedDevice resourceapi.Device
|
|||
}
|
||||
}
|
||||
|
||||
func ruleMatchesDevice(rule *resourcealpha.DeviceTaintRule, driverName, poolName, deviceName string) bool {
|
||||
func ruleMatchesDevice(rule *resourcbeta.DeviceTaintRule, driverName, poolName, deviceName string) bool {
|
||||
selector := rule.Spec.DeviceSelector
|
||||
if selector == nil {
|
||||
return false
|
||||
|
|
@ -1283,7 +1283,7 @@ func ruleMatchesDevice(rule *resourcealpha.DeviceTaintRule, driverName, poolName
|
|||
return true
|
||||
}
|
||||
|
||||
func (tc *Controller) handleRuleChange(oldRule, newRule *resourcealpha.DeviceTaintRule) {
|
||||
func (tc *Controller) handleRuleChange(oldRule, newRule *resourcbeta.DeviceTaintRule) {
|
||||
rule := newRule
|
||||
if rule == nil {
|
||||
rule = oldRule
|
||||
|
|
@ -1321,10 +1321,10 @@ func (tc *Controller) handleRuleChange(oldRule, newRule *resourcealpha.DeviceTai
|
|||
|
||||
// Rule spec changes should be rare. Simply do a brute-force re-evaluation of all allocated claims.
|
||||
// Same with trying to avoid delete+add in evictingRules, the logic just becomes unnecessarily complex.
|
||||
if oldRule != nil && oldRule.Spec.Taint.Effect == resourcealpha.DeviceTaintEffectNoExecute {
|
||||
if oldRule != nil && oldRule.Spec.Taint.Effect == resourcbeta.DeviceTaintEffectNoExecute {
|
||||
delete(tc.evictingRules, oldRule.Name)
|
||||
}
|
||||
if newRule != nil && newRule.Spec.Taint.Effect == resourcealpha.DeviceTaintEffectNoExecute {
|
||||
if newRule != nil && newRule.Spec.Taint.Effect == resourcbeta.DeviceTaintEffectNoExecute {
|
||||
tc.evictingRules[newRule.Name] = newRule
|
||||
}
|
||||
for name, oldAllocatedClaim := range tc.allocatedClaims {
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ import (
|
|||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
resourceapi "k8s.io/api/resource/v1"
|
||||
resourcealpha "k8s.io/api/resource/v1alpha3"
|
||||
resourcebeta "k8s.io/api/resource/v1beta2"
|
||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/runtime"
|
||||
|
|
@ -116,7 +116,7 @@ func setup(tCtx ktesting.TContext) *testContext {
|
|||
informerFactory.Core().V1().Pods(),
|
||||
informerFactory.Resource().V1().ResourceClaims(),
|
||||
informerFactory.Resource().V1().ResourceSlices(),
|
||||
informerFactory.Resource().V1alpha3().DeviceTaintRules(),
|
||||
informerFactory.Resource().V1beta2().DeviceTaintRules(),
|
||||
informerFactory.Resource().V1().DeviceClasses(),
|
||||
"device-taint-eviction",
|
||||
)
|
||||
|
|
@ -149,7 +149,7 @@ type state struct {
|
|||
pods []*v1.Pod
|
||||
allocatedClaims []allocatedClaim
|
||||
slices []*resourceapi.ResourceSlice
|
||||
rules []*resourcealpha.DeviceTaintRule
|
||||
rules []*resourcebeta.DeviceTaintRule
|
||||
ruleStats map[types.UID]taintRuleStats
|
||||
|
||||
// Pods might have been queued in the past and then not removed when removing from deletePodAt.
|
||||
|
|
@ -162,7 +162,7 @@ type state struct {
|
|||
// step describes a state after handling ready work items and how much to move time forward.
|
||||
type step struct {
|
||||
pods []*v1.Pod
|
||||
rules []*resourcealpha.DeviceTaintRule
|
||||
rules []*resourcebeta.DeviceTaintRule
|
||||
ruleStats map[types.UID]taintRuleStats
|
||||
deletePodAt evictMap
|
||||
|
||||
|
|
@ -371,95 +371,95 @@ var (
|
|||
slice.Spec.Pool.Generation++
|
||||
return slice
|
||||
}()
|
||||
ruleEvict = &resourcealpha.DeviceTaintRule{
|
||||
ruleEvict = &resourcebeta.DeviceTaintRule{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "evict",
|
||||
UID: "1234",
|
||||
},
|
||||
|
||||
Spec: resourcealpha.DeviceTaintRuleSpec{
|
||||
DeviceSelector: &resourcealpha.DeviceTaintSelector{
|
||||
Spec: resourcebeta.DeviceTaintRuleSpec{
|
||||
DeviceSelector: &resourcebeta.DeviceTaintSelector{
|
||||
Driver: ptr.To(driver),
|
||||
},
|
||||
Taint: resourcealpha.DeviceTaint{
|
||||
Taint: resourcebeta.DeviceTaint{
|
||||
Key: taint.Key,
|
||||
Value: taint.Value,
|
||||
Effect: resourcealpha.DeviceTaintEffect(taint.Effect),
|
||||
Effect: resourcebeta.DeviceTaintEffect(taint.Effect),
|
||||
TimeAdded: taint.TimeAdded,
|
||||
},
|
||||
},
|
||||
}
|
||||
ruleEvictInstance1 = &resourcealpha.DeviceTaintRule{
|
||||
ruleEvictInstance1 = &resourcebeta.DeviceTaintRule{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "evict-instance",
|
||||
UID: "1234",
|
||||
},
|
||||
|
||||
Spec: resourcealpha.DeviceTaintRuleSpec{
|
||||
DeviceSelector: &resourcealpha.DeviceTaintSelector{
|
||||
Spec: resourcebeta.DeviceTaintRuleSpec{
|
||||
DeviceSelector: &resourcebeta.DeviceTaintSelector{
|
||||
Driver: ptr.To(driver),
|
||||
Device: ptr.To("instance"),
|
||||
},
|
||||
Taint: resourcealpha.DeviceTaint{
|
||||
Taint: resourcebeta.DeviceTaint{
|
||||
Key: taint.Key,
|
||||
Value: taint.Value,
|
||||
Effect: resourcealpha.DeviceTaintEffect(taint.Effect),
|
||||
Effect: resourcebeta.DeviceTaintEffect(taint.Effect),
|
||||
TimeAdded: taintTime,
|
||||
},
|
||||
},
|
||||
}
|
||||
taintTimeLater = metav1Time(taintTime.Add(40 * time.Second))
|
||||
ruleEvictInstance2Later = &resourcealpha.DeviceTaintRule{
|
||||
ruleEvictInstance2Later = &resourcebeta.DeviceTaintRule{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "evict-instance-no-execute",
|
||||
UID: "5678",
|
||||
},
|
||||
|
||||
Spec: resourcealpha.DeviceTaintRuleSpec{
|
||||
DeviceSelector: &resourcealpha.DeviceTaintSelector{
|
||||
Spec: resourcebeta.DeviceTaintRuleSpec{
|
||||
DeviceSelector: &resourcebeta.DeviceTaintSelector{
|
||||
Driver: ptr.To(driver),
|
||||
Device: ptr.To("instance-no-execute"),
|
||||
},
|
||||
Taint: resourcealpha.DeviceTaint{
|
||||
Taint: resourcebeta.DeviceTaint{
|
||||
Key: taint.Key,
|
||||
Value: taint.Value,
|
||||
Effect: resourcealpha.DeviceTaintEffect(taint.Effect),
|
||||
Effect: resourcebeta.DeviceTaintEffect(taint.Effect),
|
||||
TimeAdded: taintTimeLater,
|
||||
},
|
||||
},
|
||||
}
|
||||
ruleNone = &resourcealpha.DeviceTaintRule{
|
||||
ruleNone = &resourcebeta.DeviceTaintRule{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "evict",
|
||||
UID: "1234",
|
||||
},
|
||||
|
||||
Spec: resourcealpha.DeviceTaintRuleSpec{
|
||||
DeviceSelector: &resourcealpha.DeviceTaintSelector{
|
||||
Spec: resourcebeta.DeviceTaintRuleSpec{
|
||||
DeviceSelector: &resourcebeta.DeviceTaintSelector{
|
||||
Driver: ptr.To(driver),
|
||||
},
|
||||
Taint: resourcealpha.DeviceTaint{
|
||||
Taint: resourcebeta.DeviceTaint{
|
||||
Key: taint.Key,
|
||||
Value: taint.Value,
|
||||
Effect: resourcealpha.DeviceTaintEffectNone,
|
||||
Effect: resourcebeta.DeviceTaintEffectNone,
|
||||
TimeAdded: taint.TimeAdded,
|
||||
},
|
||||
},
|
||||
}
|
||||
ruleEvictOther = &resourcealpha.DeviceTaintRule{
|
||||
ruleEvictOther = &resourcebeta.DeviceTaintRule{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "evict-other",
|
||||
UID: "1234-other",
|
||||
},
|
||||
|
||||
Spec: resourcealpha.DeviceTaintRuleSpec{
|
||||
DeviceSelector: &resourcealpha.DeviceTaintSelector{
|
||||
Spec: resourcebeta.DeviceTaintRuleSpec{
|
||||
DeviceSelector: &resourcebeta.DeviceTaintSelector{
|
||||
Device: ptr.To("instance"),
|
||||
},
|
||||
Taint: resourcealpha.DeviceTaint{
|
||||
Taint: resourcebeta.DeviceTaint{
|
||||
Key: taint.Key,
|
||||
Value: taint.Value,
|
||||
Effect: resourcealpha.DeviceTaintEffect(taint.Effect),
|
||||
Effect: resourcebeta.DeviceTaintEffect(taint.Effect),
|
||||
TimeAdded: taint.TimeAdded,
|
||||
},
|
||||
},
|
||||
|
|
@ -672,7 +672,7 @@ func newEvictionTime(when *metav1.Time, args ...any) *evictionAndReason {
|
|||
case *resourceapi.ResourceSlice:
|
||||
reason = append(reason, trackedTaint{slice: sliceDeviceTaint{slice: obj, deviceName: args[i+1].(string), taintIndex: args[i+2].(int)}})
|
||||
i += 3
|
||||
case *resourcealpha.DeviceTaintRule:
|
||||
case *resourcebeta.DeviceTaintRule:
|
||||
reason = append(reason, trackedTaint{rule: obj})
|
||||
i++
|
||||
default:
|
||||
|
|
@ -698,7 +698,7 @@ func newWorkItem(obj metav1.Object) workItem {
|
|||
ref := newObject(obj)
|
||||
var item workItem
|
||||
switch obj.(type) {
|
||||
case *resourcealpha.DeviceTaintRule:
|
||||
case *resourcebeta.DeviceTaintRule:
|
||||
item.ruleRef = ref
|
||||
case *v1.Pod:
|
||||
item.podRef = ref
|
||||
|
|
@ -748,10 +748,10 @@ func listEvents(tCtx ktesting.TContext) []v1.Event {
|
|||
return events.Items
|
||||
}
|
||||
|
||||
func inProgress(rule *resourcealpha.DeviceTaintRule, status bool, reason, message string, when *metav1.Time) *resourcealpha.DeviceTaintRule {
|
||||
func inProgress(rule *resourcebeta.DeviceTaintRule, status bool, reason, message string, when *metav1.Time) *resourcebeta.DeviceTaintRule {
|
||||
rule = rule.DeepCopy()
|
||||
condition := metav1.Condition{
|
||||
Type: resourcealpha.DeviceTaintConditionEvictionInProgress,
|
||||
Type: resourcebeta.DeviceTaintConditionEvictionInProgress,
|
||||
Status: metav1.ConditionFalse,
|
||||
Reason: reason,
|
||||
Message: message,
|
||||
|
|
@ -1955,7 +1955,7 @@ func testHandlers(tContext *testContext, tc testCase) {
|
|||
}
|
||||
return false, nil, nil
|
||||
})
|
||||
ruleStore := tContext.informerFactory.Resource().V1alpha3().DeviceTaintRules().Informer().GetStore()
|
||||
ruleStore := tContext.informerFactory.Resource().V1beta2().DeviceTaintRules().Informer().GetStore()
|
||||
for _, rule := range tc.initialState.rules {
|
||||
tContext.ExpectNoError(ruleStore.Add(rule))
|
||||
tContext.ExpectNoError(tContext.client.Tracker().Add(rule))
|
||||
|
|
@ -2008,7 +2008,7 @@ func testHandlers(tContext *testContext, tc testCase) {
|
|||
pods, err := tContext.client.CoreV1().Pods("").List(tContext, metav1.ListOptions{})
|
||||
tContext.ExpectNoError(err, prefix+"list pods")
|
||||
assertEqual(tContext, state.pods, trimPods(pods.Items), prefix+"pods after flushing work queue")
|
||||
rules, err := tContext.client.ResourceV1alpha3().DeviceTaintRules().List(tContext, metav1.ListOptions{})
|
||||
rules, err := tContext.client.ResourceV1beta2().DeviceTaintRules().List(tContext, metav1.ListOptions{})
|
||||
tContext.ExpectNoError(err, prefix+"list rules")
|
||||
actualRules := trimRules(rules.Items)
|
||||
assertEqual(tContext, state.rules, actualRules, prefix+"rules after flushing work queue")
|
||||
|
|
@ -2077,16 +2077,16 @@ func applyEventPair(tContext *testContext, event any) {
|
|||
tContext.ExpectNoError(tContext.client.Tracker().Add(obj))
|
||||
}
|
||||
tContext.handlePodChange(pair[0], pair[1])
|
||||
case [2]*resourcealpha.DeviceTaintRule:
|
||||
store := tContext.informerFactory.Resource().V1alpha3().DeviceTaintRules().Informer().GetStore()
|
||||
case [2]*resourcebeta.DeviceTaintRule:
|
||||
store := tContext.informerFactory.Resource().V1beta2().DeviceTaintRules().Informer().GetStore()
|
||||
switch {
|
||||
case pair[0] != nil && pair[1] != nil:
|
||||
obj := pair[1].DeepCopy()
|
||||
tContext.ExpectNoError(store.Update(obj))
|
||||
tContext.ExpectNoError(tContext.client.Tracker().Update(resourcealpha.SchemeGroupVersion.WithResource("devicetaintrules"), obj, pair[1].Namespace))
|
||||
tContext.ExpectNoError(tContext.client.Tracker().Update(resourcebeta.SchemeGroupVersion.WithResource("devicetaintrules"), obj, pair[1].Namespace))
|
||||
case pair[0] != nil:
|
||||
tContext.ExpectNoError(store.Delete(pair[0]))
|
||||
tContext.ExpectNoError(tContext.client.Tracker().Delete(resourcealpha.SchemeGroupVersion.WithResource("devicetaintrules"), pair[0].Namespace, pair[0].Name))
|
||||
tContext.ExpectNoError(tContext.client.Tracker().Delete(resourcebeta.SchemeGroupVersion.WithResource("devicetaintrules"), pair[0].Namespace, pair[0].Name))
|
||||
default:
|
||||
obj := pair[1].DeepCopy()
|
||||
tContext.ExpectNoError(store.Add(obj))
|
||||
|
|
@ -2107,7 +2107,7 @@ func trimPods(objs []v1.Pod) (trimmed []*v1.Pod) {
|
|||
return trimmed
|
||||
}
|
||||
|
||||
func trimRules(objs []resourcealpha.DeviceTaintRule) (trimmed []*resourcealpha.DeviceTaintRule) {
|
||||
func trimRules(objs []resourcebeta.DeviceTaintRule) (trimmed []*resourcebeta.DeviceTaintRule) {
|
||||
for _, in := range objs {
|
||||
out := in.DeepCopy()
|
||||
out.ManagedFields = nil
|
||||
|
|
@ -2124,7 +2124,7 @@ func newTestController(tCtx ktesting.TContext) *Controller {
|
|||
informerFactory.Core().V1().Pods(),
|
||||
informerFactory.Resource().V1().ResourceClaims(),
|
||||
informerFactory.Resource().V1().ResourceSlices(),
|
||||
informerFactory.Resource().V1alpha3().DeviceTaintRules(),
|
||||
informerFactory.Resource().V1beta2().DeviceTaintRules(),
|
||||
informerFactory.Resource().V1().DeviceClasses(),
|
||||
"device-taint-eviction",
|
||||
)
|
||||
|
|
@ -2436,11 +2436,11 @@ func synctestDeviceTaintRule(tCtx ktesting.TContext, toleration, slowDelete bool
|
|||
time.Sleep(20 * time.Second)
|
||||
updated := metav1.Now()
|
||||
rule = rule.DeepCopy() // fake.NewClientset does not copy! Perhaps it should?!
|
||||
rule.Spec.Taint.Effect = resourcealpha.DeviceTaintEffectNoExecute
|
||||
rule.Spec.Taint.Effect = resourcebeta.DeviceTaintEffectNoExecute
|
||||
// The real apiserver is going to bump this automatically in 1.36,
|
||||
// but in a unit test we have to do it manually.
|
||||
rule.Spec.Taint.TimeAdded = &updated
|
||||
rule, err := tCtx.Client().ResourceV1alpha3().DeviceTaintRules().Update(tCtx, rule, metav1.UpdateOptions{})
|
||||
rule, err := tCtx.Client().ResourceV1beta2().DeviceTaintRules().Update(tCtx, rule, metav1.UpdateOptions{})
|
||||
tCtx.ExpectNoError(err, "update rule")
|
||||
|
||||
// Wait for eviction.
|
||||
|
|
@ -2480,7 +2480,7 @@ func synctestDeviceTaintRule(tCtx ktesting.TContext, toleration, slowDelete bool
|
|||
assertEqual(tCtx, map[types.UID]taintRuleStats{rule.UID: {numEvictedPods: 1}}, controller.taintRuleStats, "taint rule statistics should have counted the pod")
|
||||
|
||||
// Delete the rule and verify that we don't leak memory by still tracking it.
|
||||
err = tCtx.Client().ResourceV1alpha3().DeviceTaintRules().Delete(tCtx, rule.Name, metav1.DeleteOptions{})
|
||||
err = tCtx.Client().ResourceV1beta2().DeviceTaintRules().Delete(tCtx, rule.Name, metav1.DeleteOptions{})
|
||||
tCtx.ExpectNoError(err, "delete rule")
|
||||
tCtx.Wait()
|
||||
deleted := metav1.Now()
|
||||
|
|
@ -2492,7 +2492,7 @@ func synctestDeviceTaintRule(tCtx ktesting.TContext, toleration, slowDelete bool
|
|||
tCtx.ExpectNoError(testPodDeletionsMetrics(controller, slowDeleteDelay))
|
||||
}
|
||||
|
||||
func check(tCtx ktesting.TContext, prefix string, expectRules []*resourcealpha.DeviceTaintRule, expectPods []*v1.Pod) {
|
||||
func check(tCtx ktesting.TContext, prefix string, expectRules []*resourcebeta.DeviceTaintRule, expectPods []*v1.Pod) {
|
||||
tCtx.Helper()
|
||||
|
||||
opts := []cmp.Option{
|
||||
|
|
@ -2507,7 +2507,7 @@ func check(tCtx ktesting.TContext, prefix string, expectRules []*resourcealpha.D
|
|||
actualPods, err := tCtx.Client().CoreV1().Pods("").List(tCtx, metav1.ListOptions{})
|
||||
tCtx.ExpectNoError(err, prefix+"list pods")
|
||||
assertEqual(tCtx, expectPods, trimPods(actualPods.Items), prefix+"pods", opts...)
|
||||
rules, err := tCtx.Client().ResourceV1alpha3().DeviceTaintRules().List(tCtx, metav1.ListOptions{})
|
||||
rules, err := tCtx.Client().ResourceV1beta2().DeviceTaintRules().List(tCtx, metav1.ListOptions{})
|
||||
tCtx.ExpectNoError(err, prefix+"list rules")
|
||||
assertEqual(tCtx, expectRules, trimRules(rules.Items), prefix+"rules", opts...)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1261,10 +1261,12 @@ var defaultVersionedKubernetesFeatureGates = map[featuregate.Feature]featuregate
|
|||
|
||||
DRADeviceTaintRules: {
|
||||
{Version: version.MustParse("1.35"), Default: false, PreRelease: featuregate.Alpha},
|
||||
{Version: version.MustParse("1.36"), Default: false, PreRelease: featuregate.Beta}, // Depends on an off-by-default beta API.
|
||||
},
|
||||
|
||||
DRADeviceTaints: {
|
||||
{Version: version.MustParse("1.33"), Default: false, PreRelease: featuregate.Alpha},
|
||||
{Version: version.MustParse("1.36"), Default: true, PreRelease: featuregate.Beta},
|
||||
},
|
||||
|
||||
DRAExtendedResource: {
|
||||
|
|
|
|||
233
pkg/generated/openapi/zz_generated.openapi.go
generated
233
pkg/generated/openapi/zz_generated.openapi.go
generated
|
|
@ -1109,6 +1109,11 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA
|
|||
resourcev1beta2.DeviceSelector{}.OpenAPIModelName(): schema_k8sio_api_resource_v1beta2_DeviceSelector(ref),
|
||||
resourcev1beta2.DeviceSubRequest{}.OpenAPIModelName(): schema_k8sio_api_resource_v1beta2_DeviceSubRequest(ref),
|
||||
resourcev1beta2.DeviceTaint{}.OpenAPIModelName(): schema_k8sio_api_resource_v1beta2_DeviceTaint(ref),
|
||||
resourcev1beta2.DeviceTaintRule{}.OpenAPIModelName(): schema_k8sio_api_resource_v1beta2_DeviceTaintRule(ref),
|
||||
resourcev1beta2.DeviceTaintRuleList{}.OpenAPIModelName(): schema_k8sio_api_resource_v1beta2_DeviceTaintRuleList(ref),
|
||||
resourcev1beta2.DeviceTaintRuleSpec{}.OpenAPIModelName(): schema_k8sio_api_resource_v1beta2_DeviceTaintRuleSpec(ref),
|
||||
resourcev1beta2.DeviceTaintRuleStatus{}.OpenAPIModelName(): schema_k8sio_api_resource_v1beta2_DeviceTaintRuleStatus(ref),
|
||||
resourcev1beta2.DeviceTaintSelector{}.OpenAPIModelName(): schema_k8sio_api_resource_v1beta2_DeviceTaintSelector(ref),
|
||||
resourcev1beta2.DeviceToleration{}.OpenAPIModelName(): schema_k8sio_api_resource_v1beta2_DeviceToleration(ref),
|
||||
resourcev1beta2.ExactDeviceRequest{}.OpenAPIModelName(): schema_k8sio_api_resource_v1beta2_ExactDeviceRequest(ref),
|
||||
resourcev1beta2.NetworkDeviceData{}.OpenAPIModelName(): schema_k8sio_api_resource_v1beta2_NetworkDeviceData(ref),
|
||||
|
|
@ -47110,7 +47115,7 @@ func schema_k8sio_api_resource_v1_Device(ref common.ReferenceCallback) common.Op
|
|||
},
|
||||
},
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "If specified, these are the driver-defined taints.\n\nThe maximum number of taints is 16. If taints are set for any device in a ResourceSlice, then the maximum number of allowed devices per ResourceSlice is 64 instead of 128.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.",
|
||||
Description: "If specified, these are the driver-defined taints.\n\nThe maximum number of taints is 16. If taints are set for any device in a ResourceSlice, then the maximum number of allowed devices per ResourceSlice is 64 instead of 128.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.",
|
||||
Type: []string{"array"},
|
||||
Items: &spec.SchemaOrArray{
|
||||
Schema: &spec.Schema{
|
||||
|
|
@ -47856,7 +47861,7 @@ func schema_k8sio_api_resource_v1_DeviceRequestAllocationResult(ref common.Refer
|
|||
},
|
||||
},
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "A copy of all tolerations specified in the request at the time when the device got allocated.\n\nThe maximum number of tolerations is 16.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.",
|
||||
Description: "A copy of all tolerations specified in the request at the time when the device got allocated.\n\nThe maximum number of tolerations is 16.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.",
|
||||
Type: []string{"array"},
|
||||
Items: &spec.SchemaOrArray{
|
||||
Schema: &spec.Schema{
|
||||
|
|
@ -48023,7 +48028,7 @@ func schema_k8sio_api_resource_v1_DeviceSubRequest(ref common.ReferenceCallback)
|
|||
},
|
||||
},
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.",
|
||||
Description: "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.",
|
||||
Type: []string{"array"},
|
||||
Items: &spec.SchemaOrArray{
|
||||
Schema: &spec.Schema{
|
||||
|
|
@ -48210,7 +48215,7 @@ func schema_k8sio_api_resource_v1_ExactDeviceRequest(ref common.ReferenceCallbac
|
|||
},
|
||||
},
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.",
|
||||
Description: "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.",
|
||||
Type: []string{"array"},
|
||||
Items: &spec.SchemaOrArray{
|
||||
Schema: &spec.Schema{
|
||||
|
|
@ -49398,7 +49403,7 @@ func schema_k8sio_api_resource_v1beta1_BasicDevice(ref common.ReferenceCallback)
|
|||
},
|
||||
},
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "If specified, these are the driver-defined taints.\n\nThe maximum number of taints is 16. If taints are set for any device in a ResourceSlice, then the maximum number of allowed devices per ResourceSlice is 64 instead of 128.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.",
|
||||
Description: "If specified, these are the driver-defined taints.\n\nThe maximum number of taints is 16. If taints are set for any device in a ResourceSlice, then the maximum number of allowed devices per ResourceSlice is 64 instead of 128.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.",
|
||||
Type: []string{"array"},
|
||||
Items: &spec.SchemaOrArray{
|
||||
Schema: &spec.Schema{
|
||||
|
|
@ -50352,7 +50357,7 @@ func schema_k8sio_api_resource_v1beta1_DeviceRequest(ref common.ReferenceCallbac
|
|||
},
|
||||
},
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis field can only be set when deviceClassName is set and no subrequests are specified in the firstAvailable list.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.",
|
||||
Description: "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis field can only be set when deviceClassName is set and no subrequests are specified in the firstAvailable list.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.",
|
||||
Type: []string{"array"},
|
||||
Items: &spec.SchemaOrArray{
|
||||
Schema: &spec.Schema{
|
||||
|
|
@ -50432,7 +50437,7 @@ func schema_k8sio_api_resource_v1beta1_DeviceRequestAllocationResult(ref common.
|
|||
},
|
||||
},
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "A copy of all tolerations specified in the request at the time when the device got allocated.\n\nThe maximum number of tolerations is 16.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.",
|
||||
Description: "A copy of all tolerations specified in the request at the time when the device got allocated.\n\nThe maximum number of tolerations is 16.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.",
|
||||
Type: []string{"array"},
|
||||
Items: &spec.SchemaOrArray{
|
||||
Schema: &spec.Schema{
|
||||
|
|
@ -50599,7 +50604,7 @@ func schema_k8sio_api_resource_v1beta1_DeviceSubRequest(ref common.ReferenceCall
|
|||
},
|
||||
},
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.",
|
||||
Description: "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.",
|
||||
Type: []string{"array"},
|
||||
Items: &spec.SchemaOrArray{
|
||||
Schema: &spec.Schema{
|
||||
|
|
@ -51790,7 +51795,7 @@ func schema_k8sio_api_resource_v1beta2_Device(ref common.ReferenceCallback) comm
|
|||
},
|
||||
},
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "If specified, these are the driver-defined taints.\n\nThe maximum number of taints is 16. If taints are set for any device in a ResourceSlice, then the maximum number of allowed devices per ResourceSlice is 64 instead of 128.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.",
|
||||
Description: "If specified, these are the driver-defined taints.\n\nThe maximum number of taints is 16. If taints are set for any device in a ResourceSlice, then the maximum number of allowed devices per ResourceSlice is 64 instead of 128.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.",
|
||||
Type: []string{"array"},
|
||||
Items: &spec.SchemaOrArray{
|
||||
Schema: &spec.Schema{
|
||||
|
|
@ -52536,7 +52541,7 @@ func schema_k8sio_api_resource_v1beta2_DeviceRequestAllocationResult(ref common.
|
|||
},
|
||||
},
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "A copy of all tolerations specified in the request at the time when the device got allocated.\n\nThe maximum number of tolerations is 16.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.",
|
||||
Description: "A copy of all tolerations specified in the request at the time when the device got allocated.\n\nThe maximum number of tolerations is 16.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.",
|
||||
Type: []string{"array"},
|
||||
Items: &spec.SchemaOrArray{
|
||||
Schema: &spec.Schema{
|
||||
|
|
@ -52703,7 +52708,7 @@ func schema_k8sio_api_resource_v1beta2_DeviceSubRequest(ref common.ReferenceCall
|
|||
},
|
||||
},
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.",
|
||||
Description: "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.",
|
||||
Type: []string{"array"},
|
||||
Items: &spec.SchemaOrArray{
|
||||
Schema: &spec.Schema{
|
||||
|
|
@ -52776,6 +52781,210 @@ func schema_k8sio_api_resource_v1beta2_DeviceTaint(ref common.ReferenceCallback)
|
|||
}
|
||||
}
|
||||
|
||||
func schema_k8sio_api_resource_v1beta2_DeviceTaintRule(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "DeviceTaintRule adds one taint to all devices which match the selector. This has the same effect as if the taint was specified directly in the ResourceSlice by the DRA driver.",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"kind": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"apiVersion": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"metadata": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Standard object metadata",
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref(metav1.ObjectMeta{}.OpenAPIModelName()),
|
||||
},
|
||||
},
|
||||
"spec": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Spec specifies the selector and one taint.\n\nChanging the spec automatically increments the metadata.generation number.",
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref(resourcev1beta2.DeviceTaintRuleSpec{}.OpenAPIModelName()),
|
||||
},
|
||||
},
|
||||
"status": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Status provides information about what was requested in the spec.",
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref(resourcev1beta2.DeviceTaintRuleStatus{}.OpenAPIModelName()),
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"spec"},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
resourcev1beta2.DeviceTaintRuleSpec{}.OpenAPIModelName(), resourcev1beta2.DeviceTaintRuleStatus{}.OpenAPIModelName(), metav1.ObjectMeta{}.OpenAPIModelName()},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_k8sio_api_resource_v1beta2_DeviceTaintRuleList(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "DeviceTaintRuleList is a collection of DeviceTaintRules.",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"kind": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"apiVersion": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"metadata": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Standard list metadata",
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref(metav1.ListMeta{}.OpenAPIModelName()),
|
||||
},
|
||||
},
|
||||
"items": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Items is the list of DeviceTaintRules.",
|
||||
Type: []string{"array"},
|
||||
Items: &spec.SchemaOrArray{
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref(resourcev1beta2.DeviceTaintRule{}.OpenAPIModelName()),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"items"},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
resourcev1beta2.DeviceTaintRule{}.OpenAPIModelName(), metav1.ListMeta{}.OpenAPIModelName()},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_k8sio_api_resource_v1beta2_DeviceTaintRuleSpec(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "DeviceTaintRuleSpec specifies the selector and one taint.",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"deviceSelector": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "DeviceSelector defines which device(s) the taint is applied to. All selector criteria must be satisfied for a device to match. The empty selector matches all devices. Without a selector, no devices are matches.",
|
||||
Ref: ref(resourcev1beta2.DeviceTaintSelector{}.OpenAPIModelName()),
|
||||
},
|
||||
},
|
||||
"taint": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "The taint that gets applied to matching devices.",
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref(resourcev1beta2.DeviceTaint{}.OpenAPIModelName()),
|
||||
},
|
||||
},
|
||||
},
|
||||
Required: []string{"taint"},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
resourcev1beta2.DeviceTaint{}.OpenAPIModelName(), resourcev1beta2.DeviceTaintSelector{}.OpenAPIModelName()},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_k8sio_api_resource_v1beta2_DeviceTaintRuleStatus(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "DeviceTaintRuleStatus provides information about an on-going pod eviction.",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"conditions": {
|
||||
VendorExtensible: spec.VendorExtensible{
|
||||
Extensions: spec.Extensions{
|
||||
"x-kubernetes-list-map-keys": []interface{}{
|
||||
"type",
|
||||
},
|
||||
"x-kubernetes-list-type": "map",
|
||||
"x-kubernetes-patch-merge-key": "type",
|
||||
"x-kubernetes-patch-strategy": "merge",
|
||||
},
|
||||
},
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "Conditions provide information about the state of the DeviceTaintRule and the cluster at some point in time, in a machine-readable and human-readable format.\n\nThe following condition is currently defined as part of this API, more may get added: - Type: EvictionInProgress - Status: True if there are currently pods which need to be evicted, False otherwise\n (includes the effects which don't cause eviction).\n- Reason: not specified, may change - Message: includes information about number of pending pods and already evicted pods\n in a human-readable format, updated periodically, may change\n\nFor `effect: None`, the condition above gets set once for each change to the spec, with the message containing information about what would happen if the effect was `NoExecute`. This feedback can be used to decide whether changing the effect to `NoExecute` will work as intended. It only gets set once to avoid having to constantly update the status.\n\nMust have 8 or fewer entries.",
|
||||
Type: []string{"array"},
|
||||
Items: &spec.SchemaOrArray{
|
||||
Schema: &spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Default: map[string]interface{}{},
|
||||
Ref: ref(metav1.Condition{}.OpenAPIModelName()),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
Dependencies: []string{
|
||||
metav1.Condition{}.OpenAPIModelName()},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_k8sio_api_resource_v1beta2_DeviceTaintSelector(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "DeviceTaintSelector defines which device(s) a DeviceTaintRule applies to. The empty selector matches all devices. Without a selector, no devices are matched.",
|
||||
Type: []string{"object"},
|
||||
Properties: map[string]spec.Schema{
|
||||
"driver": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "If driver is set, only devices from that driver are selected. This fields corresponds to slice.spec.driver.",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"pool": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "If pool is set, only devices in that pool are selected.\n\nAlso setting the driver name may be useful to avoid ambiguity when different drivers use the same pool name, but this is not required because selecting pools from different drivers may also be useful, for example when drivers with node-local devices use the node name as their pool name.",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
"device": {
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "If device is set, only devices with that name are selected. This field corresponds to slice.spec.devices[].name.\n\nSetting also driver and pool may be required to avoid ambiguity, but is not required.",
|
||||
Type: []string{"string"},
|
||||
Format: "",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func schema_k8sio_api_resource_v1beta2_DeviceToleration(ref common.ReferenceCallback) common.OpenAPIDefinition {
|
||||
return common.OpenAPIDefinition{
|
||||
Schema: spec.Schema{
|
||||
|
|
@ -52890,7 +53099,7 @@ func schema_k8sio_api_resource_v1beta2_ExactDeviceRequest(ref common.ReferenceCa
|
|||
},
|
||||
},
|
||||
SchemaProps: spec.SchemaProps{
|
||||
Description: "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.",
|
||||
Description: "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.",
|
||||
Type: []string{"array"},
|
||||
Items: &spec.SchemaOrArray{
|
||||
Schema: &spec.Schema{
|
||||
|
|
|
|||
|
|
@ -54,6 +54,9 @@ func (*deviceTaintRuleStrategy) GetResetFields() map[fieldpath.APIVersion]*field
|
|||
"resource.k8s.io/v1alpha3": fieldpath.NewSet(
|
||||
fieldpath.MakePathOrDie("status"),
|
||||
),
|
||||
"resource.k8s.io/v1beta2": fieldpath.NewSet(
|
||||
fieldpath.MakePathOrDie("status"),
|
||||
),
|
||||
}
|
||||
|
||||
return fields
|
||||
|
|
@ -134,6 +137,10 @@ func (*deviceTaintRuleStatusStrategy) GetResetFields() map[fieldpath.APIVersion]
|
|||
fieldpath.MakePathOrDie("metadata"),
|
||||
fieldpath.MakePathOrDie("spec"),
|
||||
),
|
||||
"resource.k8s.io/v1beta2": fieldpath.NewSet(
|
||||
fieldpath.MakePathOrDie("metadata"),
|
||||
fieldpath.MakePathOrDie("spec"),
|
||||
),
|
||||
}
|
||||
|
||||
return fields
|
||||
|
|
|
|||
|
|
@ -179,6 +179,15 @@ func (p RESTStorageProvider) v1beta2Storage(apiResourceConfigSource serverstorag
|
|||
storage[resource] = deviceclassStorage
|
||||
}
|
||||
|
||||
if resource := "devicetaintrules"; apiResourceConfigSource.ResourceEnabled(resourcev1beta2.SchemeGroupVersion.WithResource(resource)) {
|
||||
deviceTaintRuleStorage, deviceTaintRuleStatusStorage, err := devicetaintrulestore.NewREST(restOptionsGetter)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
storage[resource] = deviceTaintRuleStorage
|
||||
storage[resource+"/status"] = deviceTaintRuleStatusStorage
|
||||
}
|
||||
|
||||
if resource := "resourceclaims"; apiResourceConfigSource.ResourceEnabled(resourcev1beta2.SchemeGroupVersion.WithResource(resource)) {
|
||||
resourceClaimStorage, resourceClaimStatusStorage, err := resourceclaimstore.NewREST(restOptionsGetter, nsClient)
|
||||
if err != nil {
|
||||
|
|
|
|||
|
|
@ -96,6 +96,22 @@ items:
|
|||
- kind: ServiceAccount
|
||||
name: deployment-controller
|
||||
namespace: kube-system
|
||||
- apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
annotations:
|
||||
rbac.authorization.kubernetes.io/autoupdate: "true"
|
||||
labels:
|
||||
kubernetes.io/bootstrapping: rbac-defaults
|
||||
name: system:controller:device-taint-eviction-controller
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: system:controller:device-taint-eviction-controller
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: device-taint-eviction-controller
|
||||
namespace: kube-system
|
||||
- apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
|
|
|
|||
|
|
@ -352,6 +352,64 @@ items:
|
|||
- create
|
||||
- patch
|
||||
- update
|
||||
- apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
annotations:
|
||||
rbac.authorization.kubernetes.io/autoupdate: "true"
|
||||
labels:
|
||||
kubernetes.io/bootstrapping: rbac-defaults
|
||||
name: system:controller:device-taint-eviction-controller
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- pods
|
||||
verbs:
|
||||
- delete
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- pods/status
|
||||
verbs:
|
||||
- patch
|
||||
- update
|
||||
- apiGroups:
|
||||
- resource.k8s.io
|
||||
resources:
|
||||
- resourceclaims
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- resource.k8s.io
|
||||
resources:
|
||||
- resourceslices
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- resource.k8s.io
|
||||
resources:
|
||||
- deviceclasses
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- ""
|
||||
- events.k8s.io
|
||||
resources:
|
||||
- events
|
||||
verbs:
|
||||
- create
|
||||
- patch
|
||||
- update
|
||||
- apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
|
|
|
|||
|
|
@ -405,7 +405,7 @@ message Device {
|
|||
// any device in a ResourceSlice, then the maximum number of
|
||||
// allowed devices per ResourceSlice is 64 instead of 128.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
//
|
||||
// +optional
|
||||
|
|
@ -918,7 +918,7 @@ message DeviceRequestAllocationResult {
|
|||
//
|
||||
// The maximum number of tolerations is 16.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
//
|
||||
// +optional
|
||||
|
|
@ -1077,7 +1077,7 @@ message DeviceSubRequest {
|
|||
//
|
||||
// The maximum number of tolerations is 16.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
//
|
||||
// +optional
|
||||
|
|
@ -1282,7 +1282,7 @@ message ExactDeviceRequest {
|
|||
//
|
||||
// The maximum number of tolerations is 16.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
//
|
||||
// +optional
|
||||
|
|
|
|||
|
|
@ -366,7 +366,7 @@ type Device struct {
|
|||
// any device in a ResourceSlice, then the maximum number of
|
||||
// allowed devices per ResourceSlice is 64 instead of 128.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
//
|
||||
// +optional
|
||||
|
|
@ -974,7 +974,7 @@ type ExactDeviceRequest struct {
|
|||
//
|
||||
// The maximum number of tolerations is 16.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
//
|
||||
// +optional
|
||||
|
|
@ -1091,7 +1091,7 @@ type DeviceSubRequest struct {
|
|||
//
|
||||
// The maximum number of tolerations is 16.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
//
|
||||
// +optional
|
||||
|
|
@ -1655,7 +1655,7 @@ type DeviceRequestAllocationResult struct {
|
|||
//
|
||||
// The maximum number of tolerations is 16.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
//
|
||||
// +optional
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ var map_Device = map[string]string{
|
|||
"nodeName": "NodeName identifies the node where the device is available.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.",
|
||||
"nodeSelector": "NodeSelector defines the nodes where the device is available.\n\nMust use exactly one term.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.",
|
||||
"allNodes": "AllNodes indicates that all nodes have access to the device.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.",
|
||||
"taints": "If specified, these are the driver-defined taints.\n\nThe maximum number of taints is 16. If taints are set for any device in a ResourceSlice, then the maximum number of allowed devices per ResourceSlice is 64 instead of 128.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"taints": "If specified, these are the driver-defined taints.\n\nThe maximum number of taints is 16. If taints are set for any device in a ResourceSlice, then the maximum number of allowed devices per ResourceSlice is 64 instead of 128.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"bindsToNode": "BindsToNode indicates if the usage of an allocation involving this device has to be limited to exactly the node that was chosen when allocating the claim. If set to true, the scheduler will set the ResourceClaim.Status.Allocation.NodeSelector to match the node where the allocation was made.\n\nThis is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.",
|
||||
"bindingConditions": "BindingConditions defines the conditions for proceeding with binding. All of these conditions must be set in the per-device status conditions with a value of True to proceed with binding the pod to the node while scheduling the pod.\n\nThe maximum number of binding conditions is 4.\n\nThe conditions must be a valid condition type string.\n\nThis is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.",
|
||||
"bindingFailureConditions": "BindingFailureConditions defines the conditions for binding failure. They may be set in the per-device status conditions. If any is set to \"True\", a binding failure occurred.\n\nThe maximum number of binding failure conditions is 4.\n\nThe conditions must be a valid condition type string.\n\nThis is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.",
|
||||
|
|
@ -281,7 +281,7 @@ var map_DeviceRequestAllocationResult = map[string]string{
|
|||
"pool": "This name together with the driver name and the device name field identify which device was allocated (`<driver name>/<pool name>/<device name>`).\n\nMust not be longer than 253 characters and may contain one or more DNS sub-domains separated by slashes.",
|
||||
"device": "Device references one device instance via its name in the driver's resource pool. It must be a DNS label.",
|
||||
"adminAccess": "AdminAccess indicates that this device was allocated for administrative access. See the corresponding request field for a definition of mode.\n\nAdmin access is disabled if this field is unset or set to false, otherwise it is enabled.",
|
||||
"tolerations": "A copy of all tolerations specified in the request at the time when the device got allocated.\n\nThe maximum number of tolerations is 16.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"tolerations": "A copy of all tolerations specified in the request at the time when the device got allocated.\n\nThe maximum number of tolerations is 16.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"bindingConditions": "BindingConditions contains a copy of the BindingConditions from the corresponding ResourceSlice at the time of allocation.\n\nThis is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.",
|
||||
"bindingFailureConditions": "BindingFailureConditions contains a copy of the BindingFailureConditions from the corresponding ResourceSlice at the time of allocation.\n\nThis is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.",
|
||||
"shareID": "ShareID uniquely identifies an individual allocation share of the device, used when the device supports multiple simultaneous allocations. It serves as an additional map key to differentiate concurrent shares of the same device.",
|
||||
|
|
@ -308,7 +308,7 @@ var map_DeviceSubRequest = map[string]string{
|
|||
"selectors": "Selectors define criteria which must be satisfied by a specific device in order for that device to be considered for this subrequest. All selectors must be satisfied for a device to be considered.",
|
||||
"allocationMode": "AllocationMode and its related fields define how devices are allocated to satisfy this subrequest. Supported values are:\n\n- ExactCount: This request is for a specific number of devices.\n This is the default. The exact number is provided in the\n count field.\n\n- All: This subrequest is for all of the matching devices in a pool.\n Allocation will fail if some devices are already allocated,\n unless adminAccess is requested.\n\nIf AllocationMode is not specified, the default mode is ExactCount. If the mode is ExactCount and count is not specified, the default count is one. Any other subrequests must specify this field.\n\nMore modes may get added in the future. Clients must refuse to handle requests with unknown modes.",
|
||||
"count": "Count is used only when the count mode is \"ExactCount\". Must be greater than zero. If AllocationMode is ExactCount and this field is not specified, the default is one.",
|
||||
"tolerations": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"tolerations": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"capacity": "Capacity define resource requirements against each capacity.\n\nIf this field is unset and the device supports multiple allocations, the default value will be applied to each capacity according to requestPolicy. For the capacity that has no requestPolicy, default is the full capacity value.\n\nApplies to each device allocation. If Count > 1, the request fails if there aren't enough devices that meet the requirements. If AllocationMode is set to All, the request fails if there are devices that otherwise match the request, and have this capacity, with a value >= the requested amount, but which cannot be allocated to this request.",
|
||||
}
|
||||
|
||||
|
|
@ -348,7 +348,7 @@ var map_ExactDeviceRequest = map[string]string{
|
|||
"allocationMode": "AllocationMode and its related fields define how devices are allocated to satisfy this request. Supported values are:\n\n- ExactCount: This request is for a specific number of devices.\n This is the default. The exact number is provided in the\n count field.\n\n- All: This request is for all of the matching devices in a pool.\n At least one device must exist on the node for the allocation to succeed.\n Allocation will fail if some devices are already allocated,\n unless adminAccess is requested.\n\nIf AllocationMode is not specified, the default mode is ExactCount. If the mode is ExactCount and count is not specified, the default count is one. Any other requests must specify this field.\n\nMore modes may get added in the future. Clients must refuse to handle requests with unknown modes.",
|
||||
"count": "Count is used only when the count mode is \"ExactCount\". Must be greater than zero. If AllocationMode is ExactCount and this field is not specified, the default is one.",
|
||||
"adminAccess": "AdminAccess indicates that this is a claim for administrative access to the device(s). Claims with AdminAccess are expected to be used for monitoring or other management services for a device. They ignore all ordinary claims to the device with respect to access modes and any resource allocations.\n\nAdmin access is disabled if this field is unset or set to false, otherwise it is enabled.",
|
||||
"tolerations": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"tolerations": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"capacity": "Capacity define resource requirements against each capacity.\n\nIf this field is unset and the device supports multiple allocations, the default value will be applied to each capacity according to requestPolicy. For the capacity that has no requestPolicy, default is the full capacity value.\n\nApplies to each device allocation. If Count > 1, the request fails if there aren't enough devices that meet the requirements. If AllocationMode is set to All, the request fails if there are devices that otherwise match the request, and have this capacity, with a value >= the requested amount, but which cannot be allocated to this request.",
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -120,6 +120,7 @@ message DeviceTaint {
|
|||
// Consumers must treat unknown effects like None.
|
||||
//
|
||||
// +required
|
||||
// +k8s:required
|
||||
optional string effect = 3;
|
||||
|
||||
// TimeAdded represents the time at which the taint was added or
|
||||
|
|
|
|||
|
|
@ -140,6 +140,7 @@ type DeviceTaint struct {
|
|||
// Consumers must treat unknown effects like None.
|
||||
//
|
||||
// +required
|
||||
// +k8s:required
|
||||
Effect DeviceTaintEffect `json:"effect" protobuf:"bytes,3,name=effect,casttype=DeviceTaintEffect"`
|
||||
|
||||
// ^^^^
|
||||
|
|
@ -178,6 +179,7 @@ type DeviceTaint struct {
|
|||
}
|
||||
|
||||
// +enum
|
||||
// +k8s:enum
|
||||
type DeviceTaintEffect string
|
||||
|
||||
const (
|
||||
|
|
|
|||
|
|
@ -193,7 +193,7 @@ message BasicDevice {
|
|||
// any device in a ResourceSlice, then the maximum number of
|
||||
// allowed devices per ResourceSlice is 64 instead of 128.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
//
|
||||
// +optional
|
||||
|
|
@ -960,7 +960,7 @@ message DeviceRequest {
|
|||
// This field can only be set when deviceClassName is set and no subrequests
|
||||
// are specified in the firstAvailable list.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
//
|
||||
// +optional
|
||||
|
|
@ -1047,7 +1047,7 @@ message DeviceRequestAllocationResult {
|
|||
//
|
||||
// The maximum number of tolerations is 16.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
//
|
||||
// +optional
|
||||
|
|
@ -1208,7 +1208,7 @@ message DeviceSubRequest {
|
|||
//
|
||||
// The maximum number of tolerations is 16.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
//
|
||||
// +optional
|
||||
|
|
|
|||
|
|
@ -386,7 +386,7 @@ type BasicDevice struct {
|
|||
// any device in a ResourceSlice, then the maximum number of
|
||||
// allowed devices per ResourceSlice is 64 instead of 128.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
//
|
||||
// +optional
|
||||
|
|
@ -992,7 +992,7 @@ type DeviceRequest struct {
|
|||
// This field can only be set when deviceClassName is set and no subrequests
|
||||
// are specified in the firstAvailable list.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
//
|
||||
// +optional
|
||||
|
|
@ -1110,7 +1110,7 @@ type DeviceSubRequest struct {
|
|||
//
|
||||
// The maximum number of tolerations is 16.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
//
|
||||
// +optional
|
||||
|
|
@ -1675,7 +1675,7 @@ type DeviceRequestAllocationResult struct {
|
|||
//
|
||||
// The maximum number of tolerations is 16.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
//
|
||||
// +optional
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ var map_BasicDevice = map[string]string{
|
|||
"nodeName": "NodeName identifies the node where the device is available.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.",
|
||||
"nodeSelector": "NodeSelector defines the nodes where the device is available.\n\nMust use exactly one term.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.",
|
||||
"allNodes": "AllNodes indicates that all nodes have access to the device.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.",
|
||||
"taints": "If specified, these are the driver-defined taints.\n\nThe maximum number of taints is 16. If taints are set for any device in a ResourceSlice, then the maximum number of allowed devices per ResourceSlice is 64 instead of 128.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"taints": "If specified, these are the driver-defined taints.\n\nThe maximum number of taints is 16. If taints are set for any device in a ResourceSlice, then the maximum number of allowed devices per ResourceSlice is 64 instead of 128.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"bindsToNode": "BindsToNode indicates if the usage of an allocation involving this device has to be limited to exactly the node that was chosen when allocating the claim. If set to true, the scheduler will set the ResourceClaim.Status.Allocation.NodeSelector to match the node where the allocation was made.\n\nThis is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.",
|
||||
"bindingConditions": "BindingConditions defines the conditions for proceeding with binding. All of these conditions must be set in the per-device status conditions with a value of True to proceed with binding the pod to the node while scheduling the pod.\n\nThe maximum number of binding conditions is 4.\n\nThe conditions must be a valid condition type string.\n\nThis is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.",
|
||||
"bindingFailureConditions": "BindingFailureConditions defines the conditions for binding failure. They may be set in the per-device status conditions. If any is true, a binding failure occurred.\n\nThe maximum number of binding failure conditions is 4.\n\nThe conditions must be a valid condition type string.\n\nThis is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.",
|
||||
|
|
@ -281,7 +281,7 @@ var map_DeviceRequest = map[string]string{
|
|||
"count": "Count is used only when the count mode is \"ExactCount\". Must be greater than zero. If AllocationMode is ExactCount and this field is not specified, the default is one.\n\nThis field can only be set when deviceClassName is set and no subrequests are specified in the firstAvailable list.",
|
||||
"adminAccess": "AdminAccess indicates that this is a claim for administrative access to the device(s). Claims with AdminAccess are expected to be used for monitoring or other management services for a device. They ignore all ordinary claims to the device with respect to access modes and any resource allocations.\n\nThis field can only be set when deviceClassName is set and no subrequests are specified in the firstAvailable list.\n\nThis is an alpha field and requires enabling the DRAAdminAccess feature gate. Admin access is disabled if this field is unset or set to false, otherwise it is enabled.",
|
||||
"firstAvailable": "FirstAvailable contains subrequests, of which exactly one will be satisfied by the scheduler to satisfy this request. It tries to satisfy them in the order in which they are listed here. So if there are two entries in the list, the scheduler will only check the second one if it determines that the first one cannot be used.\n\nThis field may only be set in the entries of DeviceClaim.Requests.\n\nDRA does not yet implement scoring, so the scheduler will select the first set of devices that satisfies all the requests in the claim. And if the requirements can be satisfied on more than one node, other scheduling features will determine which node is chosen. This means that the set of devices allocated to a claim might not be the optimal set available to the cluster. Scoring will be implemented later.",
|
||||
"tolerations": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis field can only be set when deviceClassName is set and no subrequests are specified in the firstAvailable list.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"tolerations": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis field can only be set when deviceClassName is set and no subrequests are specified in the firstAvailable list.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"capacity": "Capacity define resource requirements against each capacity.\n\nIf this field is unset and the device supports multiple allocations, the default value will be applied to each capacity according to requestPolicy. For the capacity that has no requestPolicy, default is the full capacity value.\n\nApplies to each device allocation. If Count > 1, the request fails if there aren't enough devices that meet the requirements. If AllocationMode is set to All, the request fails if there are devices that otherwise match the request, and have this capacity, with a value >= the requested amount, but which cannot be allocated to this request.",
|
||||
}
|
||||
|
||||
|
|
@ -296,7 +296,7 @@ var map_DeviceRequestAllocationResult = map[string]string{
|
|||
"pool": "This name together with the driver name and the device name field identify which device was allocated (`<driver name>/<pool name>/<device name>`).\n\nMust not be longer than 253 characters and may contain one or more DNS sub-domains separated by slashes.",
|
||||
"device": "Device references one device instance via its name in the driver's resource pool. It must be a DNS label.",
|
||||
"adminAccess": "AdminAccess indicates that this device was allocated for administrative access. See the corresponding request field for a definition of mode.\n\nThis is an alpha field and requires enabling the DRAAdminAccess feature gate. Admin access is disabled if this field is unset or set to false, otherwise it is enabled.",
|
||||
"tolerations": "A copy of all tolerations specified in the request at the time when the device got allocated.\n\nThe maximum number of tolerations is 16.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"tolerations": "A copy of all tolerations specified in the request at the time when the device got allocated.\n\nThe maximum number of tolerations is 16.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"bindingConditions": "BindingConditions contains a copy of the BindingConditions from the corresponding ResourceSlice at the time of allocation.\n\nThis is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.",
|
||||
"bindingFailureConditions": "BindingFailureConditions contains a copy of the BindingFailureConditions from the corresponding ResourceSlice at the time of allocation.\n\nThis is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.",
|
||||
"shareID": "ShareID uniquely identifies an individual allocation share of the device, used when the device supports multiple simultaneous allocations. It serves as an additional map key to differentiate concurrent shares of the same device.",
|
||||
|
|
@ -323,7 +323,7 @@ var map_DeviceSubRequest = map[string]string{
|
|||
"selectors": "Selectors define criteria which must be satisfied by a specific device in order for that device to be considered for this subrequest. All selectors must be satisfied for a device to be considered.",
|
||||
"allocationMode": "AllocationMode and its related fields define how devices are allocated to satisfy this subrequest. Supported values are:\n\n- ExactCount: This request is for a specific number of devices.\n This is the default. The exact number is provided in the\n count field.\n\n- All: This subrequest is for all of the matching devices in a pool.\n Allocation will fail if some devices are already allocated,\n unless adminAccess is requested.\n\nIf AllocationMode is not specified, the default mode is ExactCount. If the mode is ExactCount and count is not specified, the default count is one. Any other subrequests must specify this field.\n\nMore modes may get added in the future. Clients must refuse to handle requests with unknown modes.",
|
||||
"count": "Count is used only when the count mode is \"ExactCount\". Must be greater than zero. If AllocationMode is ExactCount and this field is not specified, the default is one.",
|
||||
"tolerations": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"tolerations": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"capacity": "Capacity define resource requirements against each capacity.\n\nIf this field is unset and the device supports multiple allocations, the default value will be applied to each capacity according to requestPolicy. For the capacity that has no requestPolicy, default is the full capacity value.\n\nApplies to each device allocation. If Count > 1, the request fails if there aren't enough devices that meet the requirements. If AllocationMode is set to All, the request fails if there are devices that otherwise match the request, and have this capacity, with a value >= the requested amount, but which cannot be allocated to this request.",
|
||||
}
|
||||
|
||||
|
|
|
|||
1003
staging/src/k8s.io/api/resource/v1beta2/generated.pb.go
generated
1003
staging/src/k8s.io/api/resource/v1beta2/generated.pb.go
generated
File diff suppressed because it is too large
Load diff
|
|
@ -405,7 +405,7 @@ message Device {
|
|||
// any device in a ResourceSlice, then the maximum number of
|
||||
// allowed devices per ResourceSlice is 64 instead of 128.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
//
|
||||
// +optional
|
||||
|
|
@ -922,7 +922,7 @@ message DeviceRequestAllocationResult {
|
|||
//
|
||||
// The maximum number of tolerations is 16.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
//
|
||||
// +optional
|
||||
|
|
@ -1081,7 +1081,7 @@ message DeviceSubRequest {
|
|||
//
|
||||
// The maximum number of tolerations is 16.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
//
|
||||
// +optional
|
||||
|
|
@ -1153,6 +1153,115 @@ message DeviceTaint {
|
|||
optional .k8s.io.apimachinery.pkg.apis.meta.v1.Time timeAdded = 4;
|
||||
}
|
||||
|
||||
// DeviceTaintRule adds one taint to all devices which match the selector.
|
||||
// This has the same effect as if the taint was specified directly
|
||||
// in the ResourceSlice by the DRA driver.
|
||||
message DeviceTaintRule {
|
||||
// Standard object metadata
|
||||
// +optional
|
||||
optional .k8s.io.apimachinery.pkg.apis.meta.v1.ObjectMeta metadata = 1;
|
||||
|
||||
// Spec specifies the selector and one taint.
|
||||
//
|
||||
// Changing the spec automatically increments the metadata.generation number.
|
||||
// +required
|
||||
optional DeviceTaintRuleSpec spec = 2;
|
||||
|
||||
// Status provides information about what was requested in the spec.
|
||||
//
|
||||
// +optional
|
||||
optional DeviceTaintRuleStatus status = 3;
|
||||
}
|
||||
|
||||
// DeviceTaintRuleList is a collection of DeviceTaintRules.
|
||||
message DeviceTaintRuleList {
|
||||
// Standard list metadata
|
||||
// +optional
|
||||
optional .k8s.io.apimachinery.pkg.apis.meta.v1.ListMeta metadata = 1;
|
||||
|
||||
// Items is the list of DeviceTaintRules.
|
||||
repeated DeviceTaintRule items = 2;
|
||||
}
|
||||
|
||||
// DeviceTaintRuleSpec specifies the selector and one taint.
|
||||
message DeviceTaintRuleSpec {
|
||||
// DeviceSelector defines which device(s) the taint is applied to.
|
||||
// All selector criteria must be satisfied for a device to
|
||||
// match. The empty selector matches all devices. Without
|
||||
// a selector, no devices are matches.
|
||||
//
|
||||
// +optional
|
||||
optional DeviceTaintSelector deviceSelector = 1;
|
||||
|
||||
// The taint that gets applied to matching devices.
|
||||
//
|
||||
// +required
|
||||
optional DeviceTaint taint = 2;
|
||||
}
|
||||
|
||||
// DeviceTaintRuleStatus provides information about an on-going pod eviction.
|
||||
message DeviceTaintRuleStatus {
|
||||
// Conditions provide information about the state of the DeviceTaintRule
|
||||
// and the cluster at some point in time,
|
||||
// in a machine-readable and human-readable format.
|
||||
//
|
||||
// The following condition is currently defined as part of this API, more may
|
||||
// get added:
|
||||
// - Type: EvictionInProgress
|
||||
// - Status: True if there are currently pods which need to be evicted, False otherwise
|
||||
// (includes the effects which don't cause eviction).
|
||||
// - Reason: not specified, may change
|
||||
// - Message: includes information about number of pending pods and already evicted pods
|
||||
// in a human-readable format, updated periodically, may change
|
||||
//
|
||||
// For `effect: None`, the condition above gets set once for each change to
|
||||
// the spec, with the message containing information about what would happen
|
||||
// if the effect was `NoExecute`. This feedback can be used to decide whether
|
||||
// changing the effect to `NoExecute` will work as intended. It only gets
|
||||
// set once to avoid having to constantly update the status.
|
||||
//
|
||||
// Must have 8 or fewer entries.
|
||||
//
|
||||
// +optional
|
||||
// +listType=map
|
||||
// +listMapKey=type
|
||||
// +patchStrategy=merge
|
||||
// +patchMergeKey=type
|
||||
repeated .k8s.io.apimachinery.pkg.apis.meta.v1.Condition conditions = 1;
|
||||
}
|
||||
|
||||
// DeviceTaintSelector defines which device(s) a DeviceTaintRule applies to.
|
||||
// The empty selector matches all devices. Without a selector, no devices
|
||||
// are matched.
|
||||
message DeviceTaintSelector {
|
||||
// If driver is set, only devices from that driver are selected.
|
||||
// This fields corresponds to slice.spec.driver.
|
||||
//
|
||||
// +optional
|
||||
optional string driver = 2;
|
||||
|
||||
// If pool is set, only devices in that pool are selected.
|
||||
//
|
||||
// Also setting the driver name may be useful to avoid
|
||||
// ambiguity when different drivers use the same pool name,
|
||||
// but this is not required because selecting pools from
|
||||
// different drivers may also be useful, for example when
|
||||
// drivers with node-local devices use the node name as
|
||||
// their pool name.
|
||||
//
|
||||
// +optional
|
||||
optional string pool = 3;
|
||||
|
||||
// If device is set, only devices with that name are selected.
|
||||
// This field corresponds to slice.spec.devices[].name.
|
||||
//
|
||||
// Setting also driver and pool may be required to avoid ambiguity,
|
||||
// but is not required.
|
||||
//
|
||||
// +optional
|
||||
optional string device = 4;
|
||||
}
|
||||
|
||||
// The ResourceClaim this DeviceToleration is attached to tolerates any taint that matches
|
||||
// the triple <key,value,effect> using the matching operator <operator>.
|
||||
message DeviceToleration {
|
||||
|
|
@ -1287,7 +1396,7 @@ message ExactDeviceRequest {
|
|||
//
|
||||
// The maximum number of tolerations is 16.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
//
|
||||
// +optional
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
|
|||
scheme.AddKnownTypes(SchemeGroupVersion,
|
||||
&DeviceClass{},
|
||||
&DeviceClassList{},
|
||||
&DeviceTaintRule{},
|
||||
&DeviceTaintRuleList{},
|
||||
&ResourceClaim{},
|
||||
&ResourceClaimList{},
|
||||
&ResourceClaimTemplate{},
|
||||
|
|
|
|||
|
|
@ -369,7 +369,7 @@ type Device struct {
|
|||
// any device in a ResourceSlice, then the maximum number of
|
||||
// allowed devices per ResourceSlice is 64 instead of 128.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
//
|
||||
// +optional
|
||||
|
|
@ -728,6 +728,156 @@ const (
|
|||
DeviceTaintEffectNoExecute DeviceTaintEffect = "NoExecute"
|
||||
)
|
||||
|
||||
// +genclient
|
||||
// +genclient:nonNamespaced
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +k8s:prerelease-lifecycle-gen:introduced=1.36
|
||||
|
||||
// DeviceTaintRule adds one taint to all devices which match the selector.
|
||||
// This has the same effect as if the taint was specified directly
|
||||
// in the ResourceSlice by the DRA driver.
|
||||
type DeviceTaintRule struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// Standard object metadata
|
||||
// +optional
|
||||
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
|
||||
// Spec specifies the selector and one taint.
|
||||
//
|
||||
// Changing the spec automatically increments the metadata.generation number.
|
||||
// +required
|
||||
Spec DeviceTaintRuleSpec `json:"spec" protobuf:"bytes,2,name=spec"`
|
||||
|
||||
// Status provides information about what was requested in the spec.
|
||||
//
|
||||
// +optional
|
||||
Status DeviceTaintRuleStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
|
||||
}
|
||||
|
||||
// DeviceTaintRuleSpec specifies the selector and one taint.
|
||||
type DeviceTaintRuleSpec struct {
|
||||
// DeviceSelector defines which device(s) the taint is applied to.
|
||||
// All selector criteria must be satisfied for a device to
|
||||
// match. The empty selector matches all devices. Without
|
||||
// a selector, no devices are matches.
|
||||
//
|
||||
// +optional
|
||||
DeviceSelector *DeviceTaintSelector `json:"deviceSelector,omitempty" protobuf:"bytes,1,opt,name=deviceSelector"`
|
||||
|
||||
// The taint that gets applied to matching devices.
|
||||
//
|
||||
// +required
|
||||
Taint DeviceTaint `json:"taint,omitempty" protobuf:"bytes,2,rep,name=taint"`
|
||||
}
|
||||
|
||||
// DeviceTaintSelector defines which device(s) a DeviceTaintRule applies to.
|
||||
// The empty selector matches all devices. Without a selector, no devices
|
||||
// are matched.
|
||||
type DeviceTaintSelector struct {
|
||||
// If DeviceClassName is set, the selectors defined there must be
|
||||
// satisfied by a device to be selected. This field corresponds
|
||||
// to class.metadata.name.
|
||||
//
|
||||
// +optional
|
||||
//
|
||||
// Tombstoned since 1.35 because it turned out that supporting this in all cases
|
||||
// would depend on copying the device attributes into the ResourceClaim allocation
|
||||
// result. Without that the eviction controller cannot evaluate these CEL expressions.
|
||||
//
|
||||
// DeviceClassName *string `json:"deviceClassName,omitempty" protobuf:"bytes,1,opt,name=deviceClassName"`
|
||||
|
||||
// If driver is set, only devices from that driver are selected.
|
||||
// This fields corresponds to slice.spec.driver.
|
||||
//
|
||||
// +optional
|
||||
Driver *string `json:"driver,omitempty" protobuf:"bytes,2,opt,name=driver"`
|
||||
|
||||
// If pool is set, only devices in that pool are selected.
|
||||
//
|
||||
// Also setting the driver name may be useful to avoid
|
||||
// ambiguity when different drivers use the same pool name,
|
||||
// but this is not required because selecting pools from
|
||||
// different drivers may also be useful, for example when
|
||||
// drivers with node-local devices use the node name as
|
||||
// their pool name.
|
||||
//
|
||||
// +optional
|
||||
Pool *string `json:"pool,omitempty" protobuf:"bytes,3,opt,name=pool"`
|
||||
|
||||
// If device is set, only devices with that name are selected.
|
||||
// This field corresponds to slice.spec.devices[].name.
|
||||
//
|
||||
// Setting also driver and pool may be required to avoid ambiguity,
|
||||
// but is not required.
|
||||
//
|
||||
// +optional
|
||||
Device *string `json:"device,omitempty" protobuf:"bytes,4,opt,name=device"`
|
||||
|
||||
// Selectors contains the same selection criteria as a ResourceClaim.
|
||||
// Currently, CEL expressions are supported. All of these selectors
|
||||
// must be satisfied.
|
||||
//
|
||||
// +optional
|
||||
// +listType=atomic
|
||||
//
|
||||
// Tombstoned since 1.35 because it turned out that supporting this in all cases
|
||||
// would depend on copying the device attributes into the ResourceClaim allocation
|
||||
// result. Without that the eviction controller cannot evaluate these CEL expressions.
|
||||
//
|
||||
// Selectors []DeviceSelector `json:"selectors,omitempty" protobuf:"bytes,5,rep,name=selectors"`
|
||||
}
|
||||
|
||||
// DeviceTaintRuleStatus provides information about an on-going pod eviction.
|
||||
type DeviceTaintRuleStatus struct {
|
||||
// Conditions provide information about the state of the DeviceTaintRule
|
||||
// and the cluster at some point in time,
|
||||
// in a machine-readable and human-readable format.
|
||||
//
|
||||
// The following condition is currently defined as part of this API, more may
|
||||
// get added:
|
||||
// - Type: EvictionInProgress
|
||||
// - Status: True if there are currently pods which need to be evicted, False otherwise
|
||||
// (includes the effects which don't cause eviction).
|
||||
// - Reason: not specified, may change
|
||||
// - Message: includes information about number of pending pods and already evicted pods
|
||||
// in a human-readable format, updated periodically, may change
|
||||
//
|
||||
// For `effect: None`, the condition above gets set once for each change to
|
||||
// the spec, with the message containing information about what would happen
|
||||
// if the effect was `NoExecute`. This feedback can be used to decide whether
|
||||
// changing the effect to `NoExecute` will work as intended. It only gets
|
||||
// set once to avoid having to constantly update the status.
|
||||
//
|
||||
// Must have 8 or fewer entries.
|
||||
//
|
||||
// +optional
|
||||
// +listType=map
|
||||
// +listMapKey=type
|
||||
// +patchStrategy=merge
|
||||
// +patchMergeKey=type
|
||||
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
|
||||
}
|
||||
|
||||
// DeviceTaintRuleStatusMaxConditions is the maximum number of conditions in DeviceTaintRuleStatus.
|
||||
const DeviceTaintRuleStatusMaxConditions = 8
|
||||
|
||||
// DeviceTaintConditionEvictionInProgress is the publicly documented condition type for the DeviceTaintRuleStatus.
|
||||
const DeviceTaintConditionEvictionInProgress = "EvictionInProgress"
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +k8s:prerelease-lifecycle-gen:introduced=1.36
|
||||
|
||||
// DeviceTaintRuleList is a collection of DeviceTaintRules.
|
||||
type DeviceTaintRuleList struct {
|
||||
metav1.TypeMeta `json:",inline"`
|
||||
// Standard list metadata
|
||||
// +optional
|
||||
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
|
||||
|
||||
// Items is the list of DeviceTaintRules.
|
||||
Items []DeviceTaintRule `json:"items" protobuf:"bytes,2,rep,name=items"`
|
||||
}
|
||||
|
||||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
|
||||
// +k8s:prerelease-lifecycle-gen:introduced=1.33
|
||||
|
||||
|
|
@ -981,7 +1131,7 @@ type ExactDeviceRequest struct {
|
|||
//
|
||||
// The maximum number of tolerations is 16.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
//
|
||||
// +optional
|
||||
|
|
@ -1098,7 +1248,7 @@ type DeviceSubRequest struct {
|
|||
//
|
||||
// The maximum number of tolerations is 16.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
//
|
||||
// +optional
|
||||
|
|
@ -1663,7 +1813,7 @@ type DeviceRequestAllocationResult struct {
|
|||
//
|
||||
// The maximum number of tolerations is 16.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
//
|
||||
// +optional
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ var map_Device = map[string]string{
|
|||
"nodeName": "NodeName identifies the node where the device is available.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.",
|
||||
"nodeSelector": "NodeSelector defines the nodes where the device is available.\n\nMust use exactly one term.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.",
|
||||
"allNodes": "AllNodes indicates that all nodes have access to the device.\n\nMust only be set if Spec.PerDeviceNodeSelection is set to true. At most one of NodeName, NodeSelector and AllNodes can be set.",
|
||||
"taints": "If specified, these are the driver-defined taints.\n\nThe maximum number of taints is 16. If taints are set for any device in a ResourceSlice, then the maximum number of allowed devices per ResourceSlice is 64 instead of 128.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"taints": "If specified, these are the driver-defined taints.\n\nThe maximum number of taints is 16. If taints are set for any device in a ResourceSlice, then the maximum number of allowed devices per ResourceSlice is 64 instead of 128.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"bindsToNode": "BindsToNode indicates if the usage of an allocation involving this device has to be limited to exactly the node that was chosen when allocating the claim. If set to true, the scheduler will set the ResourceClaim.Status.Allocation.NodeSelector to match the node where the allocation was made.\n\nThis is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.",
|
||||
"bindingConditions": "BindingConditions defines the conditions for proceeding with binding. All of these conditions must be set in the per-device status conditions with a value of True to proceed with binding the pod to the node while scheduling the pod.\n\nThe maximum number of binding conditions is 4.\n\nThe conditions must be a valid condition type string.\n\nThis is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.",
|
||||
"bindingFailureConditions": "BindingFailureConditions defines the conditions for binding failure. They may be set in the per-device status conditions. If any is set to \"True\", a binding failure occurred.\n\nThe maximum number of binding failure conditions is 4.\n\nThe conditions must be a valid condition type string.\n\nThis is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.",
|
||||
|
|
@ -281,7 +281,7 @@ var map_DeviceRequestAllocationResult = map[string]string{
|
|||
"pool": "This name together with the driver name and the device name field identify which device was allocated (`<driver name>/<pool name>/<device name>`).\n\nMust not be longer than 253 characters and may contain one or more DNS sub-domains separated by slashes.",
|
||||
"device": "Device references one device instance via its name in the driver's resource pool. It must be a DNS label.",
|
||||
"adminAccess": "AdminAccess indicates that this device was allocated for administrative access. See the corresponding request field for a definition of mode.\n\nThis is an alpha field and requires enabling the DRAAdminAccess feature gate. Admin access is disabled if this field is unset or set to false, otherwise it is enabled.",
|
||||
"tolerations": "A copy of all tolerations specified in the request at the time when the device got allocated.\n\nThe maximum number of tolerations is 16.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"tolerations": "A copy of all tolerations specified in the request at the time when the device got allocated.\n\nThe maximum number of tolerations is 16.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"bindingConditions": "BindingConditions contains a copy of the BindingConditions from the corresponding ResourceSlice at the time of allocation.\n\nThis is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.",
|
||||
"bindingFailureConditions": "BindingFailureConditions contains a copy of the BindingFailureConditions from the corresponding ResourceSlice at the time of allocation.\n\nThis is an alpha field and requires enabling the DRADeviceBindingConditions and DRAResourceClaimDeviceStatus feature gates.",
|
||||
"shareID": "ShareID uniquely identifies an individual allocation share of the device, used when the device supports multiple simultaneous allocations. It serves as an additional map key to differentiate concurrent shares of the same device.",
|
||||
|
|
@ -308,7 +308,7 @@ var map_DeviceSubRequest = map[string]string{
|
|||
"selectors": "Selectors define criteria which must be satisfied by a specific device in order for that device to be considered for this subrequest. All selectors must be satisfied for a device to be considered.",
|
||||
"allocationMode": "AllocationMode and its related fields define how devices are allocated to satisfy this subrequest. Supported values are:\n\n- ExactCount: This request is for a specific number of devices.\n This is the default. The exact number is provided in the\n count field.\n\n- All: This subrequest is for all of the matching devices in a pool.\n Allocation will fail if some devices are already allocated,\n unless adminAccess is requested.\n\nIf AllocationMode is not specified, the default mode is ExactCount. If the mode is ExactCount and count is not specified, the default count is one. Any other subrequests must specify this field.\n\nMore modes may get added in the future. Clients must refuse to handle requests with unknown modes.",
|
||||
"count": "Count is used only when the count mode is \"ExactCount\". Must be greater than zero. If AllocationMode is ExactCount and this field is not specified, the default is one.",
|
||||
"tolerations": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"tolerations": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"capacity": "Capacity define resource requirements against each capacity.\n\nIf this field is unset and the device supports multiple allocations, the default value will be applied to each capacity according to requestPolicy. For the capacity that has no requestPolicy, default is the full capacity value.\n\nApplies to each device allocation. If Count > 1, the request fails if there aren't enough devices that meet the requirements. If AllocationMode is set to All, the request fails if there are devices that otherwise match the request, and have this capacity, with a value >= the requested amount, but which cannot be allocated to this request.",
|
||||
}
|
||||
|
||||
|
|
@ -328,6 +328,57 @@ func (DeviceTaint) SwaggerDoc() map[string]string {
|
|||
return map_DeviceTaint
|
||||
}
|
||||
|
||||
var map_DeviceTaintRule = map[string]string{
|
||||
"": "DeviceTaintRule adds one taint to all devices which match the selector. This has the same effect as if the taint was specified directly in the ResourceSlice by the DRA driver.",
|
||||
"metadata": "Standard object metadata",
|
||||
"spec": "Spec specifies the selector and one taint.\n\nChanging the spec automatically increments the metadata.generation number.",
|
||||
"status": "Status provides information about what was requested in the spec.",
|
||||
}
|
||||
|
||||
func (DeviceTaintRule) SwaggerDoc() map[string]string {
|
||||
return map_DeviceTaintRule
|
||||
}
|
||||
|
||||
var map_DeviceTaintRuleList = map[string]string{
|
||||
"": "DeviceTaintRuleList is a collection of DeviceTaintRules.",
|
||||
"metadata": "Standard list metadata",
|
||||
"items": "Items is the list of DeviceTaintRules.",
|
||||
}
|
||||
|
||||
func (DeviceTaintRuleList) SwaggerDoc() map[string]string {
|
||||
return map_DeviceTaintRuleList
|
||||
}
|
||||
|
||||
var map_DeviceTaintRuleSpec = map[string]string{
|
||||
"": "DeviceTaintRuleSpec specifies the selector and one taint.",
|
||||
"deviceSelector": "DeviceSelector defines which device(s) the taint is applied to. All selector criteria must be satisfied for a device to match. The empty selector matches all devices. Without a selector, no devices are matches.",
|
||||
"taint": "The taint that gets applied to matching devices.",
|
||||
}
|
||||
|
||||
func (DeviceTaintRuleSpec) SwaggerDoc() map[string]string {
|
||||
return map_DeviceTaintRuleSpec
|
||||
}
|
||||
|
||||
var map_DeviceTaintRuleStatus = map[string]string{
|
||||
"": "DeviceTaintRuleStatus provides information about an on-going pod eviction.",
|
||||
"conditions": "Conditions provide information about the state of the DeviceTaintRule and the cluster at some point in time, in a machine-readable and human-readable format.\n\nThe following condition is currently defined as part of this API, more may get added: - Type: EvictionInProgress - Status: True if there are currently pods which need to be evicted, False otherwise\n (includes the effects which don't cause eviction).\n- Reason: not specified, may change - Message: includes information about number of pending pods and already evicted pods\n in a human-readable format, updated periodically, may change\n\nFor `effect: None`, the condition above gets set once for each change to the spec, with the message containing information about what would happen if the effect was `NoExecute`. This feedback can be used to decide whether changing the effect to `NoExecute` will work as intended. It only gets set once to avoid having to constantly update the status.\n\nMust have 8 or fewer entries.",
|
||||
}
|
||||
|
||||
func (DeviceTaintRuleStatus) SwaggerDoc() map[string]string {
|
||||
return map_DeviceTaintRuleStatus
|
||||
}
|
||||
|
||||
var map_DeviceTaintSelector = map[string]string{
|
||||
"": "DeviceTaintSelector defines which device(s) a DeviceTaintRule applies to. The empty selector matches all devices. Without a selector, no devices are matched.",
|
||||
"driver": "If driver is set, only devices from that driver are selected. This fields corresponds to slice.spec.driver.",
|
||||
"pool": "If pool is set, only devices in that pool are selected.\n\nAlso setting the driver name may be useful to avoid ambiguity when different drivers use the same pool name, but this is not required because selecting pools from different drivers may also be useful, for example when drivers with node-local devices use the node name as their pool name.",
|
||||
"device": "If device is set, only devices with that name are selected. This field corresponds to slice.spec.devices[].name.\n\nSetting also driver and pool may be required to avoid ambiguity, but is not required.",
|
||||
}
|
||||
|
||||
func (DeviceTaintSelector) SwaggerDoc() map[string]string {
|
||||
return map_DeviceTaintSelector
|
||||
}
|
||||
|
||||
var map_DeviceToleration = map[string]string{
|
||||
"": "The ResourceClaim this DeviceToleration is attached to tolerates any taint that matches the triple <key,value,effect> using the matching operator <operator>.",
|
||||
"key": "Key is the taint key that the toleration applies to. Empty means match all taint keys. If the key is empty, operator must be Exists; this combination means to match all values and all keys. Must be a label name.",
|
||||
|
|
@ -348,7 +399,7 @@ var map_ExactDeviceRequest = map[string]string{
|
|||
"allocationMode": "AllocationMode and its related fields define how devices are allocated to satisfy this request. Supported values are:\n\n- ExactCount: This request is for a specific number of devices.\n This is the default. The exact number is provided in the\n count field.\n\n- All: This request is for all of the matching devices in a pool.\n At least one device must exist on the node for the allocation to succeed.\n Allocation will fail if some devices are already allocated,\n unless adminAccess is requested.\n\nIf AllocationMode is not specified, the default mode is ExactCount. If the mode is ExactCount and count is not specified, the default count is one. Any other requests must specify this field.\n\nMore modes may get added in the future. Clients must refuse to handle requests with unknown modes.",
|
||||
"count": "Count is used only when the count mode is \"ExactCount\". Must be greater than zero. If AllocationMode is ExactCount and this field is not specified, the default is one.",
|
||||
"adminAccess": "AdminAccess indicates that this is a claim for administrative access to the device(s). Claims with AdminAccess are expected to be used for monitoring or other management services for a device. They ignore all ordinary claims to the device with respect to access modes and any resource allocations.\n\nThis is an alpha field and requires enabling the DRAAdminAccess feature gate. Admin access is disabled if this field is unset or set to false, otherwise it is enabled.",
|
||||
"tolerations": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is an alpha field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"tolerations": "If specified, the request's tolerations.\n\nTolerations for NoSchedule are required to allocate a device which has a taint with that effect. The same applies to NoExecute.\n\nIn addition, should any of the allocated devices get tainted with NoExecute after allocation and that effect is not tolerated, then all pods consuming the ResourceClaim get deleted to evict them. The scheduler will not let new pods reserve the claim while it has these tainted devices. Once all pods are evicted, the claim will get deallocated.\n\nThe maximum number of tolerations is 16.\n\nThis is a beta field and requires enabling the DRADeviceTaints feature gate.",
|
||||
"capacity": "Capacity define resource requirements against each capacity.\n\nIf this field is unset and the device supports multiple allocations, the default value will be applied to each capacity according to requestPolicy. For the capacity that has no requestPolicy, default is the full capacity value.\n\nApplies to each device allocation. If Count > 1, the request fails if there aren't enough devices that meet the requirements. If AllocationMode is set to All, the request fails if there are devices that otherwise match the request, and have this capacity, with a value >= the requested amount, but which cannot be allocated to this request.",
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -825,6 +825,143 @@ func (in *DeviceTaint) DeepCopy() *DeviceTaint {
|
|||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DeviceTaintRule) DeepCopyInto(out *DeviceTaintRule) {
|
||||
*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 DeviceTaintRule.
|
||||
func (in *DeviceTaintRule) DeepCopy() *DeviceTaintRule {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DeviceTaintRule)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *DeviceTaintRule) 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 *DeviceTaintRuleList) DeepCopyInto(out *DeviceTaintRuleList) {
|
||||
*out = *in
|
||||
out.TypeMeta = in.TypeMeta
|
||||
in.ListMeta.DeepCopyInto(&out.ListMeta)
|
||||
if in.Items != nil {
|
||||
in, out := &in.Items, &out.Items
|
||||
*out = make([]DeviceTaintRule, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeviceTaintRuleList.
|
||||
func (in *DeviceTaintRuleList) DeepCopy() *DeviceTaintRuleList {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DeviceTaintRuleList)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
|
||||
func (in *DeviceTaintRuleList) 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 *DeviceTaintRuleSpec) DeepCopyInto(out *DeviceTaintRuleSpec) {
|
||||
*out = *in
|
||||
if in.DeviceSelector != nil {
|
||||
in, out := &in.DeviceSelector, &out.DeviceSelector
|
||||
*out = new(DeviceTaintSelector)
|
||||
(*in).DeepCopyInto(*out)
|
||||
}
|
||||
in.Taint.DeepCopyInto(&out.Taint)
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeviceTaintRuleSpec.
|
||||
func (in *DeviceTaintRuleSpec) DeepCopy() *DeviceTaintRuleSpec {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DeviceTaintRuleSpec)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DeviceTaintRuleStatus) DeepCopyInto(out *DeviceTaintRuleStatus) {
|
||||
*out = *in
|
||||
if in.Conditions != nil {
|
||||
in, out := &in.Conditions, &out.Conditions
|
||||
*out = make([]v1.Condition, len(*in))
|
||||
for i := range *in {
|
||||
(*in)[i].DeepCopyInto(&(*out)[i])
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeviceTaintRuleStatus.
|
||||
func (in *DeviceTaintRuleStatus) DeepCopy() *DeviceTaintRuleStatus {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DeviceTaintRuleStatus)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DeviceTaintSelector) DeepCopyInto(out *DeviceTaintSelector) {
|
||||
*out = *in
|
||||
if in.Driver != nil {
|
||||
in, out := &in.Driver, &out.Driver
|
||||
*out = new(string)
|
||||
**out = **in
|
||||
}
|
||||
if in.Pool != nil {
|
||||
in, out := &in.Pool, &out.Pool
|
||||
*out = new(string)
|
||||
**out = **in
|
||||
}
|
||||
if in.Device != nil {
|
||||
in, out := &in.Device, &out.Device
|
||||
*out = new(string)
|
||||
**out = **in
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeviceTaintSelector.
|
||||
func (in *DeviceTaintSelector) DeepCopy() *DeviceTaintSelector {
|
||||
if in == nil {
|
||||
return nil
|
||||
}
|
||||
out := new(DeviceTaintSelector)
|
||||
in.DeepCopyInto(out)
|
||||
return out
|
||||
}
|
||||
|
||||
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
|
||||
func (in *DeviceToleration) DeepCopyInto(out *DeviceToleration) {
|
||||
*out = *in
|
||||
|
|
|
|||
|
|
@ -156,6 +156,31 @@ func (in DeviceTaint) OpenAPIModelName() string {
|
|||
return "io.k8s.api.resource.v1beta2.DeviceTaint"
|
||||
}
|
||||
|
||||
// OpenAPIModelName returns the OpenAPI model name for this type.
|
||||
func (in DeviceTaintRule) OpenAPIModelName() string {
|
||||
return "io.k8s.api.resource.v1beta2.DeviceTaintRule"
|
||||
}
|
||||
|
||||
// OpenAPIModelName returns the OpenAPI model name for this type.
|
||||
func (in DeviceTaintRuleList) OpenAPIModelName() string {
|
||||
return "io.k8s.api.resource.v1beta2.DeviceTaintRuleList"
|
||||
}
|
||||
|
||||
// OpenAPIModelName returns the OpenAPI model name for this type.
|
||||
func (in DeviceTaintRuleSpec) OpenAPIModelName() string {
|
||||
return "io.k8s.api.resource.v1beta2.DeviceTaintRuleSpec"
|
||||
}
|
||||
|
||||
// OpenAPIModelName returns the OpenAPI model name for this type.
|
||||
func (in DeviceTaintRuleStatus) OpenAPIModelName() string {
|
||||
return "io.k8s.api.resource.v1beta2.DeviceTaintRuleStatus"
|
||||
}
|
||||
|
||||
// OpenAPIModelName returns the OpenAPI model name for this type.
|
||||
func (in DeviceTaintSelector) OpenAPIModelName() string {
|
||||
return "io.k8s.api.resource.v1beta2.DeviceTaintSelector"
|
||||
}
|
||||
|
||||
// OpenAPIModelName returns the OpenAPI model name for this type.
|
||||
func (in DeviceToleration) OpenAPIModelName() string {
|
||||
return "io.k8s.api.resource.v1beta2.DeviceToleration"
|
||||
|
|
|
|||
|
|
@ -57,6 +57,42 @@ func (in *DeviceClassList) APILifecycleRemoved() (major, minor int) {
|
|||
return 1, 39
|
||||
}
|
||||
|
||||
// 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 *DeviceTaintRule) APILifecycleIntroduced() (major, minor int) {
|
||||
return 1, 36
|
||||
}
|
||||
|
||||
// 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 *DeviceTaintRule) APILifecycleDeprecated() (major, minor int) {
|
||||
return 1, 39
|
||||
}
|
||||
|
||||
// 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 *DeviceTaintRule) APILifecycleRemoved() (major, minor int) {
|
||||
return 1, 42
|
||||
}
|
||||
|
||||
// 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 *DeviceTaintRuleList) APILifecycleIntroduced() (major, minor int) {
|
||||
return 1, 36
|
||||
}
|
||||
|
||||
// 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 *DeviceTaintRuleList) APILifecycleDeprecated() (major, minor int) {
|
||||
return 1, 39
|
||||
}
|
||||
|
||||
// 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 *DeviceTaintRuleList) APILifecycleRemoved() (major, minor int) {
|
||||
return 1, 42
|
||||
}
|
||||
|
||||
// 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 *ResourceClaim) APILifecycleIntroduced() (major, minor int) {
|
||||
|
|
|
|||
71
staging/src/k8s.io/api/testdata/HEAD/resource.k8s.io.v1beta2.DeviceTaintRule.json
vendored
Normal file
71
staging/src/k8s.io/api/testdata/HEAD/resource.k8s.io.v1beta2.DeviceTaintRule.json
vendored
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
{
|
||||
"kind": "DeviceTaintRule",
|
||||
"apiVersion": "resource.k8s.io/v1beta2",
|
||||
"metadata": {
|
||||
"name": "nameValue",
|
||||
"generateName": "generateNameValue",
|
||||
"namespace": "namespaceValue",
|
||||
"selfLink": "selfLinkValue",
|
||||
"uid": "uidValue",
|
||||
"resourceVersion": "resourceVersionValue",
|
||||
"generation": 7,
|
||||
"creationTimestamp": "2008-01-01T01:01:01Z",
|
||||
"deletionTimestamp": "2009-01-01T01:01:01Z",
|
||||
"deletionGracePeriodSeconds": 10,
|
||||
"labels": {
|
||||
"labelsKey": "labelsValue"
|
||||
},
|
||||
"annotations": {
|
||||
"annotationsKey": "annotationsValue"
|
||||
},
|
||||
"ownerReferences": [
|
||||
{
|
||||
"apiVersion": "apiVersionValue",
|
||||
"kind": "kindValue",
|
||||
"name": "nameValue",
|
||||
"uid": "uidValue",
|
||||
"controller": true,
|
||||
"blockOwnerDeletion": true
|
||||
}
|
||||
],
|
||||
"finalizers": [
|
||||
"finalizersValue"
|
||||
],
|
||||
"managedFields": [
|
||||
{
|
||||
"manager": "managerValue",
|
||||
"operation": "operationValue",
|
||||
"apiVersion": "apiVersionValue",
|
||||
"time": "2004-01-01T01:01:01Z",
|
||||
"fieldsType": "fieldsTypeValue",
|
||||
"fieldsV1": {},
|
||||
"subresource": "subresourceValue"
|
||||
}
|
||||
]
|
||||
},
|
||||
"spec": {
|
||||
"deviceSelector": {
|
||||
"driver": "driverValue",
|
||||
"pool": "poolValue",
|
||||
"device": "deviceValue"
|
||||
},
|
||||
"taint": {
|
||||
"key": "keyValue",
|
||||
"value": "valueValue",
|
||||
"effect": "effectValue",
|
||||
"timeAdded": "2004-01-01T01:01:01Z"
|
||||
}
|
||||
},
|
||||
"status": {
|
||||
"conditions": [
|
||||
{
|
||||
"type": "typeValue",
|
||||
"status": "statusValue",
|
||||
"observedGeneration": 3,
|
||||
"lastTransitionTime": "2004-01-01T01:01:01Z",
|
||||
"reason": "reasonValue",
|
||||
"message": "messageValue"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
BIN
staging/src/k8s.io/api/testdata/HEAD/resource.k8s.io.v1beta2.DeviceTaintRule.pb
vendored
Normal file
BIN
staging/src/k8s.io/api/testdata/HEAD/resource.k8s.io.v1beta2.DeviceTaintRule.pb
vendored
Normal file
Binary file not shown.
52
staging/src/k8s.io/api/testdata/HEAD/resource.k8s.io.v1beta2.DeviceTaintRule.yaml
vendored
Normal file
52
staging/src/k8s.io/api/testdata/HEAD/resource.k8s.io.v1beta2.DeviceTaintRule.yaml
vendored
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
apiVersion: resource.k8s.io/v1beta2
|
||||
kind: DeviceTaintRule
|
||||
metadata:
|
||||
annotations:
|
||||
annotationsKey: annotationsValue
|
||||
creationTimestamp: "2008-01-01T01:01:01Z"
|
||||
deletionGracePeriodSeconds: 10
|
||||
deletionTimestamp: "2009-01-01T01:01:01Z"
|
||||
finalizers:
|
||||
- finalizersValue
|
||||
generateName: generateNameValue
|
||||
generation: 7
|
||||
labels:
|
||||
labelsKey: labelsValue
|
||||
managedFields:
|
||||
- apiVersion: apiVersionValue
|
||||
fieldsType: fieldsTypeValue
|
||||
fieldsV1: {}
|
||||
manager: managerValue
|
||||
operation: operationValue
|
||||
subresource: subresourceValue
|
||||
time: "2004-01-01T01:01:01Z"
|
||||
name: nameValue
|
||||
namespace: namespaceValue
|
||||
ownerReferences:
|
||||
- apiVersion: apiVersionValue
|
||||
blockOwnerDeletion: true
|
||||
controller: true
|
||||
kind: kindValue
|
||||
name: nameValue
|
||||
uid: uidValue
|
||||
resourceVersion: resourceVersionValue
|
||||
selfLink: selfLinkValue
|
||||
uid: uidValue
|
||||
spec:
|
||||
deviceSelector:
|
||||
device: deviceValue
|
||||
driver: driverValue
|
||||
pool: poolValue
|
||||
taint:
|
||||
effect: effectValue
|
||||
key: keyValue
|
||||
timeAdded: "2004-01-01T01:01:01Z"
|
||||
value: valueValue
|
||||
status:
|
||||
conditions:
|
||||
- lastTransitionTime: "2004-01-01T01:01:01Z"
|
||||
message: messageValue
|
||||
observedGeneration: 3
|
||||
reason: reasonValue
|
||||
status: statusValue
|
||||
type: typeValue
|
||||
|
|
@ -14165,6 +14165,60 @@ var schemaYAML = typed.YAMLObject(`types:
|
|||
- name: value
|
||||
type:
|
||||
scalar: string
|
||||
- name: io.k8s.api.resource.v1beta2.DeviceTaintRule
|
||||
map:
|
||||
fields:
|
||||
- name: apiVersion
|
||||
type:
|
||||
scalar: string
|
||||
- name: kind
|
||||
type:
|
||||
scalar: string
|
||||
- name: metadata
|
||||
type:
|
||||
namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
|
||||
default: {}
|
||||
- name: spec
|
||||
type:
|
||||
namedType: io.k8s.api.resource.v1beta2.DeviceTaintRuleSpec
|
||||
default: {}
|
||||
- name: status
|
||||
type:
|
||||
namedType: io.k8s.api.resource.v1beta2.DeviceTaintRuleStatus
|
||||
default: {}
|
||||
- name: io.k8s.api.resource.v1beta2.DeviceTaintRuleSpec
|
||||
map:
|
||||
fields:
|
||||
- name: deviceSelector
|
||||
type:
|
||||
namedType: io.k8s.api.resource.v1beta2.DeviceTaintSelector
|
||||
- name: taint
|
||||
type:
|
||||
namedType: io.k8s.api.resource.v1beta2.DeviceTaint
|
||||
default: {}
|
||||
- name: io.k8s.api.resource.v1beta2.DeviceTaintRuleStatus
|
||||
map:
|
||||
fields:
|
||||
- name: conditions
|
||||
type:
|
||||
list:
|
||||
elementType:
|
||||
namedType: io.k8s.apimachinery.pkg.apis.meta.v1.Condition
|
||||
elementRelationship: associative
|
||||
keys:
|
||||
- type
|
||||
- name: io.k8s.api.resource.v1beta2.DeviceTaintSelector
|
||||
map:
|
||||
fields:
|
||||
- name: device
|
||||
type:
|
||||
scalar: string
|
||||
- name: driver
|
||||
type:
|
||||
scalar: string
|
||||
- name: pool
|
||||
type:
|
||||
scalar: string
|
||||
- name: io.k8s.api.resource.v1beta2.DeviceToleration
|
||||
map:
|
||||
fields:
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ type DeviceApplyConfiguration struct {
|
|||
// any device in a ResourceSlice, then the maximum number of
|
||||
// allowed devices per ResourceSlice is 64 instead of 128.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
Taints []DeviceTaintApplyConfiguration `json:"taints,omitempty"`
|
||||
// BindsToNode indicates if the usage of an allocation involving this device
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ type DeviceRequestAllocationResultApplyConfiguration struct {
|
|||
//
|
||||
// The maximum number of tolerations is 16.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
Tolerations []DeviceTolerationApplyConfiguration `json:"tolerations,omitempty"`
|
||||
// BindingConditions contains a copy of the BindingConditions
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ type DeviceSubRequestApplyConfiguration struct {
|
|||
//
|
||||
// The maximum number of tolerations is 16.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
Tolerations []DeviceTolerationApplyConfiguration `json:"tolerations,omitempty"`
|
||||
// Capacity define resource requirements against each capacity.
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ type ExactDeviceRequestApplyConfiguration struct {
|
|||
//
|
||||
// The maximum number of tolerations is 16.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
Tolerations []DeviceTolerationApplyConfiguration `json:"tolerations,omitempty"`
|
||||
// Capacity define resource requirements against each capacity.
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ type BasicDeviceApplyConfiguration struct {
|
|||
// any device in a ResourceSlice, then the maximum number of
|
||||
// allowed devices per ResourceSlice is 64 instead of 128.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
Taints []DeviceTaintApplyConfiguration `json:"taints,omitempty"`
|
||||
// BindsToNode indicates if the usage of an allocation involving this device
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ type DeviceRequestApplyConfiguration struct {
|
|||
// This field can only be set when deviceClassName is set and no subrequests
|
||||
// are specified in the firstAvailable list.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
Tolerations []DeviceTolerationApplyConfiguration `json:"tolerations,omitempty"`
|
||||
// Capacity define resource requirements against each capacity.
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ type DeviceRequestAllocationResultApplyConfiguration struct {
|
|||
//
|
||||
// The maximum number of tolerations is 16.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
Tolerations []DeviceTolerationApplyConfiguration `json:"tolerations,omitempty"`
|
||||
// BindingConditions contains a copy of the BindingConditions
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ type DeviceSubRequestApplyConfiguration struct {
|
|||
//
|
||||
// The maximum number of tolerations is 16.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
Tolerations []DeviceTolerationApplyConfiguration `json:"tolerations,omitempty"`
|
||||
// Capacity define resource requirements against each capacity.
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ type DeviceApplyConfiguration struct {
|
|||
// any device in a ResourceSlice, then the maximum number of
|
||||
// allowed devices per ResourceSlice is 64 instead of 128.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
Taints []DeviceTaintApplyConfiguration `json:"taints,omitempty"`
|
||||
// BindsToNode indicates if the usage of an allocation involving this device
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ type DeviceRequestAllocationResultApplyConfiguration struct {
|
|||
//
|
||||
// The maximum number of tolerations is 16.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
Tolerations []DeviceTolerationApplyConfiguration `json:"tolerations,omitempty"`
|
||||
// BindingConditions contains a copy of the BindingConditions
|
||||
|
|
|
|||
|
|
@ -93,7 +93,7 @@ type DeviceSubRequestApplyConfiguration struct {
|
|||
//
|
||||
// The maximum number of tolerations is 16.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
Tolerations []DeviceTolerationApplyConfiguration `json:"tolerations,omitempty"`
|
||||
// Capacity define resource requirements against each capacity.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,294 @@
|
|||
/*
|
||||
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 applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1beta2
|
||||
|
||||
import (
|
||||
resourcev1beta2 "k8s.io/api/resource/v1beta2"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
managedfields "k8s.io/apimachinery/pkg/util/managedfields"
|
||||
internal "k8s.io/client-go/applyconfigurations/internal"
|
||||
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||
)
|
||||
|
||||
// DeviceTaintRuleApplyConfiguration represents a declarative configuration of the DeviceTaintRule type for use
|
||||
// with apply.
|
||||
//
|
||||
// DeviceTaintRule adds one taint to all devices which match the selector.
|
||||
// This has the same effect as if the taint was specified directly
|
||||
// in the ResourceSlice by the DRA driver.
|
||||
type DeviceTaintRuleApplyConfiguration struct {
|
||||
v1.TypeMetaApplyConfiguration `json:",inline"`
|
||||
// Standard object metadata
|
||||
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
|
||||
// Spec specifies the selector and one taint.
|
||||
//
|
||||
// Changing the spec automatically increments the metadata.generation number.
|
||||
Spec *DeviceTaintRuleSpecApplyConfiguration `json:"spec,omitempty"`
|
||||
// Status provides information about what was requested in the spec.
|
||||
Status *DeviceTaintRuleStatusApplyConfiguration `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// DeviceTaintRule constructs a declarative configuration of the DeviceTaintRule type for use with
|
||||
// apply.
|
||||
func DeviceTaintRule(name string) *DeviceTaintRuleApplyConfiguration {
|
||||
b := &DeviceTaintRuleApplyConfiguration{}
|
||||
b.WithName(name)
|
||||
b.WithKind("DeviceTaintRule")
|
||||
b.WithAPIVersion("resource.k8s.io/v1beta2")
|
||||
return b
|
||||
}
|
||||
|
||||
// ExtractDeviceTaintRuleFrom extracts the applied configuration owned by fieldManager from
|
||||
// deviceTaintRule for the specified subresource. Pass an empty string for subresource to extract
|
||||
// the main resource. Common subresources include "status", "scale", etc.
|
||||
// deviceTaintRule must be a unmodified DeviceTaintRule API object that was retrieved from the Kubernetes API.
|
||||
// ExtractDeviceTaintRuleFrom provides a way to perform a extract/modify-in-place/apply workflow.
|
||||
// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
|
||||
// applied if another fieldManager has updated or force applied any of the previously applied fields.
|
||||
func ExtractDeviceTaintRuleFrom(deviceTaintRule *resourcev1beta2.DeviceTaintRule, fieldManager string, subresource string) (*DeviceTaintRuleApplyConfiguration, error) {
|
||||
b := &DeviceTaintRuleApplyConfiguration{}
|
||||
err := managedfields.ExtractInto(deviceTaintRule, internal.Parser().Type("io.k8s.api.resource.v1beta2.DeviceTaintRule"), fieldManager, b, subresource)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
b.WithName(deviceTaintRule.Name)
|
||||
|
||||
b.WithKind("DeviceTaintRule")
|
||||
b.WithAPIVersion("resource.k8s.io/v1beta2")
|
||||
return b, nil
|
||||
}
|
||||
|
||||
// ExtractDeviceTaintRule extracts the applied configuration owned by fieldManager from
|
||||
// deviceTaintRule. If no managedFields are found in deviceTaintRule for fieldManager, a
|
||||
// DeviceTaintRuleApplyConfiguration is returned with only the Name, Namespace (if applicable),
|
||||
// APIVersion and Kind populated. It is possible that no managed fields were found for because other
|
||||
// field managers have taken ownership of all the fields previously owned by fieldManager, or because
|
||||
// the fieldManager never owned fields any fields.
|
||||
// deviceTaintRule must be a unmodified DeviceTaintRule API object that was retrieved from the Kubernetes API.
|
||||
// ExtractDeviceTaintRule provides a way to perform a extract/modify-in-place/apply workflow.
|
||||
// Note that an extracted apply configuration will contain fewer fields than what the fieldManager previously
|
||||
// applied if another fieldManager has updated or force applied any of the previously applied fields.
|
||||
func ExtractDeviceTaintRule(deviceTaintRule *resourcev1beta2.DeviceTaintRule, fieldManager string) (*DeviceTaintRuleApplyConfiguration, error) {
|
||||
return ExtractDeviceTaintRuleFrom(deviceTaintRule, fieldManager, "")
|
||||
}
|
||||
|
||||
// ExtractDeviceTaintRuleStatus extracts the applied configuration owned by fieldManager from
|
||||
// deviceTaintRule for the status subresource.
|
||||
func ExtractDeviceTaintRuleStatus(deviceTaintRule *resourcev1beta2.DeviceTaintRule, fieldManager string) (*DeviceTaintRuleApplyConfiguration, error) {
|
||||
return ExtractDeviceTaintRuleFrom(deviceTaintRule, fieldManager, "status")
|
||||
}
|
||||
|
||||
func (b DeviceTaintRuleApplyConfiguration) IsApplyConfiguration() {}
|
||||
|
||||
// WithKind sets the Kind field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Kind field is set to the value of the last call.
|
||||
func (b *DeviceTaintRuleApplyConfiguration) WithKind(value string) *DeviceTaintRuleApplyConfiguration {
|
||||
b.TypeMetaApplyConfiguration.Kind = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithAPIVersion sets the APIVersion field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the APIVersion field is set to the value of the last call.
|
||||
func (b *DeviceTaintRuleApplyConfiguration) WithAPIVersion(value string) *DeviceTaintRuleApplyConfiguration {
|
||||
b.TypeMetaApplyConfiguration.APIVersion = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithName sets the Name field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Name field is set to the value of the last call.
|
||||
func (b *DeviceTaintRuleApplyConfiguration) WithName(value string) *DeviceTaintRuleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.Name = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithGenerateName sets the GenerateName field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the GenerateName field is set to the value of the last call.
|
||||
func (b *DeviceTaintRuleApplyConfiguration) WithGenerateName(value string) *DeviceTaintRuleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.GenerateName = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithNamespace sets the Namespace field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Namespace field is set to the value of the last call.
|
||||
func (b *DeviceTaintRuleApplyConfiguration) WithNamespace(value string) *DeviceTaintRuleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.Namespace = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithUID sets the UID field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the UID field is set to the value of the last call.
|
||||
func (b *DeviceTaintRuleApplyConfiguration) WithUID(value types.UID) *DeviceTaintRuleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.UID = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithResourceVersion sets the ResourceVersion field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the ResourceVersion field is set to the value of the last call.
|
||||
func (b *DeviceTaintRuleApplyConfiguration) WithResourceVersion(value string) *DeviceTaintRuleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.ResourceVersion = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithGeneration sets the Generation field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Generation field is set to the value of the last call.
|
||||
func (b *DeviceTaintRuleApplyConfiguration) WithGeneration(value int64) *DeviceTaintRuleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.Generation = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithCreationTimestamp sets the CreationTimestamp field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the CreationTimestamp field is set to the value of the last call.
|
||||
func (b *DeviceTaintRuleApplyConfiguration) WithCreationTimestamp(value metav1.Time) *DeviceTaintRuleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.CreationTimestamp = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithDeletionTimestamp sets the DeletionTimestamp field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the DeletionTimestamp field is set to the value of the last call.
|
||||
func (b *DeviceTaintRuleApplyConfiguration) WithDeletionTimestamp(value metav1.Time) *DeviceTaintRuleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.DeletionTimestamp = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithDeletionGracePeriodSeconds sets the DeletionGracePeriodSeconds field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the DeletionGracePeriodSeconds field is set to the value of the last call.
|
||||
func (b *DeviceTaintRuleApplyConfiguration) WithDeletionGracePeriodSeconds(value int64) *DeviceTaintRuleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
b.ObjectMetaApplyConfiguration.DeletionGracePeriodSeconds = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithLabels puts the entries into the Labels field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, the entries provided by each call will be put on the Labels field,
|
||||
// overwriting an existing map entries in Labels field with the same key.
|
||||
func (b *DeviceTaintRuleApplyConfiguration) WithLabels(entries map[string]string) *DeviceTaintRuleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
if b.ObjectMetaApplyConfiguration.Labels == nil && len(entries) > 0 {
|
||||
b.ObjectMetaApplyConfiguration.Labels = make(map[string]string, len(entries))
|
||||
}
|
||||
for k, v := range entries {
|
||||
b.ObjectMetaApplyConfiguration.Labels[k] = v
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithAnnotations puts the entries into the Annotations field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, the entries provided by each call will be put on the Annotations field,
|
||||
// overwriting an existing map entries in Annotations field with the same key.
|
||||
func (b *DeviceTaintRuleApplyConfiguration) WithAnnotations(entries map[string]string) *DeviceTaintRuleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
if b.ObjectMetaApplyConfiguration.Annotations == nil && len(entries) > 0 {
|
||||
b.ObjectMetaApplyConfiguration.Annotations = make(map[string]string, len(entries))
|
||||
}
|
||||
for k, v := range entries {
|
||||
b.ObjectMetaApplyConfiguration.Annotations[k] = v
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithOwnerReferences adds the given value to the OwnerReferences field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, values provided by each call will be appended to the OwnerReferences field.
|
||||
func (b *DeviceTaintRuleApplyConfiguration) WithOwnerReferences(values ...*v1.OwnerReferenceApplyConfiguration) *DeviceTaintRuleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
for i := range values {
|
||||
if values[i] == nil {
|
||||
panic("nil value passed to WithOwnerReferences")
|
||||
}
|
||||
b.ObjectMetaApplyConfiguration.OwnerReferences = append(b.ObjectMetaApplyConfiguration.OwnerReferences, *values[i])
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
// WithFinalizers adds the given value to the Finalizers field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, values provided by each call will be appended to the Finalizers field.
|
||||
func (b *DeviceTaintRuleApplyConfiguration) WithFinalizers(values ...string) *DeviceTaintRuleApplyConfiguration {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
for i := range values {
|
||||
b.ObjectMetaApplyConfiguration.Finalizers = append(b.ObjectMetaApplyConfiguration.Finalizers, values[i])
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
||||
func (b *DeviceTaintRuleApplyConfiguration) ensureObjectMetaApplyConfigurationExists() {
|
||||
if b.ObjectMetaApplyConfiguration == nil {
|
||||
b.ObjectMetaApplyConfiguration = &v1.ObjectMetaApplyConfiguration{}
|
||||
}
|
||||
}
|
||||
|
||||
// WithSpec sets the Spec field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Spec field is set to the value of the last call.
|
||||
func (b *DeviceTaintRuleApplyConfiguration) WithSpec(value *DeviceTaintRuleSpecApplyConfiguration) *DeviceTaintRuleApplyConfiguration {
|
||||
b.Spec = value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithStatus sets the Status field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Status field is set to the value of the last call.
|
||||
func (b *DeviceTaintRuleApplyConfiguration) WithStatus(value *DeviceTaintRuleStatusApplyConfiguration) *DeviceTaintRuleApplyConfiguration {
|
||||
b.Status = value
|
||||
return b
|
||||
}
|
||||
|
||||
// GetKind retrieves the value of the Kind field in the declarative configuration.
|
||||
func (b *DeviceTaintRuleApplyConfiguration) GetKind() *string {
|
||||
return b.TypeMetaApplyConfiguration.Kind
|
||||
}
|
||||
|
||||
// GetAPIVersion retrieves the value of the APIVersion field in the declarative configuration.
|
||||
func (b *DeviceTaintRuleApplyConfiguration) GetAPIVersion() *string {
|
||||
return b.TypeMetaApplyConfiguration.APIVersion
|
||||
}
|
||||
|
||||
// GetName retrieves the value of the Name field in the declarative configuration.
|
||||
func (b *DeviceTaintRuleApplyConfiguration) GetName() *string {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
return b.ObjectMetaApplyConfiguration.Name
|
||||
}
|
||||
|
||||
// GetNamespace retrieves the value of the Namespace field in the declarative configuration.
|
||||
func (b *DeviceTaintRuleApplyConfiguration) GetNamespace() *string {
|
||||
b.ensureObjectMetaApplyConfigurationExists()
|
||||
return b.ObjectMetaApplyConfiguration.Namespace
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
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 applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1beta2
|
||||
|
||||
// DeviceTaintRuleSpecApplyConfiguration represents a declarative configuration of the DeviceTaintRuleSpec type for use
|
||||
// with apply.
|
||||
//
|
||||
// DeviceTaintRuleSpec specifies the selector and one taint.
|
||||
type DeviceTaintRuleSpecApplyConfiguration struct {
|
||||
// DeviceSelector defines which device(s) the taint is applied to.
|
||||
// All selector criteria must be satisfied for a device to
|
||||
// match. The empty selector matches all devices. Without
|
||||
// a selector, no devices are matches.
|
||||
DeviceSelector *DeviceTaintSelectorApplyConfiguration `json:"deviceSelector,omitempty"`
|
||||
// The taint that gets applied to matching devices.
|
||||
Taint *DeviceTaintApplyConfiguration `json:"taint,omitempty"`
|
||||
}
|
||||
|
||||
// DeviceTaintRuleSpecApplyConfiguration constructs a declarative configuration of the DeviceTaintRuleSpec type for use with
|
||||
// apply.
|
||||
func DeviceTaintRuleSpec() *DeviceTaintRuleSpecApplyConfiguration {
|
||||
return &DeviceTaintRuleSpecApplyConfiguration{}
|
||||
}
|
||||
|
||||
// WithDeviceSelector sets the DeviceSelector field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the DeviceSelector field is set to the value of the last call.
|
||||
func (b *DeviceTaintRuleSpecApplyConfiguration) WithDeviceSelector(value *DeviceTaintSelectorApplyConfiguration) *DeviceTaintRuleSpecApplyConfiguration {
|
||||
b.DeviceSelector = value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithTaint sets the Taint field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Taint field is set to the value of the last call.
|
||||
func (b *DeviceTaintRuleSpecApplyConfiguration) WithTaint(value *DeviceTaintApplyConfiguration) *DeviceTaintRuleSpecApplyConfiguration {
|
||||
b.Taint = value
|
||||
return b
|
||||
}
|
||||
|
|
@ -0,0 +1,70 @@
|
|||
/*
|
||||
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 applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1beta2
|
||||
|
||||
import (
|
||||
v1 "k8s.io/client-go/applyconfigurations/meta/v1"
|
||||
)
|
||||
|
||||
// DeviceTaintRuleStatusApplyConfiguration represents a declarative configuration of the DeviceTaintRuleStatus type for use
|
||||
// with apply.
|
||||
//
|
||||
// DeviceTaintRuleStatus provides information about an on-going pod eviction.
|
||||
type DeviceTaintRuleStatusApplyConfiguration struct {
|
||||
// Conditions provide information about the state of the DeviceTaintRule
|
||||
// and the cluster at some point in time,
|
||||
// in a machine-readable and human-readable format.
|
||||
//
|
||||
// The following condition is currently defined as part of this API, more may
|
||||
// get added:
|
||||
// - Type: EvictionInProgress
|
||||
// - Status: True if there are currently pods which need to be evicted, False otherwise
|
||||
// (includes the effects which don't cause eviction).
|
||||
// - Reason: not specified, may change
|
||||
// - Message: includes information about number of pending pods and already evicted pods
|
||||
// in a human-readable format, updated periodically, may change
|
||||
//
|
||||
// For `effect: None`, the condition above gets set once for each change to
|
||||
// the spec, with the message containing information about what would happen
|
||||
// if the effect was `NoExecute`. This feedback can be used to decide whether
|
||||
// changing the effect to `NoExecute` will work as intended. It only gets
|
||||
// set once to avoid having to constantly update the status.
|
||||
//
|
||||
// Must have 8 or fewer entries.
|
||||
Conditions []v1.ConditionApplyConfiguration `json:"conditions,omitempty"`
|
||||
}
|
||||
|
||||
// DeviceTaintRuleStatusApplyConfiguration constructs a declarative configuration of the DeviceTaintRuleStatus type for use with
|
||||
// apply.
|
||||
func DeviceTaintRuleStatus() *DeviceTaintRuleStatusApplyConfiguration {
|
||||
return &DeviceTaintRuleStatusApplyConfiguration{}
|
||||
}
|
||||
|
||||
// WithConditions adds the given value to the Conditions field in the declarative configuration
|
||||
// and returns the receiver, so that objects can be build by chaining "With" function invocations.
|
||||
// If called multiple times, values provided by each call will be appended to the Conditions field.
|
||||
func (b *DeviceTaintRuleStatusApplyConfiguration) WithConditions(values ...*v1.ConditionApplyConfiguration) *DeviceTaintRuleStatusApplyConfiguration {
|
||||
for i := range values {
|
||||
if values[i] == nil {
|
||||
panic("nil value passed to WithConditions")
|
||||
}
|
||||
b.Conditions = append(b.Conditions, *values[i])
|
||||
}
|
||||
return b
|
||||
}
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
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 applyconfiguration-gen. DO NOT EDIT.
|
||||
|
||||
package v1beta2
|
||||
|
||||
// DeviceTaintSelectorApplyConfiguration represents a declarative configuration of the DeviceTaintSelector type for use
|
||||
// with apply.
|
||||
//
|
||||
// DeviceTaintSelector defines which device(s) a DeviceTaintRule applies to.
|
||||
// The empty selector matches all devices. Without a selector, no devices
|
||||
// are matched.
|
||||
type DeviceTaintSelectorApplyConfiguration struct {
|
||||
// If driver is set, only devices from that driver are selected.
|
||||
// This fields corresponds to slice.spec.driver.
|
||||
Driver *string `json:"driver,omitempty"`
|
||||
// If pool is set, only devices in that pool are selected.
|
||||
//
|
||||
// Also setting the driver name may be useful to avoid
|
||||
// ambiguity when different drivers use the same pool name,
|
||||
// but this is not required because selecting pools from
|
||||
// different drivers may also be useful, for example when
|
||||
// drivers with node-local devices use the node name as
|
||||
// their pool name.
|
||||
Pool *string `json:"pool,omitempty"`
|
||||
// If device is set, only devices with that name are selected.
|
||||
// This field corresponds to slice.spec.devices[].name.
|
||||
//
|
||||
// Setting also driver and pool may be required to avoid ambiguity,
|
||||
// but is not required.
|
||||
Device *string `json:"device,omitempty"`
|
||||
}
|
||||
|
||||
// DeviceTaintSelectorApplyConfiguration constructs a declarative configuration of the DeviceTaintSelector type for use with
|
||||
// apply.
|
||||
func DeviceTaintSelector() *DeviceTaintSelectorApplyConfiguration {
|
||||
return &DeviceTaintSelectorApplyConfiguration{}
|
||||
}
|
||||
|
||||
// WithDriver sets the Driver field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Driver field is set to the value of the last call.
|
||||
func (b *DeviceTaintSelectorApplyConfiguration) WithDriver(value string) *DeviceTaintSelectorApplyConfiguration {
|
||||
b.Driver = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithPool sets the Pool field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Pool field is set to the value of the last call.
|
||||
func (b *DeviceTaintSelectorApplyConfiguration) WithPool(value string) *DeviceTaintSelectorApplyConfiguration {
|
||||
b.Pool = &value
|
||||
return b
|
||||
}
|
||||
|
||||
// WithDevice sets the Device field in the declarative configuration to the given value
|
||||
// and returns the receiver, so that objects can be built by chaining "With" function invocations.
|
||||
// If called multiple times, the Device field is set to the value of the last call.
|
||||
func (b *DeviceTaintSelectorApplyConfiguration) WithDevice(value string) *DeviceTaintSelectorApplyConfiguration {
|
||||
b.Device = &value
|
||||
return b
|
||||
}
|
||||
|
|
@ -91,7 +91,7 @@ type ExactDeviceRequestApplyConfiguration struct {
|
|||
//
|
||||
// The maximum number of tolerations is 16.
|
||||
//
|
||||
// This is an alpha field and requires enabling the DRADeviceTaints
|
||||
// This is a beta field and requires enabling the DRADeviceTaints
|
||||
// feature gate.
|
||||
Tolerations []DeviceTolerationApplyConfiguration `json:"tolerations,omitempty"`
|
||||
// Capacity define resource requirements against each capacity.
|
||||
|
|
|
|||
|
|
@ -1786,6 +1786,14 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
|
|||
return &applyconfigurationsresourcev1beta2.DeviceSubRequestApplyConfiguration{}
|
||||
case resourcev1beta2.SchemeGroupVersion.WithKind("DeviceTaint"):
|
||||
return &applyconfigurationsresourcev1beta2.DeviceTaintApplyConfiguration{}
|
||||
case resourcev1beta2.SchemeGroupVersion.WithKind("DeviceTaintRule"):
|
||||
return &applyconfigurationsresourcev1beta2.DeviceTaintRuleApplyConfiguration{}
|
||||
case resourcev1beta2.SchemeGroupVersion.WithKind("DeviceTaintRuleSpec"):
|
||||
return &applyconfigurationsresourcev1beta2.DeviceTaintRuleSpecApplyConfiguration{}
|
||||
case resourcev1beta2.SchemeGroupVersion.WithKind("DeviceTaintRuleStatus"):
|
||||
return &applyconfigurationsresourcev1beta2.DeviceTaintRuleStatusApplyConfiguration{}
|
||||
case resourcev1beta2.SchemeGroupVersion.WithKind("DeviceTaintSelector"):
|
||||
return &applyconfigurationsresourcev1beta2.DeviceTaintSelectorApplyConfiguration{}
|
||||
case resourcev1beta2.SchemeGroupVersion.WithKind("DeviceToleration"):
|
||||
return &applyconfigurationsresourcev1beta2.DeviceTolerationApplyConfiguration{}
|
||||
case resourcev1beta2.SchemeGroupVersion.WithKind("ExactDeviceRequest"):
|
||||
|
|
|
|||
|
|
@ -406,6 +406,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource
|
|||
// Group=resource.k8s.io, Version=v1beta2
|
||||
case resourcev1beta2.SchemeGroupVersion.WithResource("deviceclasses"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Resource().V1beta2().DeviceClasses().Informer()}, nil
|
||||
case resourcev1beta2.SchemeGroupVersion.WithResource("devicetaintrules"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Resource().V1beta2().DeviceTaintRules().Informer()}, nil
|
||||
case resourcev1beta2.SchemeGroupVersion.WithResource("resourceclaims"):
|
||||
return &genericInformer{resource: resource.GroupResource(), informer: f.Resource().V1beta2().ResourceClaims().Informer()}, nil
|
||||
case resourcev1beta2.SchemeGroupVersion.WithResource("resourceclaimtemplates"):
|
||||
|
|
|
|||
|
|
@ -0,0 +1,115 @@
|
|||
/*
|
||||
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 v1beta2
|
||||
|
||||
import (
|
||||
context "context"
|
||||
time "time"
|
||||
|
||||
apiresourcev1beta2 "k8s.io/api/resource/v1beta2"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
runtime "k8s.io/apimachinery/pkg/runtime"
|
||||
schema "k8s.io/apimachinery/pkg/runtime/schema"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
internalinterfaces "k8s.io/client-go/informers/internalinterfaces"
|
||||
kubernetes "k8s.io/client-go/kubernetes"
|
||||
resourcev1beta2 "k8s.io/client-go/listers/resource/v1beta2"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// DeviceTaintRuleInformer provides access to a shared informer and lister for
|
||||
// DeviceTaintRules.
|
||||
type DeviceTaintRuleInformer interface {
|
||||
Informer() cache.SharedIndexInformer
|
||||
Lister() resourcev1beta2.DeviceTaintRuleLister
|
||||
}
|
||||
|
||||
type deviceTaintRuleInformer struct {
|
||||
factory internalinterfaces.SharedInformerFactory
|
||||
tweakListOptions internalinterfaces.TweakListOptionsFunc
|
||||
}
|
||||
|
||||
// NewDeviceTaintRuleInformer constructs a new informer for DeviceTaintRule 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 NewDeviceTaintRuleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer {
|
||||
return NewDeviceTaintRuleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers})
|
||||
}
|
||||
|
||||
// NewFilteredDeviceTaintRuleInformer constructs a new informer for DeviceTaintRule 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 NewFilteredDeviceTaintRuleInformer(client kubernetes.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer {
|
||||
return NewDeviceTaintRuleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: indexers, TweakListOptions: tweakListOptions})
|
||||
}
|
||||
|
||||
// NewDeviceTaintRuleInformerWithOptions constructs a new informer for DeviceTaintRule type with additional options.
|
||||
// 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 NewDeviceTaintRuleInformerWithOptions(client kubernetes.Interface, options internalinterfaces.InformerOptions) cache.SharedIndexInformer {
|
||||
gvr := schema.GroupVersionResource{Group: "resource.k8s.io", Version: "v1beta2", Resource: "devicetaintrules"}
|
||||
identifier := options.InformerName.WithResource(gvr)
|
||||
tweakListOptions := options.TweakListOptions
|
||||
return cache.NewSharedIndexInformerWithOptions(
|
||||
cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{
|
||||
ListFunc: func(opts v1.ListOptions) (runtime.Object, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&opts)
|
||||
}
|
||||
return client.ResourceV1beta2().DeviceTaintRules().List(context.Background(), opts)
|
||||
},
|
||||
WatchFunc: func(opts v1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&opts)
|
||||
}
|
||||
return client.ResourceV1beta2().DeviceTaintRules().Watch(context.Background(), opts)
|
||||
},
|
||||
ListWithContextFunc: func(ctx context.Context, opts v1.ListOptions) (runtime.Object, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&opts)
|
||||
}
|
||||
return client.ResourceV1beta2().DeviceTaintRules().List(ctx, opts)
|
||||
},
|
||||
WatchFuncWithContext: func(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) {
|
||||
if tweakListOptions != nil {
|
||||
tweakListOptions(&opts)
|
||||
}
|
||||
return client.ResourceV1beta2().DeviceTaintRules().Watch(ctx, opts)
|
||||
},
|
||||
}, client),
|
||||
&apiresourcev1beta2.DeviceTaintRule{},
|
||||
cache.SharedIndexInformerOptions{
|
||||
ResyncPeriod: options.ResyncPeriod,
|
||||
Indexers: options.Indexers,
|
||||
Identifier: identifier,
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
func (f *deviceTaintRuleInformer) defaultInformer(client kubernetes.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer {
|
||||
return NewDeviceTaintRuleInformerWithOptions(client, internalinterfaces.InformerOptions{ResyncPeriod: resyncPeriod, Indexers: cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, InformerName: f.factory.InformerName(), TweakListOptions: f.tweakListOptions})
|
||||
}
|
||||
|
||||
func (f *deviceTaintRuleInformer) Informer() cache.SharedIndexInformer {
|
||||
return f.factory.InformerFor(&apiresourcev1beta2.DeviceTaintRule{}, f.defaultInformer)
|
||||
}
|
||||
|
||||
func (f *deviceTaintRuleInformer) Lister() resourcev1beta2.DeviceTaintRuleLister {
|
||||
return resourcev1beta2.NewDeviceTaintRuleLister(f.Informer().GetIndexer())
|
||||
}
|
||||
|
|
@ -26,6 +26,8 @@ import (
|
|||
type Interface interface {
|
||||
// DeviceClasses returns a DeviceClassInformer.
|
||||
DeviceClasses() DeviceClassInformer
|
||||
// DeviceTaintRules returns a DeviceTaintRuleInformer.
|
||||
DeviceTaintRules() DeviceTaintRuleInformer
|
||||
// ResourceClaims returns a ResourceClaimInformer.
|
||||
ResourceClaims() ResourceClaimInformer
|
||||
// ResourceClaimTemplates returns a ResourceClaimTemplateInformer.
|
||||
|
|
@ -50,6 +52,11 @@ func (v *version) DeviceClasses() DeviceClassInformer {
|
|||
return &deviceClassInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
|
||||
}
|
||||
|
||||
// DeviceTaintRules returns a DeviceTaintRuleInformer.
|
||||
func (v *version) DeviceTaintRules() DeviceTaintRuleInformer {
|
||||
return &deviceTaintRuleInformer{factory: v.factory, tweakListOptions: v.tweakListOptions}
|
||||
}
|
||||
|
||||
// ResourceClaims returns a ResourceClaimInformer.
|
||||
func (v *version) ResourceClaims() ResourceClaimInformer {
|
||||
return &resourceClaimInformer{factory: v.factory, namespace: v.namespace, tweakListOptions: v.tweakListOptions}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
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 v1beta2
|
||||
|
||||
import (
|
||||
context "context"
|
||||
|
||||
resourcev1beta2 "k8s.io/api/resource/v1beta2"
|
||||
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
types "k8s.io/apimachinery/pkg/types"
|
||||
watch "k8s.io/apimachinery/pkg/watch"
|
||||
applyconfigurationsresourcev1beta2 "k8s.io/client-go/applyconfigurations/resource/v1beta2"
|
||||
gentype "k8s.io/client-go/gentype"
|
||||
scheme "k8s.io/client-go/kubernetes/scheme"
|
||||
)
|
||||
|
||||
// DeviceTaintRulesGetter has a method to return a DeviceTaintRuleInterface.
|
||||
// A group's client should implement this interface.
|
||||
type DeviceTaintRulesGetter interface {
|
||||
DeviceTaintRules() DeviceTaintRuleInterface
|
||||
}
|
||||
|
||||
// DeviceTaintRuleInterface has methods to work with DeviceTaintRule resources.
|
||||
type DeviceTaintRuleInterface interface {
|
||||
Create(ctx context.Context, deviceTaintRule *resourcev1beta2.DeviceTaintRule, opts v1.CreateOptions) (*resourcev1beta2.DeviceTaintRule, error)
|
||||
Update(ctx context.Context, deviceTaintRule *resourcev1beta2.DeviceTaintRule, opts v1.UpdateOptions) (*resourcev1beta2.DeviceTaintRule, error)
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
|
||||
UpdateStatus(ctx context.Context, deviceTaintRule *resourcev1beta2.DeviceTaintRule, opts v1.UpdateOptions) (*resourcev1beta2.DeviceTaintRule, 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) (*resourcev1beta2.DeviceTaintRule, error)
|
||||
List(ctx context.Context, opts v1.ListOptions) (*resourcev1beta2.DeviceTaintRuleList, 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 *resourcev1beta2.DeviceTaintRule, err error)
|
||||
Apply(ctx context.Context, deviceTaintRule *applyconfigurationsresourcev1beta2.DeviceTaintRuleApplyConfiguration, opts v1.ApplyOptions) (result *resourcev1beta2.DeviceTaintRule, err error)
|
||||
// Add a +genclient:noStatus comment above the type to avoid generating ApplyStatus().
|
||||
ApplyStatus(ctx context.Context, deviceTaintRule *applyconfigurationsresourcev1beta2.DeviceTaintRuleApplyConfiguration, opts v1.ApplyOptions) (result *resourcev1beta2.DeviceTaintRule, err error)
|
||||
DeviceTaintRuleExpansion
|
||||
}
|
||||
|
||||
// deviceTaintRules implements DeviceTaintRuleInterface
|
||||
type deviceTaintRules struct {
|
||||
*gentype.ClientWithListAndApply[*resourcev1beta2.DeviceTaintRule, *resourcev1beta2.DeviceTaintRuleList, *applyconfigurationsresourcev1beta2.DeviceTaintRuleApplyConfiguration]
|
||||
}
|
||||
|
||||
// newDeviceTaintRules returns a DeviceTaintRules
|
||||
func newDeviceTaintRules(c *ResourceV1beta2Client) *deviceTaintRules {
|
||||
return &deviceTaintRules{
|
||||
gentype.NewClientWithListAndApply[*resourcev1beta2.DeviceTaintRule, *resourcev1beta2.DeviceTaintRuleList, *applyconfigurationsresourcev1beta2.DeviceTaintRuleApplyConfiguration](
|
||||
"devicetaintrules",
|
||||
c.RESTClient(),
|
||||
scheme.ParameterCodec,
|
||||
"",
|
||||
func() *resourcev1beta2.DeviceTaintRule { return &resourcev1beta2.DeviceTaintRule{} },
|
||||
func() *resourcev1beta2.DeviceTaintRuleList { return &resourcev1beta2.DeviceTaintRuleList{} },
|
||||
gentype.PrefersProtobuf[*resourcev1beta2.DeviceTaintRule](),
|
||||
),
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
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 (
|
||||
v1beta2 "k8s.io/api/resource/v1beta2"
|
||||
resourcev1beta2 "k8s.io/client-go/applyconfigurations/resource/v1beta2"
|
||||
gentype "k8s.io/client-go/gentype"
|
||||
typedresourcev1beta2 "k8s.io/client-go/kubernetes/typed/resource/v1beta2"
|
||||
)
|
||||
|
||||
// fakeDeviceTaintRules implements DeviceTaintRuleInterface
|
||||
type fakeDeviceTaintRules struct {
|
||||
*gentype.FakeClientWithListAndApply[*v1beta2.DeviceTaintRule, *v1beta2.DeviceTaintRuleList, *resourcev1beta2.DeviceTaintRuleApplyConfiguration]
|
||||
Fake *FakeResourceV1beta2
|
||||
}
|
||||
|
||||
func newFakeDeviceTaintRules(fake *FakeResourceV1beta2) typedresourcev1beta2.DeviceTaintRuleInterface {
|
||||
return &fakeDeviceTaintRules{
|
||||
gentype.NewFakeClientWithListAndApply[*v1beta2.DeviceTaintRule, *v1beta2.DeviceTaintRuleList, *resourcev1beta2.DeviceTaintRuleApplyConfiguration](
|
||||
fake.Fake,
|
||||
"",
|
||||
v1beta2.SchemeGroupVersion.WithResource("devicetaintrules"),
|
||||
v1beta2.SchemeGroupVersion.WithKind("DeviceTaintRule"),
|
||||
func() *v1beta2.DeviceTaintRule { return &v1beta2.DeviceTaintRule{} },
|
||||
func() *v1beta2.DeviceTaintRuleList { return &v1beta2.DeviceTaintRuleList{} },
|
||||
func(dst, src *v1beta2.DeviceTaintRuleList) { dst.ListMeta = src.ListMeta },
|
||||
func(list *v1beta2.DeviceTaintRuleList) []*v1beta2.DeviceTaintRule {
|
||||
return gentype.ToPointerSlice(list.Items)
|
||||
},
|
||||
func(list *v1beta2.DeviceTaintRuleList, items []*v1beta2.DeviceTaintRule) {
|
||||
list.Items = gentype.FromPointerSlice(items)
|
||||
},
|
||||
),
|
||||
fake,
|
||||
}
|
||||
}
|
||||
|
|
@ -32,6 +32,10 @@ func (c *FakeResourceV1beta2) DeviceClasses() v1beta2.DeviceClassInterface {
|
|||
return newFakeDeviceClasses(c)
|
||||
}
|
||||
|
||||
func (c *FakeResourceV1beta2) DeviceTaintRules() v1beta2.DeviceTaintRuleInterface {
|
||||
return newFakeDeviceTaintRules(c)
|
||||
}
|
||||
|
||||
func (c *FakeResourceV1beta2) ResourceClaims(namespace string) v1beta2.ResourceClaimInterface {
|
||||
return newFakeResourceClaims(c, namespace)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,8 @@ package v1beta2
|
|||
|
||||
type DeviceClassExpansion interface{}
|
||||
|
||||
type DeviceTaintRuleExpansion interface{}
|
||||
|
||||
type ResourceClaimExpansion interface{}
|
||||
|
||||
type ResourceClaimTemplateExpansion interface{}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import (
|
|||
type ResourceV1beta2Interface interface {
|
||||
RESTClient() rest.Interface
|
||||
DeviceClassesGetter
|
||||
DeviceTaintRulesGetter
|
||||
ResourceClaimsGetter
|
||||
ResourceClaimTemplatesGetter
|
||||
ResourceSlicesGetter
|
||||
|
|
@ -43,6 +44,10 @@ func (c *ResourceV1beta2Client) DeviceClasses() DeviceClassInterface {
|
|||
return newDeviceClasses(c)
|
||||
}
|
||||
|
||||
func (c *ResourceV1beta2Client) DeviceTaintRules() DeviceTaintRuleInterface {
|
||||
return newDeviceTaintRules(c)
|
||||
}
|
||||
|
||||
func (c *ResourceV1beta2Client) ResourceClaims(namespace string) ResourceClaimInterface {
|
||||
return newResourceClaims(c, namespace)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
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 v1beta2
|
||||
|
||||
import (
|
||||
resourcev1beta2 "k8s.io/api/resource/v1beta2"
|
||||
labels "k8s.io/apimachinery/pkg/labels"
|
||||
listers "k8s.io/client-go/listers"
|
||||
cache "k8s.io/client-go/tools/cache"
|
||||
)
|
||||
|
||||
// DeviceTaintRuleLister helps list DeviceTaintRules.
|
||||
// All objects returned here must be treated as read-only.
|
||||
type DeviceTaintRuleLister interface {
|
||||
// List lists all DeviceTaintRules in the indexer.
|
||||
// Objects returned here must be treated as read-only.
|
||||
List(selector labels.Selector) (ret []*resourcev1beta2.DeviceTaintRule, err error)
|
||||
// Get retrieves the DeviceTaintRule from the index for a given name.
|
||||
// Objects returned here must be treated as read-only.
|
||||
Get(name string) (*resourcev1beta2.DeviceTaintRule, error)
|
||||
DeviceTaintRuleListerExpansion
|
||||
}
|
||||
|
||||
// deviceTaintRuleLister implements the DeviceTaintRuleLister interface.
|
||||
type deviceTaintRuleLister struct {
|
||||
listers.ResourceIndexer[*resourcev1beta2.DeviceTaintRule]
|
||||
}
|
||||
|
||||
// NewDeviceTaintRuleLister returns a new DeviceTaintRuleLister.
|
||||
func NewDeviceTaintRuleLister(indexer cache.Indexer) DeviceTaintRuleLister {
|
||||
return &deviceTaintRuleLister{listers.New[*resourcev1beta2.DeviceTaintRule](indexer, resourcev1beta2.Resource("devicetaintrule"))}
|
||||
}
|
||||
|
|
@ -22,6 +22,10 @@ package v1beta2
|
|||
// DeviceClassLister.
|
||||
type DeviceClassListerExpansion interface{}
|
||||
|
||||
// DeviceTaintRuleListerExpansion allows custom methods to be added to
|
||||
// DeviceTaintRuleLister.
|
||||
type DeviceTaintRuleListerExpansion interface{}
|
||||
|
||||
// ResourceClaimListerExpansion allows custom methods to be added to
|
||||
// ResourceClaimLister.
|
||||
type ResourceClaimListerExpansion interface{}
|
||||
|
|
|
|||
|
|
@ -54,8 +54,8 @@
|
|||
| DRAAdminAccess | :ballot_box_with_check: 1.34+ | :closed_lock_with_key: 1.36+ | 1.32–1.33 | 1.34–1.35 | 1.36– | | DynamicResourceAllocation | [code](https://cs.k8s.io/?q=%5CbDRAAdminAccess%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/kubernetes) [KEPs](https://cs.k8s.io/?q=%5CbDRAAdminAccess%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/enhancements) |
|
||||
| DRAConsumableCapacity | :ballot_box_with_check: 1.36+ | | 1.34–1.35 | 1.36– | | | DynamicResourceAllocation | [code](https://cs.k8s.io/?q=%5CbDRAConsumableCapacity%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/kubernetes) [KEPs](https://cs.k8s.io/?q=%5CbDRAConsumableCapacity%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/enhancements) |
|
||||
| DRADeviceBindingConditions | | | 1.34– | | | | DRAResourceClaimDeviceStatus<br>DynamicResourceAllocation | [code](https://cs.k8s.io/?q=%5CbDRADeviceBindingConditions%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/kubernetes) [KEPs](https://cs.k8s.io/?q=%5CbDRADeviceBindingConditions%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/enhancements) |
|
||||
| DRADeviceTaintRules | | | 1.35– | | | | DRADeviceTaints | [code](https://cs.k8s.io/?q=%5CbDRADeviceTaintRules%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/kubernetes) [KEPs](https://cs.k8s.io/?q=%5CbDRADeviceTaintRules%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/enhancements) |
|
||||
| DRADeviceTaints | | | 1.33– | | | | DynamicResourceAllocation | [code](https://cs.k8s.io/?q=%5CbDRADeviceTaints%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/kubernetes) [KEPs](https://cs.k8s.io/?q=%5CbDRADeviceTaints%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/enhancements) |
|
||||
| DRADeviceTaintRules | | | 1.35 | 1.36– | | | DRADeviceTaints | [code](https://cs.k8s.io/?q=%5CbDRADeviceTaintRules%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/kubernetes) [KEPs](https://cs.k8s.io/?q=%5CbDRADeviceTaintRules%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/enhancements) |
|
||||
| DRADeviceTaints | :ballot_box_with_check: 1.36+ | | 1.33–1.35 | 1.36– | | | DynamicResourceAllocation | [code](https://cs.k8s.io/?q=%5CbDRADeviceTaints%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/kubernetes) [KEPs](https://cs.k8s.io/?q=%5CbDRADeviceTaints%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/enhancements) |
|
||||
| DRAExtendedResource | :ballot_box_with_check: 1.36+ | | 1.34–1.35 | 1.36– | | | DynamicResourceAllocation | [code](https://cs.k8s.io/?q=%5CbDRAExtendedResource%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/kubernetes) [KEPs](https://cs.k8s.io/?q=%5CbDRAExtendedResource%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/enhancements) |
|
||||
| DRAPartitionableDevices | | | 1.33– | | | | DynamicResourceAllocation | [code](https://cs.k8s.io/?q=%5CbDRAPartitionableDevices%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/kubernetes) [KEPs](https://cs.k8s.io/?q=%5CbDRAPartitionableDevices%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/enhancements) |
|
||||
| DRAPrioritizedList | :ballot_box_with_check: 1.34+ | | 1.33 | 1.34–1.35 | 1.36– | | DynamicResourceAllocation | [code](https://cs.k8s.io/?q=%5CbDRAPrioritizedList%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/kubernetes) [KEPs](https://cs.k8s.io/?q=%5CbDRAPrioritizedList%5Cb&i=nope&files=&excludeFiles=CHANGELOG&repos=kubernetes/enhancements) |
|
||||
|
|
|
|||
|
|
@ -549,12 +549,20 @@
|
|||
lockToDefault: false
|
||||
preRelease: Alpha
|
||||
version: "1.35"
|
||||
- default: false
|
||||
lockToDefault: false
|
||||
preRelease: Beta
|
||||
version: "1.36"
|
||||
- name: DRADeviceTaints
|
||||
versionedSpecs:
|
||||
- default: false
|
||||
lockToDefault: false
|
||||
preRelease: Alpha
|
||||
version: "1.33"
|
||||
- default: true
|
||||
lockToDefault: false
|
||||
preRelease: Beta
|
||||
version: "1.36"
|
||||
- name: DRAExtendedResource
|
||||
versionedSpecs:
|
||||
- default: false
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ import (
|
|||
appsv1 "k8s.io/api/apps/v1"
|
||||
v1 "k8s.io/api/core/v1"
|
||||
resourceapi "k8s.io/api/resource/v1"
|
||||
resourcealphaapi "k8s.io/api/resource/v1alpha3"
|
||||
resourcev1beta1 "k8s.io/api/resource/v1beta1"
|
||||
resourcev1beta2 "k8s.io/api/resource/v1beta2"
|
||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
|
|
@ -2092,17 +2091,17 @@ var _ = framework.SIGDescribe("node")(framework.WithLabel("DRA"), func() {
|
|||
|
||||
// Now evict it.
|
||||
ginkgo.By("Evicting pod...")
|
||||
taint := &resourcealphaapi.DeviceTaintRule{
|
||||
taint := &resourcev1beta2.DeviceTaintRule{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
GenerateName: "device-taint-rule-" + f.UniqueName + "-",
|
||||
},
|
||||
Spec: resourcealphaapi.DeviceTaintRuleSpec{
|
||||
Spec: resourcev1beta2.DeviceTaintRuleSpec{
|
||||
// All devices of the current driver instance.
|
||||
DeviceSelector: &resourcealphaapi.DeviceTaintSelector{
|
||||
DeviceSelector: &resourcev1beta2.DeviceTaintSelector{
|
||||
Driver: &driver.Name,
|
||||
},
|
||||
Taint: resourcealphaapi.DeviceTaint{
|
||||
Effect: resourcealphaapi.DeviceTaintEffectNoExecute,
|
||||
Taint: resourcev1beta2.DeviceTaint{
|
||||
Effect: resourcev1beta2.DeviceTaintEffectNoExecute,
|
||||
Key: "test.example.com/evict",
|
||||
Value: "now",
|
||||
// No TimeAdded, gets defaulted.
|
||||
|
|
@ -2110,7 +2109,7 @@ var _ = framework.SIGDescribe("node")(framework.WithLabel("DRA"), func() {
|
|||
},
|
||||
}
|
||||
createdTaint := b.Create(tCtx, taint)
|
||||
taint = createdTaint[0].(*resourcealphaapi.DeviceTaintRule)
|
||||
taint = createdTaint[0].(*resourcev1beta2.DeviceTaintRule)
|
||||
gomega.Expect(*taint).Should(gomega.HaveField("Spec.Taint.TimeAdded.Time", gomega.BeTemporally("~", time.Now(), time.Minute /* allow for some clock drift and delays */)))
|
||||
framework.ExpectNoError(e2epod.WaitForPodTerminatingInNamespaceTimeout(ctx, f.ClientSet, pod.Name, f.Namespace.Name, f.Timeouts.PodStart))
|
||||
pod, err := f.ClientSet.CoreV1().Pods(f.Namespace.Name).Get(ctx, pod.Name, metav1.GetOptions{})
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: resource.k8s.io/v1alpha3
|
||||
apiVersion: resource.k8s.io/v1beta2
|
||||
kind: DeviceTaintRule
|
||||
metadata:
|
||||
name: example
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
apiVersion: resource.k8s.io/v1alpha3
|
||||
apiVersion: resource.k8s.io/v1
|
||||
kind: ResourceClaim
|
||||
metadata:
|
||||
name: example
|
||||
|
|
@ -7,4 +7,5 @@ spec:
|
|||
devices:
|
||||
requests:
|
||||
- name: req-0
|
||||
deviceClassName: example
|
||||
exactly:
|
||||
deviceClassName: example
|
||||
|
|
|
|||
|
|
@ -381,6 +381,12 @@ func (b *Builder) Create(tCtx ktesting.TContext, objs ...klog.KMetadata) []klog.
|
|||
err := tCtx.Client().ResourceV1alpha3().DeviceTaintRules().Delete(tCtx, createdObj.GetName(), metav1.DeleteOptions{})
|
||||
tCtx.ExpectNoError(err, "delete DeviceTaintRule")
|
||||
})
|
||||
case *resourcev1beta2.DeviceTaintRule:
|
||||
createdObj, err = tCtx.Client().ResourceV1beta2().DeviceTaintRules().Create(tCtx, obj, metav1.CreateOptions{})
|
||||
cleanupCtx(func(tCtx ktesting.TContext) {
|
||||
err := tCtx.Client().ResourceV1beta2().DeviceTaintRules().Delete(tCtx, createdObj.GetName(), metav1.DeleteOptions{})
|
||||
tCtx.ExpectNoError(err, "delete DeviceTaintRule")
|
||||
})
|
||||
case *appsv1.DaemonSet:
|
||||
createdObj, err = tCtx.Client().AppsV1().DaemonSets(b.namespace).Create(tCtx, obj, metav1.CreateOptions{})
|
||||
// Cleanup not really needed, but speeds up namespace shutdown.
|
||||
|
|
|
|||
|
|
@ -159,6 +159,7 @@ var resetFieldsSpecData = map[schema.GroupVersionResource]string{
|
|||
gvr("resource.k8s.io", "v1beta1", "resourceclaims"): `{"spec": {"devices": {"requests": [{"name": "req-0", "deviceClassName": "other-class"}]}}}`, // spec is immutable, but that doesn't matter for the test.
|
||||
gvr("resource.k8s.io", "v1beta1", "resourceclaimtemplates"): `{"spec": {"spec": {"resourceClassName": "class2name"}}}`,
|
||||
gvr("resource.k8s.io", "v1beta2", "deviceclasses"): `{"metadata": {"labels":{"a":"c"}}}`,
|
||||
gvr("resource.k8s.io", "v1beta2", "devicetaintrules"): `{"metadata": {"labels":{"a":"c"}}}`,
|
||||
gvr("resource.k8s.io", "v1beta2", "resourceclaims"): `{"spec": {"devices": {"requests": [{"name": "req-0", "exactly": {"deviceClassName": "other-class"}}]}}}`, // spec is immutable, but that doesn't matter for the test.
|
||||
gvr("resource.k8s.io", "v1beta2", "resourceclaimtemplates"): `{"spec": {"spec": {"resourceClassName": "class2name"}}}`,
|
||||
gvr("resource.k8s.io", "v1", "deviceclasses"): `{"metadata": {"labels":{"a":"c"}}}`,
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ var statusData = map[schema.GroupVersionResource]string{
|
|||
gvr("policy", "v1beta1", "poddisruptionbudgets"): `{"status": {"currentHealthy": 5}}`,
|
||||
gvr("resource.k8s.io", "v1alpha3", "devicetaintrules"): `{"status": {"conditions": [{"type": "EvictionInProgress", "status": "True", "reason: "PodsLeft", "message: "100 pods left", "lastTransitionTime": "2020-01-01T00:00:00Z"}]}}`,
|
||||
gvr("resource.k8s.io", "v1beta1", "resourceclaims"): `{"status": {"allocation": {"nodeSelector": {"nodeSelectorTerms": [{"matchExpressions": [{"key": "some-label", "operator": "In", "values": ["some-value"]}] }]}}}}`,
|
||||
gvr("resource.k8s.io", "v1beta2", "devicetaintrules"): `{"status": {"conditions": [{"type": "EvictionInProgress", "status": "True", "reason: "PodsLeft", "message: "100 pods left", "lastTransitionTime": "2020-01-01T00:00:00Z"}]}}`,
|
||||
gvr("resource.k8s.io", "v1beta2", "resourceclaims"): `{"status": {"allocation": {"nodeSelector": {"nodeSelectorTerms": [{"matchExpressions": [{"key": "some-label", "operator": "In", "values": ["some-value"]}] }]}}}}`,
|
||||
gvr("resource.k8s.io", "v1", "resourceclaims"): `{"status": {"allocation": {"nodeSelector": {"nodeSelectorTerms": [{"matchExpressions": [{"key": "some-label", "operator": "In", "values": ["some-value"]}] }]}}}}`,
|
||||
gvr("internal.apiserver.k8s.io", "v1alpha1", "storageversions"): `{"status": {"commonEncodingVersion":"v1","storageVersions":[{"apiServerID":"1","decodableVersions":["v1","v2"],"encodingVersion":"v1"}],"conditions":[{"type":"AllEncodingVersionsEqual","status":"True","lastTransitionTime":"2020-01-01T00:00:00Z","reason":"allEncodingVersionsEqual","message":"all encoding versions are set to v1"}]}}`,
|
||||
|
|
|
|||
|
|
@ -28,11 +28,12 @@ import (
|
|||
v1 "k8s.io/api/core/v1"
|
||||
resourceapi "k8s.io/api/resource/v1"
|
||||
resourcealpha "k8s.io/api/resource/v1alpha3"
|
||||
resourcebeta "k8s.io/api/resource/v1beta2"
|
||||
apierrors "k8s.io/apimachinery/pkg/api/errors"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
"k8s.io/client-go/informers"
|
||||
resourcealphainformers "k8s.io/client-go/informers/resource/v1alpha3"
|
||||
resourcebetainformers "k8s.io/client-go/informers/resource/v1beta2"
|
||||
"k8s.io/client-go/tools/cache"
|
||||
"k8s.io/kubernetes/pkg/controller/devicetainteviction"
|
||||
"k8s.io/kubernetes/pkg/features"
|
||||
|
|
@ -40,12 +41,20 @@ import (
|
|||
"k8s.io/utils/ptr"
|
||||
)
|
||||
|
||||
type useRuleMode int
|
||||
|
||||
const (
|
||||
useNoRule = useRuleMode(iota)
|
||||
useV1alpha3Rule
|
||||
useV1beta2Rule
|
||||
)
|
||||
|
||||
// testEvictCluster simulates a cluster with many scheduled pods where each
|
||||
// pod uses it's own ResourceClaim with one device. Then all those
|
||||
// devices get tainted with a single DeviceTaintRule (causing eviction of all pods at once)
|
||||
// or by updating the slices (more gradual).
|
||||
func testEvictCluster(tCtx ktesting.TContext, useRule bool) {
|
||||
tCtx.Parallel()
|
||||
func testEvictCluster(tCtx ktesting.TContext, useRule useRuleMode) {
|
||||
// Not parallel because it creates a controller.
|
||||
|
||||
var wg sync.WaitGroup
|
||||
defer func() {
|
||||
|
|
@ -61,6 +70,8 @@ func testEvictCluster(tCtx ktesting.TContext, useRule bool) {
|
|||
driverName := "driver-" + namespace
|
||||
poolName := "cluster"
|
||||
|
||||
tCtx.Logf("testing with driver name %s", driverName)
|
||||
|
||||
var slices []*resourceapi.ResourceSlice
|
||||
for i := range numSlices {
|
||||
slice := &resourceapi.ResourceSlice{
|
||||
|
|
@ -129,9 +140,9 @@ func testEvictCluster(tCtx ktesting.TContext, useRule bool) {
|
|||
// Create a new factory and sync it so that when the controller starts, it is up-to-date.
|
||||
// This works as long as this is the only test running it.
|
||||
informerFactory := informers.NewSharedInformerFactory(tCtx.Client(), 0)
|
||||
var ruleInformer resourcealphainformers.DeviceTaintRuleInformer
|
||||
var ruleInformer resourcebetainformers.DeviceTaintRuleInformer
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.DRADeviceTaintRules) {
|
||||
ruleInformer = informerFactory.Resource().V1alpha3().DeviceTaintRules()
|
||||
ruleInformer = informerFactory.Resource().V1beta2().DeviceTaintRules()
|
||||
}
|
||||
controller := devicetainteviction.New(tCtx.Client(),
|
||||
informerFactory.Core().V1().Pods(),
|
||||
|
|
@ -181,11 +192,17 @@ func testEvictCluster(tCtx ktesting.TContext, useRule bool) {
|
|||
})
|
||||
|
||||
ruleName := "rule-" + namespace
|
||||
getRule := func(tCtx ktesting.TContext) *resourcealpha.DeviceTaintRule {
|
||||
getV1alpha3Rule := func(tCtx ktesting.TContext) *resourcealpha.DeviceTaintRule {
|
||||
return must(tCtx, tCtx.Client().ResourceV1alpha3().DeviceTaintRules().Get, ruleName, metav1.GetOptions{})
|
||||
}
|
||||
getV1beta2Rule := func(tCtx ktesting.TContext) *resourcebeta.DeviceTaintRule {
|
||||
return must(tCtx, tCtx.Client().ResourceV1beta2().DeviceTaintRules().Get, ruleName, metav1.GetOptions{})
|
||||
}
|
||||
var getRule any
|
||||
|
||||
if useRule {
|
||||
switch useRule {
|
||||
case useV1alpha3Rule:
|
||||
getRule = getV1alpha3Rule
|
||||
// Evict through DeviceTaintRule.
|
||||
//
|
||||
// Let's also test some of the semantics around DeviceTaintRule.
|
||||
|
|
@ -205,7 +222,7 @@ func testEvictCluster(tCtx ktesting.TContext, useRule bool) {
|
|||
},
|
||||
},
|
||||
}
|
||||
must(tCtx, tCtx.Client().ResourceV1alpha3().DeviceTaintRules().Create, rule, metav1.CreateOptions{})
|
||||
rule = must(tCtx, tCtx.Client().ResourceV1alpha3().DeviceTaintRules().Create, rule, metav1.CreateOptions{})
|
||||
tCtx.CleanupCtx(func(tCtx ktesting.TContext) {
|
||||
err := tCtx.Client().ResourceV1alpha3().DeviceTaintRules().Delete(tCtx, ruleName, metav1.DeleteOptions{})
|
||||
if apierrors.IsNotFound(err) {
|
||||
|
|
@ -213,15 +230,20 @@ func testEvictCluster(tCtx ktesting.TContext, useRule bool) {
|
|||
}
|
||||
tCtx.ExpectNoError(err)
|
||||
})
|
||||
tCtx.Expect(rule).To(gomega.HaveField("ObjectMeta.Generation", gomega.Equal(int64(1))))
|
||||
|
||||
tCtx.Eventually(getRule).
|
||||
WithPolling(10 * time.Second).
|
||||
tCtx.Eventually(getV1alpha3Rule).
|
||||
WithPolling(10*time.Second).
|
||||
Should(gomega.HaveField("Status.Conditions", gomega.ConsistOf(gstruct.MatchFields(gstruct.IgnoreExtras, gstruct.Fields{
|
||||
"Type": gomega.Equal(resourcealpha.DeviceTaintConditionEvictionInProgress),
|
||||
"Status": gomega.Equal(metav1.ConditionFalse),
|
||||
"Message": gomega.Equal(fmt.Sprintf("%[1]d published devices selected. %[1]d allocated devices selected. %[1]d pods would be evicted in 1 namespace if the effect was NoExecute. This information will not be updated again. Recreate the DeviceTaintRule to trigger an update.", numPods)),
|
||||
}))))
|
||||
rule = getRule(tCtx)
|
||||
"ObservedGeneration": gomega.Equal(rule.Generation),
|
||||
}))), "waiting for simulation result")
|
||||
rule = getV1alpha3Rule(tCtx)
|
||||
tCtx.Expect(rule).To(gomega.HaveField("Status.Conditions", gomega.ConsistOf(gstruct.MatchFields(gstruct.IgnoreExtras, gstruct.Fields{
|
||||
"ObservedGeneration": gomega.Equal(rule.Generation),
|
||||
"Type": gomega.Equal(resourcealpha.DeviceTaintConditionEvictionInProgress),
|
||||
"Status": gomega.Equal(metav1.ConditionFalse),
|
||||
"Message": gomega.Equal(fmt.Sprintf("%[1]d published devices selected. %[1]d allocated devices selected. %[1]d pods would be evicted in 1 namespace if the effect was NoExecute. This information will not be updated again. Recreate the DeviceTaintRule to trigger an update.", numPods)),
|
||||
}))))
|
||||
|
||||
var newTime *metav1.Time
|
||||
for {
|
||||
|
|
@ -237,15 +259,18 @@ func testEvictCluster(tCtx ktesting.TContext, useRule bool) {
|
|||
tCtx.Error("our TimeAdded should have been stored")
|
||||
}
|
||||
tCtx.Expect(rule).To(gomega.HaveField("ObjectMeta.Generation", gomega.Equal(int64(2))))
|
||||
tCtx.Eventually(getRule).
|
||||
WithPolling(10 * time.Second).
|
||||
tCtx.Eventually(getV1alpha3Rule).
|
||||
WithPolling(10*time.Second).
|
||||
Should(gomega.HaveField("Status.Conditions", gomega.ConsistOf(gstruct.MatchFields(gstruct.IgnoreExtras, gstruct.Fields{
|
||||
"ObservedGeneration": gomega.Equal(rule.Generation),
|
||||
"Type": gomega.Equal(resourcealpha.DeviceTaintConditionEvictionInProgress),
|
||||
"Status": gomega.Equal(metav1.ConditionFalse),
|
||||
"Message": gomega.Equal(fmt.Sprintf("%[1]d published devices selected. %[1]d allocated devices selected. %[1]d pods would be evicted in 1 namespace if the effect was NoExecute. This information will not be updated again. Recreate the DeviceTaintRule to trigger an update.", numPods)),
|
||||
}))))
|
||||
rule = getRule(tCtx)
|
||||
}))), "waiting for reaction to TimeAdded bump")
|
||||
rule = getV1alpha3Rule(tCtx)
|
||||
tCtx.Expect(rule).To(gomega.HaveField("Status.Conditions", gomega.ConsistOf(gstruct.MatchFields(gstruct.IgnoreExtras, gstruct.Fields{
|
||||
"ObservedGeneration": gomega.Equal(rule.Generation),
|
||||
"Type": gomega.Equal(resourcealpha.DeviceTaintConditionEvictionInProgress),
|
||||
"Status": gomega.Equal(metav1.ConditionFalse),
|
||||
"Message": gomega.Equal(fmt.Sprintf("%[1]d published devices selected. %[1]d allocated devices selected. %[1]d pods would be evicted in 1 namespace if the effect was NoExecute. This information will not be updated again. Recreate the DeviceTaintRule to trigger an update.", numPods)),
|
||||
}))))
|
||||
|
||||
rule.Spec.Taint.Effect = resourcealpha.DeviceTaintEffectNoExecute
|
||||
// Must roll over to next second, that's the resolution of TimeAdded.
|
||||
|
|
@ -256,7 +281,87 @@ func testEvictCluster(tCtx ktesting.TContext, useRule bool) {
|
|||
if newTime.Equal(rule.Spec.Taint.TimeAdded) {
|
||||
tCtx.Error("TimeAdded should have been updated automatically")
|
||||
}
|
||||
} else {
|
||||
case useV1beta2Rule:
|
||||
getRule = getV1beta2Rule
|
||||
// Evict through DeviceTaintRule.
|
||||
//
|
||||
// Let's also test some of the semantics around DeviceTaintRule.
|
||||
// We start with NoEffect, check the report, change TimeAdded manually,
|
||||
// then turn on eviction.
|
||||
rule := &resourcebeta.DeviceTaintRule{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: ruleName,
|
||||
},
|
||||
Spec: resourcebeta.DeviceTaintRuleSpec{
|
||||
DeviceSelector: &resourcebeta.DeviceTaintSelector{
|
||||
Driver: &driverName,
|
||||
},
|
||||
Taint: resourcebeta.DeviceTaint{
|
||||
Key: "testing",
|
||||
Effect: resourcebeta.DeviceTaintEffectNone,
|
||||
},
|
||||
},
|
||||
}
|
||||
rule = must(tCtx, tCtx.Client().ResourceV1beta2().DeviceTaintRules().Create, rule, metav1.CreateOptions{})
|
||||
tCtx.CleanupCtx(func(tCtx ktesting.TContext) {
|
||||
err := tCtx.Client().ResourceV1beta2().DeviceTaintRules().Delete(tCtx, ruleName, metav1.DeleteOptions{})
|
||||
if apierrors.IsNotFound(err) {
|
||||
return
|
||||
}
|
||||
tCtx.ExpectNoError(err)
|
||||
})
|
||||
tCtx.Expect(rule).To(gomega.HaveField("ObjectMeta.Generation", gomega.Equal(int64(1))))
|
||||
|
||||
tCtx.Eventually(getV1beta2Rule).
|
||||
WithPolling(10*time.Second).
|
||||
Should(gomega.HaveField("Status.Conditions", gomega.ConsistOf(gstruct.MatchFields(gstruct.IgnoreExtras, gstruct.Fields{
|
||||
"ObservedGeneration": gomega.Equal(rule.Generation),
|
||||
}))), "waiting for simulation result")
|
||||
rule = getV1beta2Rule(tCtx)
|
||||
tCtx.Expect(rule).To(gomega.HaveField("Status.Conditions", gomega.ConsistOf(gstruct.MatchFields(gstruct.IgnoreExtras, gstruct.Fields{
|
||||
"ObservedGeneration": gomega.Equal(rule.Generation),
|
||||
"Type": gomega.Equal(resourcealpha.DeviceTaintConditionEvictionInProgress),
|
||||
"Status": gomega.Equal(metav1.ConditionFalse),
|
||||
"Message": gomega.Equal(fmt.Sprintf("%[1]d published devices selected. %[1]d allocated devices selected. %[1]d pods would be evicted in 1 namespace if the effect was NoExecute. This information will not be updated again. Recreate the DeviceTaintRule to trigger an update.", numPods)),
|
||||
}))))
|
||||
|
||||
var newTime *metav1.Time
|
||||
for {
|
||||
newTime = &metav1.Time{Time: time.Now().Truncate(time.Second)}
|
||||
if !newTime.Equal(rule.Spec.Taint.TimeAdded) {
|
||||
break
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
}
|
||||
rule.Spec.Taint.TimeAdded = newTime
|
||||
rule = must(tCtx, tCtx.Client().ResourceV1beta2().DeviceTaintRules().Update, rule, metav1.UpdateOptions{})
|
||||
if !newTime.Equal(rule.Spec.Taint.TimeAdded) {
|
||||
tCtx.Error("our TimeAdded should have been stored")
|
||||
}
|
||||
tCtx.Expect(rule).To(gomega.HaveField("ObjectMeta.Generation", gomega.Equal(int64(2))))
|
||||
tCtx.Eventually(getV1beta2Rule).
|
||||
WithPolling(10*time.Second).
|
||||
Should(gomega.HaveField("Status.Conditions", gomega.ConsistOf(gstruct.MatchFields(gstruct.IgnoreExtras, gstruct.Fields{
|
||||
"ObservedGeneration": gomega.Equal(rule.Generation),
|
||||
}))), "waiting for reaction to TimeAdded bump")
|
||||
rule = getV1beta2Rule(tCtx)
|
||||
tCtx.Expect(rule).To(gomega.HaveField("Status.Conditions", gomega.ConsistOf(gstruct.MatchFields(gstruct.IgnoreExtras, gstruct.Fields{
|
||||
"ObservedGeneration": gomega.Equal(rule.Generation),
|
||||
"Type": gomega.Equal(resourcealpha.DeviceTaintConditionEvictionInProgress),
|
||||
"Status": gomega.Equal(metav1.ConditionFalse),
|
||||
"Message": gomega.Equal(fmt.Sprintf("%[1]d published devices selected. %[1]d allocated devices selected. %[1]d pods would be evicted in 1 namespace if the effect was NoExecute. This information will not be updated again. Recreate the DeviceTaintRule to trigger an update.", numPods)),
|
||||
}))))
|
||||
|
||||
rule.Spec.Taint.Effect = resourcebeta.DeviceTaintEffectNoExecute
|
||||
// Must roll over to next second, that's the resolution of TimeAdded.
|
||||
// We could rely on the delay for updating the status, but that
|
||||
// could change.
|
||||
time.Sleep(time.Second)
|
||||
rule = must(tCtx, tCtx.Client().ResourceV1beta2().DeviceTaintRules().Update, rule, metav1.UpdateOptions{})
|
||||
if newTime.Equal(rule.Spec.Taint.TimeAdded) {
|
||||
tCtx.Error("TimeAdded should have been updated automatically")
|
||||
}
|
||||
case useNoRule:
|
||||
// Evict by tainting each device.
|
||||
for i, slice := range slices {
|
||||
slice = slice.DeepCopy()
|
||||
|
|
@ -269,6 +374,8 @@ func testEvictCluster(tCtx ktesting.TContext, useRule bool) {
|
|||
}
|
||||
slices[i] = must(tCtx, tCtx.Client().ResourceV1().ResourceSlices().Update, slice, metav1.UpdateOptions{})
|
||||
}
|
||||
default:
|
||||
tCtx.Fatalf("unsupported useRule %d", useRule)
|
||||
}
|
||||
|
||||
// Evict and wait for pods to be gone.
|
||||
|
|
@ -284,7 +391,7 @@ func testEvictCluster(tCtx ktesting.TContext, useRule bool) {
|
|||
duration := time.Since(start)
|
||||
tCtx.Logf("Evicted %d pods in %s.", numPods, duration)
|
||||
|
||||
if useRule {
|
||||
if useRule != useNoRule {
|
||||
// Check condition.
|
||||
tCtx.Eventually(getRule).
|
||||
WithPolling(10 * time.Second).
|
||||
|
|
|
|||
|
|
@ -145,6 +145,7 @@ func TestDRA(t *testing.T) {
|
|||
features: map[featuregate.Feature]bool{},
|
||||
f: func(tCtx ktesting.TContext) {
|
||||
tCtx.Run("Pod", func(tCtx ktesting.TContext) { testPod(tCtx, true) })
|
||||
tCtx.Run("EvictClusterWithSlices", func(tCtx ktesting.TContext) { testEvictCluster(tCtx, useNoRule) })
|
||||
// Number of devices per slice is chosen so that Filter takes a few seconds:
|
||||
// without a timeout, the test doesn't run too long, but long enough that a short timeout triggers.
|
||||
tCtx.Run("FilterTimeout", func(tCtx ktesting.TContext) { testFilterTimeout(tCtx, 20) })
|
||||
|
|
@ -197,7 +198,7 @@ func TestDRA(t *testing.T) {
|
|||
features: map[featuregate.Feature]bool{features.DynamicResourceAllocation: true},
|
||||
f: func(tCtx ktesting.TContext) {
|
||||
tCtx.Run("PublishResourceSlices", func(tCtx ktesting.TContext) {
|
||||
testPublishResourceSlices(tCtx, false, features.DRADeviceTaints, features.DRAPartitionableDevices, features.DRADeviceBindingConditions)
|
||||
testPublishResourceSlices(tCtx, false, features.DRAPartitionableDevices, features.DRADeviceBindingConditions)
|
||||
})
|
||||
},
|
||||
},
|
||||
|
|
@ -206,21 +207,16 @@ func TestDRA(t *testing.T) {
|
|||
resourceapi.SchemeGroupVersion: false,
|
||||
resourcev1beta2.SchemeGroupVersion: true,
|
||||
},
|
||||
features: map[featuregate.Feature]bool{features.DynamicResourceAllocation: true},
|
||||
features: map[featuregate.Feature]bool{
|
||||
features.DynamicResourceAllocation: true,
|
||||
features.DRADeviceTaintRules: true,
|
||||
},
|
||||
f: func(tCtx ktesting.TContext) {
|
||||
tCtx.Run("PublishResourceSlices", func(tCtx ktesting.TContext) {
|
||||
testPublishResourceSlices(tCtx, false, features.DRADeviceTaints, features.DRAPartitionableDevices, features.DRADeviceBindingConditions)
|
||||
testPublishResourceSlices(tCtx, false, features.DRAPartitionableDevices, features.DRADeviceBindingConditions)
|
||||
})
|
||||
},
|
||||
},
|
||||
"slice-taints": {
|
||||
features: map[featuregate.Feature]bool{
|
||||
features.DRADeviceTaints: true,
|
||||
},
|
||||
f: func(tCtx ktesting.TContext) {
|
||||
tCtx.Run("EvictClusterWithSlices", func(tCtx ktesting.TContext) { testEvictCluster(tCtx, false) })
|
||||
},
|
||||
},
|
||||
"all": {
|
||||
apis: map[schema.GroupVersion]bool{
|
||||
resourcev1beta1.SchemeGroupVersion: true,
|
||||
|
|
@ -234,7 +230,6 @@ func TestDRA(t *testing.T) {
|
|||
features.DRAAdminAccess: true,
|
||||
features.DRADeviceBindingConditions: true,
|
||||
features.DRAConsumableCapacity: true,
|
||||
features.DRADeviceTaints: true,
|
||||
features.DRADeviceTaintRules: true,
|
||||
features.DRAPartitionableDevices: true,
|
||||
features.DRAPrioritizedList: true,
|
||||
|
|
@ -256,8 +251,9 @@ func TestDRA(t *testing.T) {
|
|||
tCtx.Run("ImplicitExtendedResource", func(tCtx ktesting.TContext) { testExtendedResource(tCtx, true, false) })
|
||||
tCtx.Run("ResourceClaimDeviceStatus", func(tCtx ktesting.TContext) { testResourceClaimDeviceStatus(tCtx, true) })
|
||||
tCtx.Run("MaxResourceSlice", testMaxResourceSlice)
|
||||
tCtx.Run("EvictClusterWithRule", func(tCtx ktesting.TContext) { testEvictCluster(tCtx, true) })
|
||||
tCtx.Run("EvictClusterWithSlices", func(tCtx ktesting.TContext) { testEvictCluster(tCtx, false) })
|
||||
tCtx.Run("EvictClusterWithV1alpha3Rule", func(tCtx ktesting.TContext) { testEvictCluster(tCtx, useV1alpha3Rule) })
|
||||
tCtx.Run("EvictClusterWithV1beta2Rule", func(tCtx ktesting.TContext) { testEvictCluster(tCtx, useV1beta2Rule) })
|
||||
tCtx.Run("EvictClusterWithSlices", func(tCtx ktesting.TContext) { testEvictCluster(tCtx, useNoRule) })
|
||||
tCtx.Run("InvalidResourceSlices", testInvalidResourceSlices)
|
||||
// Number of devices per slice is chosen so that Filter takes a few seconds: The allocator
|
||||
// in the experimental channel has an improvement that requires a higher number here than
|
||||
|
|
|
|||
|
|
@ -652,6 +652,13 @@ func GetEtcdStorageDataForNamespaceServedAt(namespace string, v string, isEmulat
|
|||
IntroducedVersion: "1.33",
|
||||
RemovedVersion: "1.39",
|
||||
},
|
||||
gvr("resource.k8s.io", "v1beta2", "devicetaintrules"): {
|
||||
Stub: `{"metadata": {"name": "taint2name"}, "spec": {"taint": {"key": "example.com/taintkey", "value": "taintvalue", "effect": "NoSchedule"}}}`,
|
||||
ExpectedEtcdPath: "/registry/devicetaintrules/taint2name",
|
||||
ExpectedGVK: gvkP("resource.k8s.io", "v1alpha3", "DeviceTaintRule"), // v1beta2 has higher priority, but to support downgrades v1alpha3 is picked automatically.
|
||||
IntroducedVersion: "1.36",
|
||||
RemovedVersion: "1.42",
|
||||
},
|
||||
gvr("resource.k8s.io", "v1beta2", "resourceclaims"): {
|
||||
Stub: `{"metadata": {"name": "claim3name"}, "spec": {"devices": {"requests": [{"name": "req-0", "exactly": {"deviceClassName": "example-class", "allocationMode": "ExactCount", "count": 1}}]}}}`,
|
||||
ExpectedEtcdPath: "/registry/resourceclaims/" + namespace + "/claim3name",
|
||||
|
|
|
|||
|
|
@ -24,12 +24,12 @@ import (
|
|||
"reflect"
|
||||
"sync"
|
||||
|
||||
"github.com/google/go-cmp/cmp"
|
||||
"github.com/onsi/gomega"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
v1 "k8s.io/api/core/v1"
|
||||
resourceapi "k8s.io/api/resource/v1"
|
||||
resourcealphaapi "k8s.io/api/resource/v1alpha3"
|
||||
resourcebeta "k8s.io/api/resource/v1beta2"
|
||||
"k8s.io/apimachinery/pkg/api/resource"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/labels"
|
||||
|
|
@ -303,18 +303,26 @@ func (op *allocResourceClaimsOp) run(tCtx ktesting.TContext) {
|
|||
tCtx.Cancel("allocResourceClaimsOp.run is shutting down")
|
||||
informerFactory.Shutdown()
|
||||
}()
|
||||
syncedInformers := informerFactory.WaitForCacheSync(tCtx.Done())
|
||||
expectSyncedInformers := map[reflect.Type]bool{
|
||||
reflect.TypeOf(&resourceapi.DeviceClass{}): true,
|
||||
reflect.TypeOf(&resourceapi.ResourceClaim{}): true,
|
||||
reflect.TypeOf(&resourceapi.ResourceSlice{}): true,
|
||||
reflect.TypeOf(&v1.Node{}): true,
|
||||
syncResult := informerFactory.WaitForCacheSyncWithContext(tCtx)
|
||||
expectSyncResult := cache.SyncResult{
|
||||
Synced: map[reflect.Type]bool{
|
||||
reflect.TypeFor[*resourceapi.DeviceClass](): true,
|
||||
reflect.TypeFor[*resourceapi.ResourceClaim](): true,
|
||||
reflect.TypeFor[*resourceapi.ResourceSlice](): true,
|
||||
reflect.TypeFor[*v1.Node](): true,
|
||||
},
|
||||
}
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.DRADeviceTaints) {
|
||||
expectSyncedInformers[reflect.TypeOf(&resourcealphaapi.DeviceTaintRule{})] = true
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.DRADeviceTaintRules) {
|
||||
expectSyncResult.Synced[reflect.TypeFor[*resourcebeta.DeviceTaintRule]()] = true
|
||||
}
|
||||
if diff := cmp.Diff(expectSyncResult, syncResult,
|
||||
cmp.Transformer("TypeOf", func(t reflect.Type) string {
|
||||
return t.String()
|
||||
}),
|
||||
); diff != "" {
|
||||
tCtx.Fatalf("unexpected informer sync result (- expected, + actual):\n%s", diff)
|
||||
}
|
||||
|
||||
require.Equal(tCtx, expectSyncedInformers, syncedInformers, "synced informers")
|
||||
celCache := cel.NewCache(10, cel.Features{EnableConsumableCapacity: utilfeature.DefaultFeatureGate.Enabled(features.DRAConsumableCapacity)})
|
||||
|
||||
// Also wait for the assume cache to catch up.
|
||||
|
|
|
|||
Loading…
Reference in a new issue