dra: add "named resources" structured parameter model

Like the current device plugin interface, a DRA driver using this model
announces a list of resource instances. In contrast to device plugins, this
list is made available to the scheduler together with attributes that can be
used to select suitable instances when they are not all alike.

Because this is the first structured parameter model, some checks that
previously were not possible, in particular "is one structured parameter field
set", now gets enabled. Adding another structured parameter model will be
similar.

The applyconfigs code generator assumes that all types in an API are defined in
a single package. If it wasn't for that, it would be possible to place the
"named resources" types in separate packages, which makes their names in the Go
code more natural and provides an indication of their stability level because
the package name could include a version.

Kubernetes-commit: d4d5ade7f5be047472f8d9572c7f01f142951a2d
This commit is contained in:
Patrick Ohly 2024-02-23 15:22:02 +01:00 committed by Kubernetes Publisher
parent c3231901f2
commit 95cf817801
19 changed files with 803 additions and 21 deletions

View File

@ -11969,6 +11969,9 @@ var schemaYAML = typed.YAMLObject(`types:
- name: io.k8s.api.resource.v1alpha2.DriverAllocationResult
map:
fields:
- name: namedResources
type:
namedType: io.k8s.api.resource.v1alpha2.NamedResourcesAllocationResult
- name: vendorRequestParameters
type:
namedType: __untyped_atomic_
@ -11987,6 +11990,92 @@ var schemaYAML = typed.YAMLObject(`types:
- name: vendorParameters
type:
namedType: __untyped_atomic_
- name: io.k8s.api.resource.v1alpha2.NamedResourcesAllocationResult
map:
fields:
- name: name
type:
scalar: string
default: ""
- name: io.k8s.api.resource.v1alpha2.NamedResourcesAttribute
map:
fields:
- name: bool
type:
scalar: boolean
- name: int
type:
scalar: numeric
- name: intSlice
type:
namedType: io.k8s.api.resource.v1alpha2.NamedResourcesIntSlice
- name: name
type:
scalar: string
default: ""
- name: quantity
type:
namedType: io.k8s.apimachinery.pkg.api.resource.Quantity
- name: string
type:
scalar: string
- name: stringSlice
type:
namedType: io.k8s.api.resource.v1alpha2.NamedResourcesStringSlice
- name: io.k8s.api.resource.v1alpha2.NamedResourcesFilter
map:
fields:
- name: selector
type:
scalar: string
default: ""
- name: io.k8s.api.resource.v1alpha2.NamedResourcesInstance
map:
fields:
- name: attributes
type:
list:
elementType:
namedType: io.k8s.api.resource.v1alpha2.NamedResourcesAttribute
elementRelationship: atomic
- name: name
type:
scalar: string
default: ""
- name: io.k8s.api.resource.v1alpha2.NamedResourcesIntSlice
map:
fields:
- name: ints
type:
list:
elementType:
scalar: numeric
elementRelationship: atomic
- name: io.k8s.api.resource.v1alpha2.NamedResourcesRequest
map:
fields:
- name: selector
type:
scalar: string
default: ""
- name: io.k8s.api.resource.v1alpha2.NamedResourcesResources
map:
fields:
- name: instances
type:
list:
elementType:
namedType: io.k8s.api.resource.v1alpha2.NamedResourcesInstance
elementRelationship: atomic
- name: io.k8s.api.resource.v1alpha2.NamedResourcesStringSlice
map:
fields:
- name: strings
type:
list:
elementType:
scalar: string
elementRelationship: atomic
- name: io.k8s.api.resource.v1alpha2.NodeResourceSlice
map:
fields:
@ -12004,6 +12093,9 @@ var schemaYAML = typed.YAMLObject(`types:
type:
namedType: io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta
default: {}
- name: namedResources
type:
namedType: io.k8s.api.resource.v1alpha2.NamedResourcesResources
- name: nodeName
type:
scalar: string
@ -12280,6 +12372,9 @@ var schemaYAML = typed.YAMLObject(`types:
- name: driverName
type:
scalar: string
- name: namedResources
type:
namedType: io.k8s.api.resource.v1alpha2.NamedResourcesFilter
- name: io.k8s.api.resource.v1alpha2.ResourceHandle
map:
fields:
@ -12295,6 +12390,9 @@ var schemaYAML = typed.YAMLObject(`types:
- name: io.k8s.api.resource.v1alpha2.ResourceRequest
map:
fields:
- name: namedResources
type:
namedType: io.k8s.api.resource.v1alpha2.NamedResourcesRequest
- name: vendorParameters
type:
namedType: __untyped_atomic_

View File

@ -0,0 +1,39 @@
/*
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 v1alpha2
// AllocationResultModelApplyConfiguration represents an declarative configuration of the AllocationResultModel type for use
// with apply.
type AllocationResultModelApplyConfiguration struct {
NamedResources *NamedResourcesAllocationResultApplyConfiguration `json:"namedResources,omitempty"`
}
// AllocationResultModelApplyConfiguration constructs an declarative configuration of the AllocationResultModel type for use with
// apply.
func AllocationResultModel() *AllocationResultModelApplyConfiguration {
return &AllocationResultModelApplyConfiguration{}
}
// WithNamedResources sets the NamedResources 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 NamedResources field is set to the value of the last call.
func (b *AllocationResultModelApplyConfiguration) WithNamedResources(value *NamedResourcesAllocationResultApplyConfiguration) *AllocationResultModelApplyConfiguration {
b.NamedResources = value
return b
}

View File

@ -19,15 +19,14 @@ limitations under the License.
package v1alpha2
import (
v1alpha2 "k8s.io/api/resource/v1alpha2"
runtime "k8s.io/apimachinery/pkg/runtime"
)
// DriverAllocationResultApplyConfiguration represents an declarative configuration of the DriverAllocationResult type for use
// with apply.
type DriverAllocationResultApplyConfiguration struct {
VendorRequestParameters *runtime.RawExtension `json:"vendorRequestParameters,omitempty"`
v1alpha2.AllocationResultModel `json:",inline"`
VendorRequestParameters *runtime.RawExtension `json:"vendorRequestParameters,omitempty"`
AllocationResultModelApplyConfiguration `json:",inline"`
}
// DriverAllocationResultApplyConfiguration constructs an declarative configuration of the DriverAllocationResult type for use with
@ -43,3 +42,11 @@ func (b *DriverAllocationResultApplyConfiguration) WithVendorRequestParameters(v
b.VendorRequestParameters = &value
return b
}
// WithNamedResources sets the NamedResources 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 NamedResources field is set to the value of the last call.
func (b *DriverAllocationResultApplyConfiguration) WithNamedResources(value *NamedResourcesAllocationResultApplyConfiguration) *DriverAllocationResultApplyConfiguration {
b.NamedResources = value
return b
}

View File

@ -0,0 +1,39 @@
/*
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 v1alpha2
// NamedResourcesAllocationResultApplyConfiguration represents an declarative configuration of the NamedResourcesAllocationResult type for use
// with apply.
type NamedResourcesAllocationResultApplyConfiguration struct {
Name *string `json:"name,omitempty"`
}
// NamedResourcesAllocationResultApplyConfiguration constructs an declarative configuration of the NamedResourcesAllocationResult type for use with
// apply.
func NamedResourcesAllocationResult() *NamedResourcesAllocationResultApplyConfiguration {
return &NamedResourcesAllocationResultApplyConfiguration{}
}
// 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 *NamedResourcesAllocationResultApplyConfiguration) WithName(value string) *NamedResourcesAllocationResultApplyConfiguration {
b.Name = &value
return b
}

View File

@ -0,0 +1,92 @@
/*
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 v1alpha2
import (
resource "k8s.io/apimachinery/pkg/api/resource"
)
// NamedResourcesAttributeApplyConfiguration represents an declarative configuration of the NamedResourcesAttribute type for use
// with apply.
type NamedResourcesAttributeApplyConfiguration struct {
Name *string `json:"name,omitempty"`
NamedResourcesAttributeValueApplyConfiguration `json:",inline"`
}
// NamedResourcesAttributeApplyConfiguration constructs an declarative configuration of the NamedResourcesAttribute type for use with
// apply.
func NamedResourcesAttribute() *NamedResourcesAttributeApplyConfiguration {
return &NamedResourcesAttributeApplyConfiguration{}
}
// 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 *NamedResourcesAttributeApplyConfiguration) WithName(value string) *NamedResourcesAttributeApplyConfiguration {
b.Name = &value
return b
}
// WithQuantityValue sets the QuantityValue 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 QuantityValue field is set to the value of the last call.
func (b *NamedResourcesAttributeApplyConfiguration) WithQuantityValue(value resource.Quantity) *NamedResourcesAttributeApplyConfiguration {
b.QuantityValue = &value
return b
}
// WithBoolValue sets the BoolValue 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 BoolValue field is set to the value of the last call.
func (b *NamedResourcesAttributeApplyConfiguration) WithBoolValue(value bool) *NamedResourcesAttributeApplyConfiguration {
b.BoolValue = &value
return b
}
// WithIntValue sets the IntValue 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 IntValue field is set to the value of the last call.
func (b *NamedResourcesAttributeApplyConfiguration) WithIntValue(value int64) *NamedResourcesAttributeApplyConfiguration {
b.IntValue = &value
return b
}
// WithIntSliceValue sets the IntSliceValue 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 IntSliceValue field is set to the value of the last call.
func (b *NamedResourcesAttributeApplyConfiguration) WithIntSliceValue(value *NamedResourcesIntSliceApplyConfiguration) *NamedResourcesAttributeApplyConfiguration {
b.IntSliceValue = value
return b
}
// WithStringValue sets the StringValue 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 StringValue field is set to the value of the last call.
func (b *NamedResourcesAttributeApplyConfiguration) WithStringValue(value string) *NamedResourcesAttributeApplyConfiguration {
b.StringValue = &value
return b
}
// WithStringSliceValue sets the StringSliceValue 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 StringSliceValue field is set to the value of the last call.
func (b *NamedResourcesAttributeApplyConfiguration) WithStringSliceValue(value *NamedResourcesStringSliceApplyConfiguration) *NamedResourcesAttributeApplyConfiguration {
b.StringSliceValue = value
return b
}

View File

@ -0,0 +1,88 @@
/*
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 v1alpha2
import (
resource "k8s.io/apimachinery/pkg/api/resource"
)
// NamedResourcesAttributeValueApplyConfiguration represents an declarative configuration of the NamedResourcesAttributeValue type for use
// with apply.
type NamedResourcesAttributeValueApplyConfiguration struct {
QuantityValue *resource.Quantity `json:"quantity,omitempty"`
BoolValue *bool `json:"bool,omitempty"`
IntValue *int64 `json:"int,omitempty"`
IntSliceValue *NamedResourcesIntSliceApplyConfiguration `json:"intSlice,omitempty"`
StringValue *string `json:"string,omitempty"`
StringSliceValue *NamedResourcesStringSliceApplyConfiguration `json:"stringSlice,omitempty"`
}
// NamedResourcesAttributeValueApplyConfiguration constructs an declarative configuration of the NamedResourcesAttributeValue type for use with
// apply.
func NamedResourcesAttributeValue() *NamedResourcesAttributeValueApplyConfiguration {
return &NamedResourcesAttributeValueApplyConfiguration{}
}
// WithQuantityValue sets the QuantityValue 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 QuantityValue field is set to the value of the last call.
func (b *NamedResourcesAttributeValueApplyConfiguration) WithQuantityValue(value resource.Quantity) *NamedResourcesAttributeValueApplyConfiguration {
b.QuantityValue = &value
return b
}
// WithBoolValue sets the BoolValue 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 BoolValue field is set to the value of the last call.
func (b *NamedResourcesAttributeValueApplyConfiguration) WithBoolValue(value bool) *NamedResourcesAttributeValueApplyConfiguration {
b.BoolValue = &value
return b
}
// WithIntValue sets the IntValue 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 IntValue field is set to the value of the last call.
func (b *NamedResourcesAttributeValueApplyConfiguration) WithIntValue(value int64) *NamedResourcesAttributeValueApplyConfiguration {
b.IntValue = &value
return b
}
// WithIntSliceValue sets the IntSliceValue 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 IntSliceValue field is set to the value of the last call.
func (b *NamedResourcesAttributeValueApplyConfiguration) WithIntSliceValue(value *NamedResourcesIntSliceApplyConfiguration) *NamedResourcesAttributeValueApplyConfiguration {
b.IntSliceValue = value
return b
}
// WithStringValue sets the StringValue 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 StringValue field is set to the value of the last call.
func (b *NamedResourcesAttributeValueApplyConfiguration) WithStringValue(value string) *NamedResourcesAttributeValueApplyConfiguration {
b.StringValue = &value
return b
}
// WithStringSliceValue sets the StringSliceValue 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 StringSliceValue field is set to the value of the last call.
func (b *NamedResourcesAttributeValueApplyConfiguration) WithStringSliceValue(value *NamedResourcesStringSliceApplyConfiguration) *NamedResourcesAttributeValueApplyConfiguration {
b.StringSliceValue = value
return b
}

View File

@ -0,0 +1,39 @@
/*
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 v1alpha2
// NamedResourcesFilterApplyConfiguration represents an declarative configuration of the NamedResourcesFilter type for use
// with apply.
type NamedResourcesFilterApplyConfiguration struct {
Selector *string `json:"selector,omitempty"`
}
// NamedResourcesFilterApplyConfiguration constructs an declarative configuration of the NamedResourcesFilter type for use with
// apply.
func NamedResourcesFilter() *NamedResourcesFilterApplyConfiguration {
return &NamedResourcesFilterApplyConfiguration{}
}
// WithSelector sets the Selector 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 Selector field is set to the value of the last call.
func (b *NamedResourcesFilterApplyConfiguration) WithSelector(value string) *NamedResourcesFilterApplyConfiguration {
b.Selector = &value
return b
}

View File

@ -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 applyconfiguration-gen. DO NOT EDIT.
package v1alpha2
// NamedResourcesInstanceApplyConfiguration represents an declarative configuration of the NamedResourcesInstance type for use
// with apply.
type NamedResourcesInstanceApplyConfiguration struct {
Name *string `json:"name,omitempty"`
Attributes []NamedResourcesAttributeApplyConfiguration `json:"attributes,omitempty"`
}
// NamedResourcesInstanceApplyConfiguration constructs an declarative configuration of the NamedResourcesInstance type for use with
// apply.
func NamedResourcesInstance() *NamedResourcesInstanceApplyConfiguration {
return &NamedResourcesInstanceApplyConfiguration{}
}
// 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 *NamedResourcesInstanceApplyConfiguration) WithName(value string) *NamedResourcesInstanceApplyConfiguration {
b.Name = &value
return b
}
// WithAttributes adds the given value to the Attributes 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 Attributes field.
func (b *NamedResourcesInstanceApplyConfiguration) WithAttributes(values ...*NamedResourcesAttributeApplyConfiguration) *NamedResourcesInstanceApplyConfiguration {
for i := range values {
if values[i] == nil {
panic("nil value passed to WithAttributes")
}
b.Attributes = append(b.Attributes, *values[i])
}
return b
}

View File

@ -0,0 +1,41 @@
/*
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 v1alpha2
// NamedResourcesIntSliceApplyConfiguration represents an declarative configuration of the NamedResourcesIntSlice type for use
// with apply.
type NamedResourcesIntSliceApplyConfiguration struct {
Ints []int64 `json:"ints,omitempty"`
}
// NamedResourcesIntSliceApplyConfiguration constructs an declarative configuration of the NamedResourcesIntSlice type for use with
// apply.
func NamedResourcesIntSlice() *NamedResourcesIntSliceApplyConfiguration {
return &NamedResourcesIntSliceApplyConfiguration{}
}
// WithInts adds the given value to the Ints 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 Ints field.
func (b *NamedResourcesIntSliceApplyConfiguration) WithInts(values ...int64) *NamedResourcesIntSliceApplyConfiguration {
for i := range values {
b.Ints = append(b.Ints, values[i])
}
return b
}

View File

@ -0,0 +1,39 @@
/*
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 v1alpha2
// NamedResourcesRequestApplyConfiguration represents an declarative configuration of the NamedResourcesRequest type for use
// with apply.
type NamedResourcesRequestApplyConfiguration struct {
Selector *string `json:"selector,omitempty"`
}
// NamedResourcesRequestApplyConfiguration constructs an declarative configuration of the NamedResourcesRequest type for use with
// apply.
func NamedResourcesRequest() *NamedResourcesRequestApplyConfiguration {
return &NamedResourcesRequestApplyConfiguration{}
}
// WithSelector sets the Selector 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 Selector field is set to the value of the last call.
func (b *NamedResourcesRequestApplyConfiguration) WithSelector(value string) *NamedResourcesRequestApplyConfiguration {
b.Selector = &value
return b
}

View File

@ -0,0 +1,44 @@
/*
Copyright The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// Code generated by applyconfiguration-gen. DO NOT EDIT.
package v1alpha2
// NamedResourcesResourcesApplyConfiguration represents an declarative configuration of the NamedResourcesResources type for use
// with apply.
type NamedResourcesResourcesApplyConfiguration struct {
Instances []NamedResourcesInstanceApplyConfiguration `json:"instances,omitempty"`
}
// NamedResourcesResourcesApplyConfiguration constructs an declarative configuration of the NamedResourcesResources type for use with
// apply.
func NamedResourcesResources() *NamedResourcesResourcesApplyConfiguration {
return &NamedResourcesResourcesApplyConfiguration{}
}
// WithInstances adds the given value to the Instances 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 Instances field.
func (b *NamedResourcesResourcesApplyConfiguration) WithInstances(values ...*NamedResourcesInstanceApplyConfiguration) *NamedResourcesResourcesApplyConfiguration {
for i := range values {
if values[i] == nil {
panic("nil value passed to WithInstances")
}
b.Instances = append(b.Instances, *values[i])
}
return b
}

View File

@ -0,0 +1,41 @@
/*
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 v1alpha2
// NamedResourcesStringSliceApplyConfiguration represents an declarative configuration of the NamedResourcesStringSlice type for use
// with apply.
type NamedResourcesStringSliceApplyConfiguration struct {
Strings []string `json:"strings,omitempty"`
}
// NamedResourcesStringSliceApplyConfiguration constructs an declarative configuration of the NamedResourcesStringSlice type for use with
// apply.
func NamedResourcesStringSlice() *NamedResourcesStringSliceApplyConfiguration {
return &NamedResourcesStringSliceApplyConfiguration{}
}
// WithStrings adds the given value to the Strings 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 Strings field.
func (b *NamedResourcesStringSliceApplyConfiguration) WithStrings(values ...string) *NamedResourcesStringSliceApplyConfiguration {
for i := range values {
b.Strings = append(b.Strings, values[i])
}
return b
}

View File

@ -0,0 +1,39 @@
/*
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 v1alpha2
// NodeResourceModelApplyConfiguration represents an declarative configuration of the NodeResourceModel type for use
// with apply.
type NodeResourceModelApplyConfiguration struct {
NamedResources *NamedResourcesResourcesApplyConfiguration `json:"namedResources,omitempty"`
}
// NodeResourceModelApplyConfiguration constructs an declarative configuration of the NodeResourceModel type for use with
// apply.
func NodeResourceModel() *NodeResourceModelApplyConfiguration {
return &NodeResourceModelApplyConfiguration{}
}
// WithNamedResources sets the NamedResources 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 NamedResources field is set to the value of the last call.
func (b *NodeResourceModelApplyConfiguration) WithNamedResources(value *NamedResourcesResourcesApplyConfiguration) *NodeResourceModelApplyConfiguration {
b.NamedResources = value
return b
}

View File

@ -19,7 +19,7 @@ limitations under the License.
package v1alpha2
import (
v1alpha2 "k8s.io/api/resource/v1alpha2"
resourcev1alpha2 "k8s.io/api/resource/v1alpha2"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
managedfields "k8s.io/apimachinery/pkg/util/managedfields"
@ -30,11 +30,11 @@ import (
// NodeResourceSliceApplyConfiguration represents an declarative configuration of the NodeResourceSlice type for use
// with apply.
type NodeResourceSliceApplyConfiguration struct {
v1.TypeMetaApplyConfiguration `json:",inline"`
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
NodeName *string `json:"nodeName,omitempty"`
DriverName *string `json:"driverName,omitempty"`
v1alpha2.NodeResourceModel `json:",inline"`
v1.TypeMetaApplyConfiguration `json:",inline"`
*v1.ObjectMetaApplyConfiguration `json:"metadata,omitempty"`
NodeName *string `json:"nodeName,omitempty"`
DriverName *string `json:"driverName,omitempty"`
NodeResourceModelApplyConfiguration `json:",inline"`
}
// NodeResourceSlice constructs an declarative configuration of the NodeResourceSlice type for use with
@ -58,18 +58,18 @@ func NodeResourceSlice(name string) *NodeResourceSliceApplyConfiguration {
// 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.
// Experimental!
func ExtractNodeResourceSlice(nodeResourceSlice *v1alpha2.NodeResourceSlice, fieldManager string) (*NodeResourceSliceApplyConfiguration, error) {
func ExtractNodeResourceSlice(nodeResourceSlice *resourcev1alpha2.NodeResourceSlice, fieldManager string) (*NodeResourceSliceApplyConfiguration, error) {
return extractNodeResourceSlice(nodeResourceSlice, fieldManager, "")
}
// ExtractNodeResourceSliceStatus is the same as ExtractNodeResourceSlice except
// that it extracts the status subresource applied configuration.
// Experimental!
func ExtractNodeResourceSliceStatus(nodeResourceSlice *v1alpha2.NodeResourceSlice, fieldManager string) (*NodeResourceSliceApplyConfiguration, error) {
func ExtractNodeResourceSliceStatus(nodeResourceSlice *resourcev1alpha2.NodeResourceSlice, fieldManager string) (*NodeResourceSliceApplyConfiguration, error) {
return extractNodeResourceSlice(nodeResourceSlice, fieldManager, "status")
}
func extractNodeResourceSlice(nodeResourceSlice *v1alpha2.NodeResourceSlice, fieldManager string, subresource string) (*NodeResourceSliceApplyConfiguration, error) {
func extractNodeResourceSlice(nodeResourceSlice *resourcev1alpha2.NodeResourceSlice, fieldManager string, subresource string) (*NodeResourceSliceApplyConfiguration, error) {
b := &NodeResourceSliceApplyConfiguration{}
err := managedfields.ExtractInto(nodeResourceSlice, internal.Parser().Type("io.k8s.api.resource.v1alpha2.NodeResourceSlice"), fieldManager, b, subresource)
if err != nil {
@ -255,3 +255,11 @@ func (b *NodeResourceSliceApplyConfiguration) WithDriverName(value string) *Node
b.DriverName = &value
return b
}
// WithNamedResources sets the NamedResources 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 NamedResources field is set to the value of the last call.
func (b *NodeResourceSliceApplyConfiguration) WithNamedResources(value *NamedResourcesResourcesApplyConfiguration) *NodeResourceSliceApplyConfiguration {
b.NamedResources = value
return b
}

View File

@ -18,15 +18,11 @@ limitations under the License.
package v1alpha2
import (
v1alpha2 "k8s.io/api/resource/v1alpha2"
)
// ResourceFilterApplyConfiguration represents an declarative configuration of the ResourceFilter type for use
// with apply.
type ResourceFilterApplyConfiguration struct {
DriverName *string `json:"driverName,omitempty"`
v1alpha2.ResourceFilterModel `json:",inline"`
DriverName *string `json:"driverName,omitempty"`
ResourceFilterModelApplyConfiguration `json:",inline"`
}
// ResourceFilterApplyConfiguration constructs an declarative configuration of the ResourceFilter type for use with
@ -42,3 +38,11 @@ func (b *ResourceFilterApplyConfiguration) WithDriverName(value string) *Resourc
b.DriverName = &value
return b
}
// WithNamedResources sets the NamedResources 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 NamedResources field is set to the value of the last call.
func (b *ResourceFilterApplyConfiguration) WithNamedResources(value *NamedResourcesFilterApplyConfiguration) *ResourceFilterApplyConfiguration {
b.NamedResources = value
return b
}

View File

@ -0,0 +1,39 @@
/*
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 v1alpha2
// ResourceFilterModelApplyConfiguration represents an declarative configuration of the ResourceFilterModel type for use
// with apply.
type ResourceFilterModelApplyConfiguration struct {
NamedResources *NamedResourcesFilterApplyConfiguration `json:"namedResources,omitempty"`
}
// ResourceFilterModelApplyConfiguration constructs an declarative configuration of the ResourceFilterModel type for use with
// apply.
func ResourceFilterModel() *ResourceFilterModelApplyConfiguration {
return &ResourceFilterModelApplyConfiguration{}
}
// WithNamedResources sets the NamedResources 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 NamedResources field is set to the value of the last call.
func (b *ResourceFilterModelApplyConfiguration) WithNamedResources(value *NamedResourcesFilterApplyConfiguration) *ResourceFilterModelApplyConfiguration {
b.NamedResources = value
return b
}

View File

@ -19,15 +19,14 @@ limitations under the License.
package v1alpha2
import (
v1alpha2 "k8s.io/api/resource/v1alpha2"
runtime "k8s.io/apimachinery/pkg/runtime"
)
// ResourceRequestApplyConfiguration represents an declarative configuration of the ResourceRequest type for use
// with apply.
type ResourceRequestApplyConfiguration struct {
VendorParameters *runtime.RawExtension `json:"vendorParameters,omitempty"`
v1alpha2.ResourceRequestModel `json:",inline"`
VendorParameters *runtime.RawExtension `json:"vendorParameters,omitempty"`
ResourceRequestModelApplyConfiguration `json:",inline"`
}
// ResourceRequestApplyConfiguration constructs an declarative configuration of the ResourceRequest type for use with
@ -43,3 +42,11 @@ func (b *ResourceRequestApplyConfiguration) WithVendorParameters(value runtime.R
b.VendorParameters = &value
return b
}
// WithNamedResources sets the NamedResources 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 NamedResources field is set to the value of the last call.
func (b *ResourceRequestApplyConfiguration) WithNamedResources(value *NamedResourcesRequestApplyConfiguration) *ResourceRequestApplyConfiguration {
b.NamedResources = value
return b
}

View File

@ -0,0 +1,39 @@
/*
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 v1alpha2
// ResourceRequestModelApplyConfiguration represents an declarative configuration of the ResourceRequestModel type for use
// with apply.
type ResourceRequestModelApplyConfiguration struct {
NamedResources *NamedResourcesRequestApplyConfiguration `json:"namedResources,omitempty"`
}
// ResourceRequestModelApplyConfiguration constructs an declarative configuration of the ResourceRequestModel type for use with
// apply.
func ResourceRequestModel() *ResourceRequestModelApplyConfiguration {
return &ResourceRequestModelApplyConfiguration{}
}
// WithNamedResources sets the NamedResources 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 NamedResources field is set to the value of the last call.
func (b *ResourceRequestModelApplyConfiguration) WithNamedResources(value *NamedResourcesRequestApplyConfiguration) *ResourceRequestModelApplyConfiguration {
b.NamedResources = value
return b
}

View File

@ -1527,10 +1527,32 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
// Group=resource.k8s.io, Version=v1alpha2
case v1alpha2.SchemeGroupVersion.WithKind("AllocationResult"):
return &resourcev1alpha2.AllocationResultApplyConfiguration{}
case v1alpha2.SchemeGroupVersion.WithKind("AllocationResultModel"):
return &resourcev1alpha2.AllocationResultModelApplyConfiguration{}
case v1alpha2.SchemeGroupVersion.WithKind("DriverAllocationResult"):
return &resourcev1alpha2.DriverAllocationResultApplyConfiguration{}
case v1alpha2.SchemeGroupVersion.WithKind("DriverRequests"):
return &resourcev1alpha2.DriverRequestsApplyConfiguration{}
case v1alpha2.SchemeGroupVersion.WithKind("NamedResourcesAllocationResult"):
return &resourcev1alpha2.NamedResourcesAllocationResultApplyConfiguration{}
case v1alpha2.SchemeGroupVersion.WithKind("NamedResourcesAttribute"):
return &resourcev1alpha2.NamedResourcesAttributeApplyConfiguration{}
case v1alpha2.SchemeGroupVersion.WithKind("NamedResourcesAttributeValue"):
return &resourcev1alpha2.NamedResourcesAttributeValueApplyConfiguration{}
case v1alpha2.SchemeGroupVersion.WithKind("NamedResourcesFilter"):
return &resourcev1alpha2.NamedResourcesFilterApplyConfiguration{}
case v1alpha2.SchemeGroupVersion.WithKind("NamedResourcesInstance"):
return &resourcev1alpha2.NamedResourcesInstanceApplyConfiguration{}
case v1alpha2.SchemeGroupVersion.WithKind("NamedResourcesIntSlice"):
return &resourcev1alpha2.NamedResourcesIntSliceApplyConfiguration{}
case v1alpha2.SchemeGroupVersion.WithKind("NamedResourcesRequest"):
return &resourcev1alpha2.NamedResourcesRequestApplyConfiguration{}
case v1alpha2.SchemeGroupVersion.WithKind("NamedResourcesResources"):
return &resourcev1alpha2.NamedResourcesResourcesApplyConfiguration{}
case v1alpha2.SchemeGroupVersion.WithKind("NamedResourcesStringSlice"):
return &resourcev1alpha2.NamedResourcesStringSliceApplyConfiguration{}
case v1alpha2.SchemeGroupVersion.WithKind("NodeResourceModel"):
return &resourcev1alpha2.NodeResourceModelApplyConfiguration{}
case v1alpha2.SchemeGroupVersion.WithKind("NodeResourceSlice"):
return &resourcev1alpha2.NodeResourceSliceApplyConfiguration{}
case v1alpha2.SchemeGroupVersion.WithKind("PodSchedulingContext"):
@ -1565,10 +1587,14 @@ func ForKind(kind schema.GroupVersionKind) interface{} {
return &resourcev1alpha2.ResourceClassParametersReferenceApplyConfiguration{}
case v1alpha2.SchemeGroupVersion.WithKind("ResourceFilter"):
return &resourcev1alpha2.ResourceFilterApplyConfiguration{}
case v1alpha2.SchemeGroupVersion.WithKind("ResourceFilterModel"):
return &resourcev1alpha2.ResourceFilterModelApplyConfiguration{}
case v1alpha2.SchemeGroupVersion.WithKind("ResourceHandle"):
return &resourcev1alpha2.ResourceHandleApplyConfiguration{}
case v1alpha2.SchemeGroupVersion.WithKind("ResourceRequest"):
return &resourcev1alpha2.ResourceRequestApplyConfiguration{}
case v1alpha2.SchemeGroupVersion.WithKind("ResourceRequestModel"):
return &resourcev1alpha2.ResourceRequestModelApplyConfiguration{}
case v1alpha2.SchemeGroupVersion.WithKind("StructuredResourceHandle"):
return &resourcev1alpha2.StructuredResourceHandleApplyConfiguration{}
case v1alpha2.SchemeGroupVersion.WithKind("VendorParameters"):