From 32214631ebc2f70f92c4c9eca1f3ac2d8cb0c335 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Arango Gutierrez Date: Fri, 25 Oct 2024 08:04:10 +0200 Subject: [PATCH] DRA: generate deepcopy for DriverResources Signed-off-by: Carlos Eduardo Arango Gutierrez --- .../resourceslice/resourceslicecontroller.go | 6 ++ .../resourceslice/zz_generated.deepcopy.go | 94 +++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 staging/src/k8s.io/dynamic-resource-allocation/resourceslice/zz_generated.deepcopy.go diff --git a/staging/src/k8s.io/dynamic-resource-allocation/resourceslice/resourceslicecontroller.go b/staging/src/k8s.io/dynamic-resource-allocation/resourceslice/resourceslicecontroller.go index ca320eee97c..0f869181197 100644 --- a/staging/src/k8s.io/dynamic-resource-allocation/resourceslice/resourceslicecontroller.go +++ b/staging/src/k8s.io/dynamic-resource-allocation/resourceslice/resourceslicecontroller.go @@ -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 { diff --git a/staging/src/k8s.io/dynamic-resource-allocation/resourceslice/zz_generated.deepcopy.go b/staging/src/k8s.io/dynamic-resource-allocation/resourceslice/zz_generated.deepcopy.go new file mode 100644 index 00000000000..82d68f3ae0f --- /dev/null +++ b/staging/src/k8s.io/dynamic-resource-allocation/resourceslice/zz_generated.deepcopy.go @@ -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 +}