Merge pull request #128331 from ArangoGutierrez/devel/driverresources.deepcopy

DRA: generate deepcopy for DriverResources
This commit is contained in:
Kubernetes Prow Robot 2024-10-25 12:42:52 +01:00 committed by GitHub
commit 8b063a6a08
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 100 additions and 0 deletions

View File

@ -73,12 +73,16 @@ type Controller struct {
resources *DriverResources
}
// +k8s:deepcopy-gen=true
// DriverResources is a complete description of all resources synchronized by the controller.
type DriverResources struct {
// Each driver may manage different resource pools.
Pools map[string]Pool
}
// +k8s:deepcopy-gen=true
// Pool is the collection of devices belonging to the same pool.
type Pool struct {
// NodeSelector may be different for each pool. Must not get set together
@ -94,6 +98,8 @@ type Pool struct {
Devices []resourceapi.Device
}
// +k8s:deepcopy-gen=true
// Owner is the resource which is meant to be listed as owner of the resource slices.
// For a node the UID may be left blank. The controller will look it up automatically.
type Owner struct {

View File

@ -0,0 +1,94 @@
//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 deepcopy-gen. DO NOT EDIT.
package resourceslice
import (
v1 "k8s.io/api/core/v1"
v1alpha3 "k8s.io/api/resource/v1alpha3"
)
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *DriverResources) DeepCopyInto(out *DriverResources) {
*out = *in
if in.Pools != nil {
in, out := &in.Pools, &out.Pools
*out = make(map[string]Pool, len(*in))
for key, val := range *in {
(*out)[key] = *val.DeepCopy()
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DriverResources.
func (in *DriverResources) DeepCopy() *DriverResources {
if in == nil {
return nil
}
out := new(DriverResources)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Owner) DeepCopyInto(out *Owner) {
*out = *in
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Owner.
func (in *Owner) DeepCopy() *Owner {
if in == nil {
return nil
}
out := new(Owner)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Pool) DeepCopyInto(out *Pool) {
*out = *in
if in.NodeSelector != nil {
in, out := &in.NodeSelector, &out.NodeSelector
*out = new(v1.NodeSelector)
(*in).DeepCopyInto(*out)
}
if in.Devices != nil {
in, out := &in.Devices, &out.Devices
*out = make([]v1alpha3.Device, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
return
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Pool.
func (in *Pool) DeepCopy() *Pool {
if in == nil {
return nil
}
out := new(Pool)
in.DeepCopyInto(out)
return out
}