feat: implement DeepCopy using code generation

Refactor every typed.Resource except KubeletConfigSpec to use deep-copy tool for generating DeepCopy method.

KubeletConfigSpec is excluded because its DeepCopy method is not trivial.

Signed-off-by: Dmitriy Matrenichev <dmitry.matrenichev@siderolabs.com>
This commit is contained in:
Dmitriy Matrenichev 2022-05-12 22:50:39 +08:00
parent 91a49c4e7c
commit a6e4365823
No known key found for this signature in database
GPG Key ID: D3363CF894E68892
78 changed files with 875 additions and 467 deletions

View File

@ -102,6 +102,9 @@ RUN go install golang.org/x/tools/cmd/goimports@${GOIMPORTS_VERSION} \
ARG GOFUMPT_VERSION
RUN go install mvdan.cc/gofumpt@${GOFUMPT_VERSION} \
&& mv /go/bin/gofumpt /toolchain/go/bin/gofumpt
ARG DEEPCOPY_VERSION
RUN go install github.com/siderolabs/deep-copy@${DEEPCOPY_VERSION} \
&& mv /go/bin/deep-copy /toolchain/go/bin/deep-copy
ARG STRINGER_VERSION
RUN go install golang.org/x/tools/cmd/stringer@${STRINGER_VERSION} \
&& mv /go/bin/stringer /toolchain/go/bin/stringer

View File

@ -24,6 +24,7 @@ STRINGER_VERSION ?= v0.1.10
ENUMER_VERSION ?= v1.1.2
DEEPCOPY_GEN_VERSION ?= v0.21.3
VTPROTOBUF_VERSION ?= v0.2.0
DEEPCOPY_VERSION ?= v0.5.5
IMPORTVET ?= ghcr.io/siderolabs/importvet:1549a5c
OPERATING_SYSTEM := $(shell uname -s | tr "[:upper:]" "[:lower:]")
TALOSCTL_DEFAULT_TARGET := talosctl-$(OPERATING_SYSTEM)
@ -82,6 +83,7 @@ COMMON_ARGS += --build-arg=ENUMER_VERSION=$(ENUMER_VERSION)
COMMON_ARGS += --build-arg=DEEPCOPY_GEN_VERSION=$(DEEPCOPY_GEN_VERSION)
COMMON_ARGS += --build-arg=VTPROTOBUF_VERSION=$(VTPROTOBUF_VERSION)
COMMON_ARGS += --build-arg=GOLANGCILINT_VERSION=$(GOLANGCILINT_VERSION)
COMMON_ARGS += --build-arg=DEEPCOPY_VERSION=$(DEEPCOPY_VERSION)
COMMON_ARGS += --build-arg=TAG=$(TAG)
COMMON_ARGS += --build-arg=SOURCE_DATE_EPOCH=$(SOURCE_DATE_EPOCH)
COMMON_ARGS += --build-arg=ARTIFACTS=$(ARTIFACTS)

View File

@ -10,6 +10,9 @@ import (
"gopkg.in/yaml.v3"
)
//nolint:lll
//go:generate deep-copy -type Layer -header-file ../../../hack/boilerplate.txt -o deep_copy.generated.go .
// Config specifies Talos installer extensions configuration.
type Config struct {
Layers []*Layer `yaml:"layers"`
@ -44,8 +47,3 @@ func (cfg *Config) Write(path string) error {
return yaml.NewEncoder(f).Encode(cfg)
}
// DeepCopy implements DeepCopyable.
func (layer Layer) DeepCopy() Layer {
return layer
}

View File

@ -0,0 +1,13 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Code generated by "deep-copy -type Layer -header-file ../../../hack/boilerplate.txt -o deep_copy.generated.go ."; DO NOT EDIT.
package extensions
// DeepCopy generates a deep copy of Layer.
func (o Layer) DeepCopy() Layer {
var cp Layer = o
return cp
}

View File

@ -13,6 +13,8 @@ import (
"github.com/talos-systems/talos/pkg/machinery/config/types/v1alpha1/machine"
)
//go:generate deep-copy -type AffiliateSpec -type IdentitySpec -type MemberSpec -type ConfigSpec -header-file ../../../../hack/boilerplate.txt -o deep_copy.generated.go .
// AffiliateType is type of Affiliate resource.
const AffiliateType = resource.Type("Affiliates.cluster.talos.dev")
@ -74,27 +76,6 @@ type AffiliateSpec struct {
KubeSpan KubeSpanAffiliateSpec `yaml:"kubespan,omitempty"`
}
// DeepCopy generates a deep copy of AffiliateSpec.
func (spec AffiliateSpec) DeepCopy() AffiliateSpec {
cp := spec
if spec.Addresses != nil {
cp.Addresses = make([]netaddr.IP, len(spec.Addresses))
copy(cp.Addresses, spec.Addresses)
}
if spec.KubeSpan.AdditionalAddresses != nil {
cp.KubeSpan.AdditionalAddresses = make([]netaddr.IPPrefix, len(spec.KubeSpan.AdditionalAddresses))
copy(cp.KubeSpan.AdditionalAddresses, spec.KubeSpan.AdditionalAddresses)
}
if spec.KubeSpan.Endpoints != nil {
cp.KubeSpan.Endpoints = make([]netaddr.IPPort, len(spec.KubeSpan.Endpoints))
copy(cp.KubeSpan.Endpoints, spec.KubeSpan.Endpoints)
}
return cp
}
// Merge two AffiliateSpecs.
//
//nolint:gocyclo

View File

@ -32,17 +32,6 @@ type ConfigSpec struct {
ServiceClusterID string `yaml:"serviceClusterID"`
}
// DeepCopy generates a deep copy of ConfigSpec.
func (cs ConfigSpec) DeepCopy() ConfigSpec {
cp := cs
if cs.ServiceEncryptionKey != nil {
cp.ServiceEncryptionKey = make([]byte, len(cs.ServiceEncryptionKey))
copy(cp.ServiceEncryptionKey, cs.ServiceEncryptionKey)
}
return cp
}
// NewConfig initializes a Config resource.
func NewConfig(namespace resource.Namespace, id resource.ID) *Config {
return typed.NewResource[ConfigSpec, ConfigRD](

View File

@ -0,0 +1,55 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Code generated by "deep-copy -type AffiliateSpec -type IdentitySpec -type MemberSpec -type ConfigSpec -header-file ../../../../hack/boilerplate.txt -o deep_copy.generated.go ."; DO NOT EDIT.
package cluster
import (
"inet.af/netaddr"
)
// DeepCopy generates a deep copy of AffiliateSpec.
func (o AffiliateSpec) DeepCopy() AffiliateSpec {
var cp AffiliateSpec = o
if o.Addresses != nil {
cp.Addresses = make([]netaddr.IP, len(o.Addresses))
copy(cp.Addresses, o.Addresses)
}
if o.KubeSpan.AdditionalAddresses != nil {
cp.KubeSpan.AdditionalAddresses = make([]netaddr.IPPrefix, len(o.KubeSpan.AdditionalAddresses))
copy(cp.KubeSpan.AdditionalAddresses, o.KubeSpan.AdditionalAddresses)
}
if o.KubeSpan.Endpoints != nil {
cp.KubeSpan.Endpoints = make([]netaddr.IPPort, len(o.KubeSpan.Endpoints))
copy(cp.KubeSpan.Endpoints, o.KubeSpan.Endpoints)
}
return cp
}
// DeepCopy generates a deep copy of IdentitySpec.
func (o IdentitySpec) DeepCopy() IdentitySpec {
var cp IdentitySpec = o
return cp
}
// DeepCopy generates a deep copy of MemberSpec.
func (o MemberSpec) DeepCopy() MemberSpec {
var cp MemberSpec = o
if o.Addresses != nil {
cp.Addresses = make([]netaddr.IP, len(o.Addresses))
copy(cp.Addresses, o.Addresses)
}
return cp
}
// DeepCopy generates a deep copy of ConfigSpec.
func (o ConfigSpec) DeepCopy() ConfigSpec {
var cp ConfigSpec = o
if o.ServiceEncryptionKey != nil {
cp.ServiceEncryptionKey = make([]byte, len(o.ServiceEncryptionKey))
copy(cp.ServiceEncryptionKey, o.ServiceEncryptionKey)
}
return cp
}

View File

@ -29,11 +29,6 @@ type IdentitySpec struct {
NodeID string `yaml:"nodeId"`
}
// DeepCopy generates a deep copy of IdentitySpec.
func (spec IdentitySpec) DeepCopy() IdentitySpec {
return spec
}
// NewIdentity initializes a Identity resource.
func NewIdentity(namespace resource.Namespace, id resource.ID) *Identity {
return typed.NewResource[IdentitySpec, IdentityRD](

View File

@ -30,17 +30,6 @@ type MemberSpec struct {
OperatingSystem string `yaml:"operatingSystem"`
}
// DeepCopy generates a deep copy of MemberSpec.
func (spec MemberSpec) DeepCopy() MemberSpec {
cp := spec
if spec.Addresses != nil {
cp.Addresses = make([]netaddr.IP, len(spec.Addresses))
copy(cp.Addresses, spec.Addresses)
}
return cp
}
// NewMember initializes a Member resource.
func NewMember(namespace resource.Namespace, id resource.ID) *Member {
return typed.NewResource[MemberSpec, MemberRD](

View File

@ -0,0 +1,23 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Code generated by "deep-copy -type EtcFileSpecSpec -type EtcFileStatusSpec -header-file ../../../../hack/boilerplate.txt -o deep_copy.generated.go ."; DO NOT EDIT.
package files
// DeepCopy generates a deep copy of EtcFileSpecSpec.
func (o EtcFileSpecSpec) DeepCopy() EtcFileSpecSpec {
var cp EtcFileSpecSpec = o
if o.Contents != nil {
cp.Contents = make([]byte, len(o.Contents))
copy(cp.Contents, o.Contents)
}
return cp
}
// DeepCopy generates a deep copy of EtcFileStatusSpec.
func (o EtcFileStatusSpec) DeepCopy() EtcFileStatusSpec {
var cp EtcFileStatusSpec = o
return cp
}

View File

@ -12,6 +12,8 @@ import (
"github.com/cosi-project/runtime/pkg/resource/typed"
)
//go:generate deep-copy -type EtcFileSpecSpec -type EtcFileStatusSpec -header-file ../../../../hack/boilerplate.txt -o deep_copy.generated.go .
// EtcFileSpecType is type of EtcFile resource.
const EtcFileSpecType = resource.Type("EtcFileSpecs.files.talos.dev")
@ -24,14 +26,6 @@ type EtcFileSpecSpec struct {
Mode fs.FileMode `yaml:"mode"`
}
// DeepCopy implements typed.DeepCopyable interface.
func (e EtcFileSpecSpec) DeepCopy() EtcFileSpecSpec {
return EtcFileSpecSpec{
Contents: append([]byte(nil), e.Contents...),
Mode: e.Mode,
}
}
// NewEtcFileSpec initializes a EtcFileSpec resource.
func NewEtcFileSpec(namespace resource.Namespace, id resource.ID) *EtcFileSpec {
return typed.NewResource[EtcFileSpecSpec, EtcFileSpecMD](

View File

@ -21,11 +21,6 @@ type EtcFileStatusSpec struct {
SpecVersion string `yaml:"specVersion"`
}
// DeepCopy implements typed.DeepCopyable interface.
func (e EtcFileStatusSpec) DeepCopy() EtcFileStatusSpec {
return e
}
// NewEtcFileStatus initializes a EtcFileStatus resource.
func NewEtcFileStatus(namespace resource.Namespace, id resource.ID) *EtcFileStatus {
return typed.NewResource[EtcFileStatusSpec, EtcFileStatusMD](

View File

@ -13,6 +13,9 @@ import (
"github.com/cosi-project/runtime/pkg/resource/typed"
)
//nolint:lll
//go:generate deep-copy -type AdmissionControlConfigSpec -type APIServerConfigSpec -type ConfigStatusSpec -type ControllerManagerConfigSpec -type EndpointSpec -type ExtraManifestsConfigSpec -type KubeletLifecycleSpec -type KubeletSpecSpec -type ManifestSpec -type ManifestStatusSpec -type BootstrapManifestsConfigSpec -type NodeIPSpec -type NodeIPConfigSpec -type NodenameSpec -type SchedulerConfigSpec -type SecretsStatusSpec -type StaticPodSpec -type StaticPodStatusSpec -header-file ../../../../hack/boilerplate.txt -o deep_copy.generated.go .
// AdmissionControlConfigType is type of AdmissionControlConfig resource.
const AdmissionControlConfigType = resource.Type("AdmissionControlConfigs.kubernetes.talos.dev")
@ -33,13 +36,6 @@ type AdmissionPluginSpec struct {
Configuration map[string]interface{} `yaml:"configuration"`
}
// DeepCopy implements Deepcopyable.
//
// TODO: should be properly go-generated.
func (spec AdmissionControlConfigSpec) DeepCopy() AdmissionControlConfigSpec {
return spec
}
// NewAdmissionControlConfig returns new AdmissionControlConfig resource.
func NewAdmissionControlConfig() *AdmissionControlConfig {
return typed.NewResource[AdmissionControlConfigSpec, AdmissionControlConfigRD](

View File

@ -44,13 +44,6 @@ type APIServerConfigSpec struct {
PodSecurityPolicyEnabled bool `yaml:"podSecurityPolicyEnabled"`
}
// DeepCopy implements Deepcopyable.
//
// TODO: should be properly go-generated.
func (spec APIServerConfigSpec) DeepCopy() APIServerConfigSpec {
return spec
}
// NewAPIServerConfig returns new APIServerConfig resource.
func NewAPIServerConfig() *APIServerConfig {
return typed.NewResource[APIServerConfigSpec, APIServerConfigRD](

View File

@ -28,9 +28,6 @@ type ConfigStatusSpec struct {
Version string `yaml:"version"`
}
// DeepCopy implements typed.DeepCopyable interface.
func (spec ConfigStatusSpec) DeepCopy() ConfigStatusSpec { return spec }
// NewConfigStatus initializes a ConfigStatus resource.
func NewConfigStatus(namespace resource.Namespace, id resource.ID) *ConfigStatus {
return typed.NewResource[ConfigStatusSpec, ConfigStatusRD](

View File

@ -34,13 +34,6 @@ type ControllerManagerConfigSpec struct {
EnvironmentVariables map[string]string `yaml:"environmentVariables"`
}
// DeepCopy implements Deepcopyable.
//
// TODO: should be properly go-generated.
func (spec ControllerManagerConfigSpec) DeepCopy() ControllerManagerConfigSpec {
return spec
}
// NewControllerManagerConfig returns new ControllerManagerConfig resource.
func NewControllerManagerConfig() *ControllerManagerConfig {
return typed.NewResource[ControllerManagerConfigSpec, ControllerManagerConfigRD](

View File

@ -0,0 +1,280 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Code generated by "deep-copy -type AdmissionControlConfigSpec -type APIServerConfigSpec -type ConfigStatusSpec -type ControllerManagerConfigSpec -type EndpointSpec -type ExtraManifestsConfigSpec -type KubeletLifecycleSpec -type KubeletSpecSpec -type ManifestSpec -type ManifestStatusSpec -type BootstrapManifestsConfigSpec -type NodeIPSpec -type NodeIPConfigSpec -type NodenameSpec -type SchedulerConfigSpec -type SecretsStatusSpec -type StaticPodSpec -type StaticPodStatusSpec -header-file ../../../../hack/boilerplate.txt -o deep_copy.generated.go ."; DO NOT EDIT.
package k8s
import (
specs "github.com/opencontainers/runtime-spec/specs-go"
"inet.af/netaddr"
)
// DeepCopy generates a deep copy of AdmissionControlConfigSpec.
func (o AdmissionControlConfigSpec) DeepCopy() AdmissionControlConfigSpec {
var cp AdmissionControlConfigSpec = o
if o.Config != nil {
cp.Config = make([]AdmissionPluginSpec, len(o.Config))
copy(cp.Config, o.Config)
for i2 := range o.Config {
if o.Config[i2].Configuration != nil {
cp.Config[i2].Configuration = make(map[string]interface{}, len(o.Config[i2].Configuration))
for k4, v4 := range o.Config[i2].Configuration {
cp.Config[i2].Configuration[k4] = v4
}
}
}
}
return cp
}
// DeepCopy generates a deep copy of APIServerConfigSpec.
func (o APIServerConfigSpec) DeepCopy() APIServerConfigSpec {
var cp APIServerConfigSpec = o
if o.EtcdServers != nil {
cp.EtcdServers = make([]string, len(o.EtcdServers))
copy(cp.EtcdServers, o.EtcdServers)
}
if o.ServiceCIDRs != nil {
cp.ServiceCIDRs = make([]string, len(o.ServiceCIDRs))
copy(cp.ServiceCIDRs, o.ServiceCIDRs)
}
if o.ExtraArgs != nil {
cp.ExtraArgs = make(map[string]string, len(o.ExtraArgs))
for k2, v2 := range o.ExtraArgs {
cp.ExtraArgs[k2] = v2
}
}
if o.ExtraVolumes != nil {
cp.ExtraVolumes = make([]ExtraVolume, len(o.ExtraVolumes))
copy(cp.ExtraVolumes, o.ExtraVolumes)
}
if o.EnvironmentVariables != nil {
cp.EnvironmentVariables = make(map[string]string, len(o.EnvironmentVariables))
for k2, v2 := range o.EnvironmentVariables {
cp.EnvironmentVariables[k2] = v2
}
}
return cp
}
// DeepCopy generates a deep copy of ConfigStatusSpec.
func (o ConfigStatusSpec) DeepCopy() ConfigStatusSpec {
var cp ConfigStatusSpec = o
return cp
}
// DeepCopy generates a deep copy of ControllerManagerConfigSpec.
func (o ControllerManagerConfigSpec) DeepCopy() ControllerManagerConfigSpec {
var cp ControllerManagerConfigSpec = o
if o.PodCIDRs != nil {
cp.PodCIDRs = make([]string, len(o.PodCIDRs))
copy(cp.PodCIDRs, o.PodCIDRs)
}
if o.ServiceCIDRs != nil {
cp.ServiceCIDRs = make([]string, len(o.ServiceCIDRs))
copy(cp.ServiceCIDRs, o.ServiceCIDRs)
}
if o.ExtraArgs != nil {
cp.ExtraArgs = make(map[string]string, len(o.ExtraArgs))
for k2, v2 := range o.ExtraArgs {
cp.ExtraArgs[k2] = v2
}
}
if o.ExtraVolumes != nil {
cp.ExtraVolumes = make([]ExtraVolume, len(o.ExtraVolumes))
copy(cp.ExtraVolumes, o.ExtraVolumes)
}
if o.EnvironmentVariables != nil {
cp.EnvironmentVariables = make(map[string]string, len(o.EnvironmentVariables))
for k2, v2 := range o.EnvironmentVariables {
cp.EnvironmentVariables[k2] = v2
}
}
return cp
}
// DeepCopy generates a deep copy of EndpointSpec.
func (o EndpointSpec) DeepCopy() EndpointSpec {
var cp EndpointSpec = o
if o.Addresses != nil {
cp.Addresses = make([]netaddr.IP, len(o.Addresses))
copy(cp.Addresses, o.Addresses)
}
return cp
}
// DeepCopy generates a deep copy of ExtraManifestsConfigSpec.
func (o ExtraManifestsConfigSpec) DeepCopy() ExtraManifestsConfigSpec {
var cp ExtraManifestsConfigSpec = o
if o.ExtraManifests != nil {
cp.ExtraManifests = make([]ExtraManifest, len(o.ExtraManifests))
copy(cp.ExtraManifests, o.ExtraManifests)
for i2 := range o.ExtraManifests {
if o.ExtraManifests[i2].ExtraHeaders != nil {
cp.ExtraManifests[i2].ExtraHeaders = make(map[string]string, len(o.ExtraManifests[i2].ExtraHeaders))
for k4, v4 := range o.ExtraManifests[i2].ExtraHeaders {
cp.ExtraManifests[i2].ExtraHeaders[k4] = v4
}
}
}
}
return cp
}
// DeepCopy generates a deep copy of KubeletLifecycleSpec.
func (o KubeletLifecycleSpec) DeepCopy() KubeletLifecycleSpec {
var cp KubeletLifecycleSpec = o
return cp
}
// DeepCopy generates a deep copy of KubeletSpecSpec.
func (o KubeletSpecSpec) DeepCopy() KubeletSpecSpec {
var cp KubeletSpecSpec = o
if o.Args != nil {
cp.Args = make([]string, len(o.Args))
copy(cp.Args, o.Args)
}
if o.ExtraMounts != nil {
cp.ExtraMounts = make([]specs.Mount, len(o.ExtraMounts))
copy(cp.ExtraMounts, o.ExtraMounts)
for i2 := range o.ExtraMounts {
if o.ExtraMounts[i2].Options != nil {
cp.ExtraMounts[i2].Options = make([]string, len(o.ExtraMounts[i2].Options))
copy(cp.ExtraMounts[i2].Options, o.ExtraMounts[i2].Options)
}
}
}
if o.Config != nil {
cp.Config = make(map[string]interface{}, len(o.Config))
for k2, v2 := range o.Config {
cp.Config[k2] = v2
}
}
return cp
}
// DeepCopy generates a deep copy of ManifestSpec.
func (o ManifestSpec) DeepCopy() ManifestSpec {
var cp ManifestSpec = o
if o.Items != nil {
cp.Items = make([]map[string]interface{}, len(o.Items))
copy(cp.Items, o.Items)
for i2 := range o.Items {
if o.Items[i2] != nil {
cp.Items[i2] = make(map[string]interface{}, len(o.Items[i2]))
for k3, v3 := range o.Items[i2] {
cp.Items[i2][k3] = v3
}
}
}
}
return cp
}
// DeepCopy generates a deep copy of ManifestStatusSpec.
func (o ManifestStatusSpec) DeepCopy() ManifestStatusSpec {
var cp ManifestStatusSpec = o
if o.ManifestsApplied != nil {
cp.ManifestsApplied = make([]string, len(o.ManifestsApplied))
copy(cp.ManifestsApplied, o.ManifestsApplied)
}
return cp
}
// DeepCopy generates a deep copy of BootstrapManifestsConfigSpec.
func (o BootstrapManifestsConfigSpec) DeepCopy() BootstrapManifestsConfigSpec {
var cp BootstrapManifestsConfigSpec = o
if o.PodCIDRs != nil {
cp.PodCIDRs = make([]string, len(o.PodCIDRs))
copy(cp.PodCIDRs, o.PodCIDRs)
}
if o.ProxyArgs != nil {
cp.ProxyArgs = make([]string, len(o.ProxyArgs))
copy(cp.ProxyArgs, o.ProxyArgs)
}
return cp
}
// DeepCopy generates a deep copy of NodeIPSpec.
func (o NodeIPSpec) DeepCopy() NodeIPSpec {
var cp NodeIPSpec = o
if o.Addresses != nil {
cp.Addresses = make([]netaddr.IP, len(o.Addresses))
copy(cp.Addresses, o.Addresses)
}
return cp
}
// DeepCopy generates a deep copy of NodeIPConfigSpec.
func (o NodeIPConfigSpec) DeepCopy() NodeIPConfigSpec {
var cp NodeIPConfigSpec = o
if o.ValidSubnets != nil {
cp.ValidSubnets = make([]string, len(o.ValidSubnets))
copy(cp.ValidSubnets, o.ValidSubnets)
}
if o.ExcludeSubnets != nil {
cp.ExcludeSubnets = make([]string, len(o.ExcludeSubnets))
copy(cp.ExcludeSubnets, o.ExcludeSubnets)
}
return cp
}
// DeepCopy generates a deep copy of NodenameSpec.
func (o NodenameSpec) DeepCopy() NodenameSpec {
var cp NodenameSpec = o
return cp
}
// DeepCopy generates a deep copy of SchedulerConfigSpec.
func (o SchedulerConfigSpec) DeepCopy() SchedulerConfigSpec {
var cp SchedulerConfigSpec = o
if o.ExtraArgs != nil {
cp.ExtraArgs = make(map[string]string, len(o.ExtraArgs))
for k2, v2 := range o.ExtraArgs {
cp.ExtraArgs[k2] = v2
}
}
if o.ExtraVolumes != nil {
cp.ExtraVolumes = make([]ExtraVolume, len(o.ExtraVolumes))
copy(cp.ExtraVolumes, o.ExtraVolumes)
}
if o.EnvironmentVariables != nil {
cp.EnvironmentVariables = make(map[string]string, len(o.EnvironmentVariables))
for k2, v2 := range o.EnvironmentVariables {
cp.EnvironmentVariables[k2] = v2
}
}
return cp
}
// DeepCopy generates a deep copy of SecretsStatusSpec.
func (o SecretsStatusSpec) DeepCopy() SecretsStatusSpec {
var cp SecretsStatusSpec = o
return cp
}
// DeepCopy generates a deep copy of StaticPodSpec.
func (o StaticPodSpec) DeepCopy() StaticPodSpec {
var cp StaticPodSpec = o
if o.Pod != nil {
cp.Pod = make(map[string]interface{}, len(o.Pod))
for k2, v2 := range o.Pod {
cp.Pod[k2] = v2
}
}
return cp
}
// DeepCopy generates a deep copy of StaticPodStatusSpec.
func (o StaticPodStatusSpec) DeepCopy() StaticPodStatusSpec {
var cp StaticPodStatusSpec = o
if o.PodStatus != nil {
cp.PodStatus = make(map[string]interface{}, len(o.PodStatus))
for k2, v2 := range o.PodStatus {
cp.PodStatus[k2] = v2
}
}
return cp
}

View File

@ -30,14 +30,7 @@ type EndpointSpec struct {
Addresses []netaddr.IP `yaml:"addresses"`
}
// DeepCopy implements typed.DeepCopyable interface.
func (spec EndpointSpec) DeepCopy() EndpointSpec {
return EndpointSpec{
Addresses: append([]netaddr.IP(nil), spec.Addresses...),
}
}
// NewEndpoint initializes a Endpoint resource.
// NewEndpoint initializes the Endpoint resource.
func NewEndpoint(namespace resource.Namespace, id resource.ID) *Endpoint {
return typed.NewResource[EndpointSpec, EndpointRD](
resource.NewMetadata(namespace, EndpointType, id, resource.VersionUndefined),

View File

@ -36,13 +36,6 @@ type ExtraManifest struct {
InlineManifest string `yaml:"inlineManifest"`
}
// DeepCopy implements Deepcopyable.
//
// TODO: should be properly go-generated.
func (spec ExtraManifestsConfigSpec) DeepCopy() ExtraManifestsConfigSpec {
return spec
}
// NewExtraManifestsConfig returns new ExtraManifestsConfig resource.
func NewExtraManifestsConfig() *ExtraManifestsConfig {
return typed.NewResource[ExtraManifestsConfigSpec, ExtraManifestsConfigRD](

View File

@ -28,9 +28,6 @@ type KubeletLifecycle = typed.Resource[KubeletLifecycleSpec, KubeletLifecycleRD]
// KubeletLifecycleSpec is empty.
type KubeletLifecycleSpec struct{}
// DeepCopy implements typed.DeepCopyable interface.
func (spec KubeletLifecycleSpec) DeepCopy() KubeletLifecycleSpec { return spec }
// NewKubeletLifecycle initializes an empty KubeletLifecycle resource.
func NewKubeletLifecycle(namespace resource.Namespace, id resource.ID) *KubeletLifecycle {
return typed.NewResource[KubeletLifecycleSpec, KubeletLifecycleRD](

View File

@ -25,22 +25,6 @@ type KubeletSpecSpec struct {
Config map[string]interface{} `yaml:"config"`
}
// DeepCopy implements typed.DeepCopyable interface.
func (spec KubeletSpecSpec) DeepCopy() KubeletSpecSpec {
config := make(map[string]interface{}, len(spec.Config))
for k, v := range spec.Config {
config[k] = v
}
return KubeletSpecSpec{
Image: spec.Image,
Args: append([]string(nil), spec.Args...),
ExtraMounts: append([]specs.Mount(nil), spec.ExtraMounts...),
Config: config,
}
}
// NewKubeletSpec initializes an empty KubeletSpec resource.
func NewKubeletSpec(namespace resource.Namespace, id resource.ID) *KubeletSpec {
return typed.NewResource[KubeletSpecSpec, KubeletSpecRD](

View File

@ -21,13 +21,6 @@ type ManifestSpec struct {
Items []map[string]interface{}
}
// DeepCopy implements typed.DeepCopyable interface.
func (spec ManifestSpec) DeepCopy() ManifestSpec {
return ManifestSpec{
Items: append([]map[string]interface{}(nil), spec.Items...),
}
}
// MarshalYAML implements yaml.Marshaler.
func (spec ManifestSpec) MarshalYAML() (interface{}, error) {
return spec.Items, nil

View File

@ -24,9 +24,6 @@ type ManifestStatusSpec struct {
ManifestsApplied []string `yaml:"manifestsApplied"`
}
// DeepCopy implements typed.DeepCopyable interface.
func (spec ManifestStatusSpec) DeepCopy() ManifestStatusSpec { return spec }
// NewManifestStatus initializes an empty ManifestStatus resource.
func NewManifestStatus(namespace resource.Namespace) *ManifestStatus {
return typed.NewResource[ManifestStatusSpec, ManifestStatusRD](

View File

@ -46,13 +46,6 @@ type BootstrapManifestsConfigSpec struct {
PodSecurityPolicyEnabled bool `yaml:"podSecurityPolicyEnabled"`
}
// DeepCopy implements Deepcopyable.
//
// TODO: should be properly go-generated.
func (spec BootstrapManifestsConfigSpec) DeepCopy() BootstrapManifestsConfigSpec {
return spec
}
// NewBootstrapManifestsConfig returns new BootstrapManifestsConfig resource.
func NewBootstrapManifestsConfig() *BootstrapManifestsConfig {
return typed.NewResource[BootstrapManifestsConfigSpec, BootstrapManifestsConfigRD](

View File

@ -22,13 +22,6 @@ type NodeIPSpec struct {
Addresses []netaddr.IP `yaml:"addresses"`
}
// DeepCopy implements typed.DeepCopyable interface.
func (spec NodeIPSpec) DeepCopy() NodeIPSpec {
return NodeIPSpec{
Addresses: append([]netaddr.IP(nil), spec.Addresses...),
}
}
// NewNodeIP initializes an empty NodeIP resource.
func NewNodeIP(namespace resource.Namespace, id resource.ID) *NodeIP {
return typed.NewResource[NodeIPSpec, NodeIPRD](

View File

@ -22,14 +22,6 @@ type NodeIPConfigSpec struct {
ExcludeSubnets []string `yaml:"excludeSubnets"`
}
// DeepCopy implements typed.DeepCopyable interface.
func (spec NodeIPConfigSpec) DeepCopy() NodeIPConfigSpec {
return NodeIPConfigSpec{
ValidSubnets: append([]string(nil), spec.ValidSubnets...),
ExcludeSubnets: append([]string(nil), spec.ExcludeSubnets...),
}
}
// NewNodeIPConfig initializes an empty NodeIPConfig resource.
func NewNodeIPConfig(namespace resource.Namespace, id resource.ID) *NodeIPConfig {
return typed.NewResource[NodeIPConfigSpec, NodeIPConfigRD](

View File

@ -25,9 +25,6 @@ type NodenameSpec struct {
HostnameVersion string `yaml:"hostnameVersion"`
}
// DeepCopy implements typed.DeepCopyable interface.
func (spec NodenameSpec) DeepCopy() NodenameSpec { return spec }
// NewNodename initializes a Nodename resource.
func NewNodename(namespace resource.Namespace, id resource.ID) *Nodename {
return typed.NewResource[NodenameSpec, NodenameRD](

View File

@ -31,13 +31,6 @@ type SchedulerConfigSpec struct {
EnvironmentVariables map[string]string `yaml:"environmentVariables"`
}
// DeepCopy implements Deepcopyable.
//
// TODO: should be properly go-generated.
func (spec SchedulerConfigSpec) DeepCopy() SchedulerConfigSpec {
return spec
}
// NewSchedulerConfig returns new SchedulerConfig resource.
func NewSchedulerConfig() *SchedulerConfig {
return typed.NewResource[SchedulerConfigSpec, SchedulerConfigRD](

View File

@ -28,9 +28,6 @@ type SecretsStatusSpec struct {
Version string `yaml:"version"`
}
// DeepCopy implements typed.DeepCopyable interface.
func (spec SecretsStatusSpec) DeepCopy() SecretsStatusSpec { return spec }
// NewSecretsStatus initializes a SecretsStatus resource.
func NewSecretsStatus(namespace resource.Namespace, id resource.ID) *SecretsStatus {
return typed.NewResource[SecretsStatusSpec, SecretsStatusRD](

View File

@ -21,13 +21,6 @@ type StaticPodSpec struct {
Pod map[string]interface{}
}
// DeepCopy implements typed.DeepCopyable interface.
func (spec StaticPodSpec) DeepCopy() StaticPodSpec {
return StaticPodSpec{
Pod: copyMap(spec.Pod),
}
}
// MarshalYAML implements yaml.Marshaler.
func (spec StaticPodSpec) MarshalYAML() (interface{}, error) {
return spec.Pod, nil
@ -52,12 +45,3 @@ func (StaticPodRD) ResourceDefinition(resource.Metadata, StaticPodSpec) meta.Res
DefaultNamespace: NamespaceName,
}
}
func copyMap[K comparable, V any](m map[K]V) map[K]V {
result := make(map[K]V, len(m))
for k, v := range m {
result[k] = v
}
return result
}

View File

@ -21,13 +21,6 @@ type StaticPodStatusSpec struct {
PodStatus map[string]interface{}
}
// DeepCopy implements typed.DeepCopyable interface.
func (spec StaticPodStatusSpec) DeepCopy() StaticPodStatusSpec {
return StaticPodStatusSpec{
PodStatus: copyMap(spec.PodStatus),
}
}
// MarshalYAML implements yaml.Marshaler.
func (spec StaticPodStatusSpec) MarshalYAML() (interface{}, error) {
return spec.PodStatus, nil

View File

@ -12,6 +12,9 @@ import (
"github.com/talos-systems/talos/pkg/machinery/resources/config"
)
//nolint:lll
//go:generate deep-copy -type ConfigSpec -type EndpointSpec -type IdentitySpec -type PeerSpecSpec -type PeerStatusSpec -header-file ../../../../hack/boilerplate.txt -o deep_copy.generated.go .
// ConfigType is type of Config resource.
const ConfigType = resource.Type("KubeSpanConfigs.kubespan.talos.dev")
@ -30,9 +33,6 @@ type ConfigSpec struct {
ForceRouting bool `yaml:"forceRouting"`
}
// DeepCopy implements typed.DeepCopyable interface.
func (spec ConfigSpec) DeepCopy() ConfigSpec { return spec }
// NewConfig initializes a Config resource.
func NewConfig(namespace resource.Namespace, id resource.ID) *Config {
return typed.NewResource[ConfigSpec, ConfigRD](

View File

@ -0,0 +1,49 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Code generated by "deep-copy -type ConfigSpec -type EndpointSpec -type IdentitySpec -type PeerSpecSpec -type PeerStatusSpec -header-file ../../../../hack/boilerplate.txt -o deep_copy.generated.go ."; DO NOT EDIT.
package kubespan
import (
"inet.af/netaddr"
)
// DeepCopy generates a deep copy of ConfigSpec.
func (o ConfigSpec) DeepCopy() ConfigSpec {
var cp ConfigSpec = o
return cp
}
// DeepCopy generates a deep copy of EndpointSpec.
func (o EndpointSpec) DeepCopy() EndpointSpec {
var cp EndpointSpec = o
return cp
}
// DeepCopy generates a deep copy of IdentitySpec.
func (o IdentitySpec) DeepCopy() IdentitySpec {
var cp IdentitySpec = o
return cp
}
// DeepCopy generates a deep copy of PeerSpecSpec.
func (o PeerSpecSpec) DeepCopy() PeerSpecSpec {
var cp PeerSpecSpec = o
if o.AllowedIPs != nil {
cp.AllowedIPs = make([]netaddr.IPPrefix, len(o.AllowedIPs))
copy(cp.AllowedIPs, o.AllowedIPs)
}
if o.Endpoints != nil {
cp.Endpoints = make([]netaddr.IPPort, len(o.Endpoints))
copy(cp.Endpoints, o.Endpoints)
}
return cp
}
// DeepCopy generates a deep copy of PeerStatusSpec.
func (o PeerStatusSpec) DeepCopy() PeerStatusSpec {
var cp PeerStatusSpec = o
return cp
}

View File

@ -25,9 +25,6 @@ type EndpointSpec struct {
Endpoint netaddr.IPPort `yaml:"endpoint"`
}
// DeepCopy implements typed.DeepCopyable interface.
func (spec EndpointSpec) DeepCopy() EndpointSpec { return spec }
// NewEndpoint initializes a Endpoint resource.
func NewEndpoint(namespace resource.Namespace, id resource.ID) *Endpoint {
return typed.NewResource[EndpointSpec, EndpointRD](

View File

@ -33,9 +33,6 @@ type IdentitySpec struct {
PublicKey string `yaml:"publicKey"`
}
// DeepCopy implements typed.DeepCopyable interface.
func (spec IdentitySpec) DeepCopy() IdentitySpec { return spec }
// NewIdentity initializes a Identity resource.
func NewIdentity(namespace resource.Namespace, id resource.ID) *Identity {
return typed.NewResource[IdentitySpec, IdentityRD](

View File

@ -27,16 +27,6 @@ type PeerSpecSpec struct {
Label string `yaml:"label"`
}
// DeepCopy implements typed.DeepCopyable interface.
func (spec PeerSpecSpec) DeepCopy() PeerSpecSpec {
return PeerSpecSpec{
Address: spec.Address,
AllowedIPs: append([]netaddr.IPPrefix(nil), spec.AllowedIPs...),
Endpoints: append([]netaddr.IPPort(nil), spec.Endpoints...),
Label: spec.Label,
}
}
// NewPeerSpec initializes a PeerSpec resource.
func NewPeerSpec(namespace resource.Namespace, id resource.ID) *PeerSpec {
return typed.NewResource[PeerSpecSpec, PeerSpecRD](

View File

@ -39,9 +39,6 @@ type PeerStatusSpec struct {
LastEndpointChange time.Time `yaml:"lastEndpointChange"`
}
// DeepCopy implements typed.DeepCopyable interface.
func (spec PeerStatusSpec) DeepCopy() PeerStatusSpec { return spec }
// NewPeerStatus initializes a PeerStatus resource.
func NewPeerStatus(namespace resource.Namespace, id resource.ID) *PeerStatus {
return typed.NewResource[PeerStatusSpec, PeerStatusRD](

View File

@ -13,6 +13,9 @@ import (
"github.com/talos-systems/talos/pkg/machinery/nethelpers"
)
//nolint:lll
//go:generate deep-copy -type AddressSpecSpec -type AddressStatusSpec -type HardwareAddrSpec -type HostnameSpecSpec -type HostnameStatusSpec -type LinkRefreshSpec -type LinkSpecSpec -type LinkStatusSpec -type NodeAddressSpec -type NodeAddressFilterSpec -type OperatorSpecSpec -type ResolverSpecSpec -type ResolverStatusSpec -type RouteSpecSpec -type RouteStatusSpec -type StatusSpec -type TimeServerSpecSpec -type TimeServerStatusSpec -header-file ../../../../hack/boilerplate.txt -o deep_copy.generated.go .
// AddressSpecType is type of AddressSpec resource.
const AddressSpecType = resource.Type("AddressSpecs.net.talos.dev")
@ -30,11 +33,6 @@ type AddressSpecSpec struct {
ConfigLayer ConfigLayer `yaml:"layer"`
}
// DeepCopy generates a deep copy of AddressSpecSpec.
func (spec AddressSpecSpec) DeepCopy() AddressSpecSpec {
return spec
}
// NewAddressSpec initializes a AddressSpec resource.
func NewAddressSpec(namespace resource.Namespace, id resource.ID) *AddressSpec {
return typed.NewResource[AddressSpecSpec, AddressSpecRD](

View File

@ -33,11 +33,6 @@ type AddressStatusSpec struct {
Flags nethelpers.AddressFlags `yaml:"flags"`
}
// DeepCopy generates a deep copy of AddressStatusSpec.
func (spec AddressStatusSpec) DeepCopy() AddressStatusSpec {
return spec
}
// NewAddressStatus initializes a AddressStatus resource.
func NewAddressStatus(namespace resource.Namespace, id resource.ID) *AddressStatus {
return typed.NewResource[AddressStatusSpec, AddressStatusRD](

View File

@ -0,0 +1,179 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Code generated by "deep-copy -type AddressSpecSpec -type AddressStatusSpec -type HardwareAddrSpec -type HostnameSpecSpec -type HostnameStatusSpec -type LinkRefreshSpec -type LinkSpecSpec -type LinkStatusSpec -type NodeAddressSpec -type NodeAddressFilterSpec -type OperatorSpecSpec -type ResolverSpecSpec -type ResolverStatusSpec -type RouteSpecSpec -type RouteStatusSpec -type StatusSpec -type TimeServerSpecSpec -type TimeServerStatusSpec -header-file ../../../../hack/boilerplate.txt -o deep_copy.generated.go ."; DO NOT EDIT.
package network
import (
"inet.af/netaddr"
)
// DeepCopy generates a deep copy of AddressSpecSpec.
func (o AddressSpecSpec) DeepCopy() AddressSpecSpec {
var cp AddressSpecSpec = o
return cp
}
// DeepCopy generates a deep copy of AddressStatusSpec.
func (o AddressStatusSpec) DeepCopy() AddressStatusSpec {
var cp AddressStatusSpec = o
return cp
}
// DeepCopy generates a deep copy of HardwareAddrSpec.
func (o HardwareAddrSpec) DeepCopy() HardwareAddrSpec {
var cp HardwareAddrSpec = o
if o.HardwareAddr != nil {
cp.HardwareAddr = make([]byte, len(o.HardwareAddr))
copy(cp.HardwareAddr, o.HardwareAddr)
}
return cp
}
// DeepCopy generates a deep copy of HostnameSpecSpec.
func (o HostnameSpecSpec) DeepCopy() HostnameSpecSpec {
var cp HostnameSpecSpec = o
return cp
}
// DeepCopy generates a deep copy of HostnameStatusSpec.
func (o HostnameStatusSpec) DeepCopy() HostnameStatusSpec {
var cp HostnameStatusSpec = o
return cp
}
// DeepCopy generates a deep copy of LinkRefreshSpec.
func (o LinkRefreshSpec) DeepCopy() LinkRefreshSpec {
var cp LinkRefreshSpec = o
return cp
}
// DeepCopy generates a deep copy of LinkSpecSpec.
func (o LinkSpecSpec) DeepCopy() LinkSpecSpec {
var cp LinkSpecSpec = o
if o.Wireguard.Peers != nil {
cp.Wireguard.Peers = make([]WireguardPeer, len(o.Wireguard.Peers))
copy(cp.Wireguard.Peers, o.Wireguard.Peers)
for i3 := range o.Wireguard.Peers {
if o.Wireguard.Peers[i3].AllowedIPs != nil {
cp.Wireguard.Peers[i3].AllowedIPs = make([]netaddr.IPPrefix, len(o.Wireguard.Peers[i3].AllowedIPs))
copy(cp.Wireguard.Peers[i3].AllowedIPs, o.Wireguard.Peers[i3].AllowedIPs)
}
}
}
return cp
}
// DeepCopy generates a deep copy of LinkStatusSpec.
func (o LinkStatusSpec) DeepCopy() LinkStatusSpec {
var cp LinkStatusSpec = o
if o.HardwareAddr != nil {
cp.HardwareAddr = make([]byte, len(o.HardwareAddr))
copy(cp.HardwareAddr, o.HardwareAddr)
}
if o.BroadcastAddr != nil {
cp.BroadcastAddr = make([]byte, len(o.BroadcastAddr))
copy(cp.BroadcastAddr, o.BroadcastAddr)
}
if o.Wireguard.Peers != nil {
cp.Wireguard.Peers = make([]WireguardPeer, len(o.Wireguard.Peers))
copy(cp.Wireguard.Peers, o.Wireguard.Peers)
for i3 := range o.Wireguard.Peers {
if o.Wireguard.Peers[i3].AllowedIPs != nil {
cp.Wireguard.Peers[i3].AllowedIPs = make([]netaddr.IPPrefix, len(o.Wireguard.Peers[i3].AllowedIPs))
copy(cp.Wireguard.Peers[i3].AllowedIPs, o.Wireguard.Peers[i3].AllowedIPs)
}
}
}
return cp
}
// DeepCopy generates a deep copy of NodeAddressSpec.
func (o NodeAddressSpec) DeepCopy() NodeAddressSpec {
var cp NodeAddressSpec = o
if o.Addresses != nil {
cp.Addresses = make([]netaddr.IPPrefix, len(o.Addresses))
copy(cp.Addresses, o.Addresses)
}
return cp
}
// DeepCopy generates a deep copy of NodeAddressFilterSpec.
func (o NodeAddressFilterSpec) DeepCopy() NodeAddressFilterSpec {
var cp NodeAddressFilterSpec = o
if o.IncludeSubnets != nil {
cp.IncludeSubnets = make([]netaddr.IPPrefix, len(o.IncludeSubnets))
copy(cp.IncludeSubnets, o.IncludeSubnets)
}
if o.ExcludeSubnets != nil {
cp.ExcludeSubnets = make([]netaddr.IPPrefix, len(o.ExcludeSubnets))
copy(cp.ExcludeSubnets, o.ExcludeSubnets)
}
return cp
}
// DeepCopy generates a deep copy of OperatorSpecSpec.
func (o OperatorSpecSpec) DeepCopy() OperatorSpecSpec {
var cp OperatorSpecSpec = o
return cp
}
// DeepCopy generates a deep copy of ResolverSpecSpec.
func (o ResolverSpecSpec) DeepCopy() ResolverSpecSpec {
var cp ResolverSpecSpec = o
if o.DNSServers != nil {
cp.DNSServers = make([]netaddr.IP, len(o.DNSServers))
copy(cp.DNSServers, o.DNSServers)
}
return cp
}
// DeepCopy generates a deep copy of ResolverStatusSpec.
func (o ResolverStatusSpec) DeepCopy() ResolverStatusSpec {
var cp ResolverStatusSpec = o
if o.DNSServers != nil {
cp.DNSServers = make([]netaddr.IP, len(o.DNSServers))
copy(cp.DNSServers, o.DNSServers)
}
return cp
}
// DeepCopy generates a deep copy of RouteSpecSpec.
func (o RouteSpecSpec) DeepCopy() RouteSpecSpec {
var cp RouteSpecSpec = o
return cp
}
// DeepCopy generates a deep copy of RouteStatusSpec.
func (o RouteStatusSpec) DeepCopy() RouteStatusSpec {
var cp RouteStatusSpec = o
return cp
}
// DeepCopy generates a deep copy of StatusSpec.
func (o StatusSpec) DeepCopy() StatusSpec {
var cp StatusSpec = o
return cp
}
// DeepCopy generates a deep copy of TimeServerSpecSpec.
func (o TimeServerSpecSpec) DeepCopy() TimeServerSpecSpec {
var cp TimeServerSpecSpec = o
if o.NTPServers != nil {
cp.NTPServers = make([]string, len(o.NTPServers))
copy(cp.NTPServers, o.NTPServers)
}
return cp
}
// DeepCopy generates a deep copy of TimeServerStatusSpec.
func (o TimeServerStatusSpec) DeepCopy() TimeServerStatusSpec {
var cp TimeServerStatusSpec = o
if o.NTPServers != nil {
cp.NTPServers = make([]string, len(o.NTPServers))
copy(cp.NTPServers, o.NTPServers)
}
return cp
}

View File

@ -30,17 +30,6 @@ type HardwareAddrSpec struct {
HardwareAddr nethelpers.HardwareAddr `yaml:"hardwareAddr"`
}
// DeepCopy generates a deep copy of HardwareAddrSpec.
func (spec HardwareAddrSpec) DeepCopy() HardwareAddrSpec {
cp := spec
if spec.HardwareAddr != nil {
cp.HardwareAddr = make([]byte, len(spec.HardwareAddr))
copy(cp.HardwareAddr, spec.HardwareAddr)
}
return cp
}
// NewHardwareAddr initializes a HardwareAddr resource.
func NewHardwareAddr(namespace resource.Namespace, id resource.ID) *HardwareAddr {
return typed.NewResource[HardwareAddrSpec, HardwareAddrRD](

View File

@ -29,11 +29,6 @@ type HostnameSpecSpec struct {
ConfigLayer ConfigLayer `yaml:"layer"`
}
// DeepCopy generates a deep copy of HostnameSpecSpec.
func (spec HostnameSpecSpec) DeepCopy() HostnameSpecSpec {
return spec
}
// Validate the hostname.
func (spec *HostnameSpecSpec) Validate() error {
lenHostname := len(spec.Hostname)

View File

@ -22,11 +22,6 @@ type HostnameStatusSpec struct {
Domainname string `yaml:"domainname"`
}
// DeepCopy generates a deep copy of HostnameSpecSpec.
func (spec HostnameStatusSpec) DeepCopy() HostnameStatusSpec {
return spec
}
// FQDN returns the fully-qualified domain name.
func (spec *HostnameStatusSpec) FQDN() string {
if spec.Domainname == "" {

View File

@ -27,9 +27,6 @@ type LinkRefreshSpec struct {
Generation int `yaml:"generation"`
}
// DeepCopy implements typed.DeepCopyable interface.
func (s LinkRefreshSpec) DeepCopy() LinkRefreshSpec { return s }
// Bump performs an update.
func (s *LinkRefreshSpec) Bump() {
s.Generation++

View File

@ -8,7 +8,6 @@ import (
"github.com/cosi-project/runtime/pkg/resource"
"github.com/cosi-project/runtime/pkg/resource/meta"
"github.com/cosi-project/runtime/pkg/resource/typed"
"inet.af/netaddr"
"github.com/talos-systems/talos/pkg/machinery/nethelpers"
)
@ -63,24 +62,6 @@ type BondSlave struct {
SlaveIndex int `yaml:"slaveIndex,omitempty"`
}
// DeepCopy generates a deep copy of LinkSpecSpec.
func (spec LinkSpecSpec) DeepCopy() LinkSpecSpec {
cp := spec
if spec.Wireguard.Peers != nil {
cp.Wireguard.Peers = make([]WireguardPeer, len(spec.Wireguard.Peers))
copy(cp.Wireguard.Peers, spec.Wireguard.Peers)
for i3 := range spec.Wireguard.Peers {
if spec.Wireguard.Peers[i3].AllowedIPs != nil {
cp.Wireguard.Peers[i3].AllowedIPs = make([]netaddr.IPPrefix, len(spec.Wireguard.Peers[i3].AllowedIPs))
copy(cp.Wireguard.Peers[i3].AllowedIPs, spec.Wireguard.Peers[i3].AllowedIPs)
}
}
}
return cp
}
// Merge with other, overwriting fields from other if set.
//
//nolint:gocyclo

View File

@ -8,7 +8,6 @@ import (
"github.com/cosi-project/runtime/pkg/resource"
"github.com/cosi-project/runtime/pkg/resource/meta"
"github.com/cosi-project/runtime/pkg/resource/typed"
"inet.af/netaddr"
"github.com/talos-systems/talos/pkg/machinery/nethelpers"
)
@ -48,34 +47,6 @@ type LinkStatusSpec struct {
Wireguard WireguardSpec `yaml:"wireguard,omitempty"`
}
// DeepCopy implements typed.DeepCopyable interface.
func (s LinkStatusSpec) DeepCopy() LinkStatusSpec {
cp := s
if s.HardwareAddr != nil {
cp.HardwareAddr = make([]byte, len(s.HardwareAddr))
copy(cp.HardwareAddr, s.HardwareAddr)
}
if s.BroadcastAddr != nil {
cp.BroadcastAddr = make([]byte, len(s.BroadcastAddr))
copy(cp.BroadcastAddr, s.BroadcastAddr)
}
if s.Wireguard.Peers != nil {
cp.Wireguard.Peers = append([]WireguardPeer(nil), s.Wireguard.Peers...)
for i3 := range s.Wireguard.Peers {
if s.Wireguard.Peers[i3].AllowedIPs != nil {
cp.Wireguard.Peers[i3].AllowedIPs = make([]netaddr.IPPrefix, len(s.Wireguard.Peers[i3].AllowedIPs))
copy(cp.Wireguard.Peers[i3].AllowedIPs, s.Wireguard.Peers[i3].AllowedIPs)
}
}
}
return cp
}
// Physical checks if the link is physical ethernet.
func (s LinkStatusSpec) Physical() bool {
return s.Type == nethelpers.LinkEther && s.Kind == ""

View File

@ -40,13 +40,6 @@ type NodeAddressSpec struct {
Addresses []netaddr.IPPrefix `yaml:"addresses"`
}
// DeepCopy generates a deep copy of NodeAddressSpec.
func (spec NodeAddressSpec) DeepCopy() NodeAddressSpec {
return NodeAddressSpec{
Addresses: append([]netaddr.IPPrefix(nil), spec.Addresses...),
}
}
// NewNodeAddress initializes a NodeAddress resource.
func NewNodeAddress(namespace resource.Namespace, id resource.ID) *NodeAddress {
return typed.NewResource[NodeAddressSpec, NodeAddressRD](

View File

@ -25,22 +25,6 @@ type NodeAddressFilterSpec struct {
ExcludeSubnets []netaddr.IPPrefix `yaml:"excludeSubnets"`
}
// DeepCopy generates a deep copy of NodeAddressFilterSpec.
func (spec NodeAddressFilterSpec) DeepCopy() NodeAddressFilterSpec {
cp := spec
if spec.IncludeSubnets != nil {
cp.IncludeSubnets = make([]netaddr.IPPrefix, len(spec.IncludeSubnets))
copy(cp.IncludeSubnets, spec.IncludeSubnets)
}
if spec.ExcludeSubnets != nil {
cp.ExcludeSubnets = make([]netaddr.IPPrefix, len(spec.ExcludeSubnets))
copy(cp.ExcludeSubnets, spec.ExcludeSubnets)
}
return cp
}
// NewNodeAddressFilter initializes a NodeAddressFilter resource.
func NewNodeAddressFilter(namespace resource.Namespace, id resource.ID) *NodeAddressFilter {
return typed.NewResource[NodeAddressFilterSpec, NodeAddressFilterRD](

View File

@ -30,11 +30,6 @@ type OperatorSpecSpec struct {
ConfigLayer ConfigLayer `yaml:"layer"`
}
// DeepCopy generates a deep copy of OperatorSpecSpec.
func (spec OperatorSpecSpec) DeepCopy() OperatorSpecSpec {
return spec
}
// DHCP4OperatorSpec describes DHCP4 operator options.
type DHCP4OperatorSpec struct {
RouteMetric uint32 `yaml:"routeMetric"`

View File

@ -26,17 +26,6 @@ type ResolverSpecSpec struct {
ConfigLayer ConfigLayer `yaml:"layer"`
}
// DeepCopy generates a deep copy of ResolverSpecSpec.
func (spec ResolverSpecSpec) DeepCopy() ResolverSpecSpec {
cp := spec
if spec.DNSServers != nil {
cp.DNSServers = make([]netaddr.IP, len(spec.DNSServers))
copy(cp.DNSServers, spec.DNSServers)
}
return cp
}
// NewResolverSpec initializes a ResolverSpec resource.
func NewResolverSpec(namespace resource.Namespace, id resource.ID) *ResolverSpec {
return typed.NewResource[ResolverSpecSpec, ResolverSpecRD](

View File

@ -22,17 +22,6 @@ type ResolverStatusSpec struct {
DNSServers []netaddr.IP `yaml:"dnsServers"`
}
// DeepCopy generates a deep copy of ResolverStatusSpec.
func (spec ResolverStatusSpec) DeepCopy() ResolverStatusSpec {
cp := spec
if spec.DNSServers != nil {
cp.DNSServers = make([]netaddr.IP, len(spec.DNSServers))
copy(cp.DNSServers, spec.DNSServers)
}
return cp
}
// NewResolverStatus initializes a ResolverStatus resource.
func NewResolverStatus(namespace resource.Namespace, id resource.ID) *ResolverStatus {
return typed.NewResource[ResolverStatusSpec, ResolverStatusRD](

View File

@ -35,11 +35,6 @@ type RouteSpecSpec struct {
ConfigLayer ConfigLayer `yaml:"layer"`
}
// DeepCopy generates a deep copy of RouteSpecSpec.
func (route RouteSpecSpec) DeepCopy() RouteSpecSpec {
return route
}
var (
zero16 = netaddr.MustParseIP("::")
zero4 = netaddr.MustParseIP("0.0.0.0")

View File

@ -35,11 +35,6 @@ type RouteStatusSpec struct {
Protocol nethelpers.RouteProtocol `yaml:"protocol"`
}
// DeepCopy generates a deep copy of RouteStatusSpec.
func (spec RouteStatusSpec) DeepCopy() RouteStatusSpec {
return spec
}
// NewRouteStatus initializes a RouteStatus resource.
func NewRouteStatus(namespace resource.Namespace, id resource.ID) *RouteStatus {
return typed.NewResource[RouteStatusSpec, RouteStatusRD](

View File

@ -24,11 +24,6 @@ type StatusSpec struct {
EtcFilesReady bool `yaml:"etcFilesReady"`
}
// DeepCopy generates a deep copy of StatusSpec.
func (spec StatusSpec) DeepCopy() StatusSpec {
return spec
}
// StatusID is the resource ID of the singleton instance.
const StatusID resource.ID = "status"

View File

@ -25,17 +25,6 @@ type TimeServerSpecSpec struct {
ConfigLayer ConfigLayer `yaml:"layer"`
}
// DeepCopy generates a deep copy of TimeServerSpecSpec.
func (spec TimeServerSpecSpec) DeepCopy() TimeServerSpecSpec {
cp := spec
if spec.NTPServers != nil {
cp.NTPServers = make([]string, len(spec.NTPServers))
copy(cp.NTPServers, spec.NTPServers)
}
return cp
}
// NewTimeServerSpec initializes a TimeServerSpec resource.
func NewTimeServerSpec(namespace resource.Namespace, id resource.ID) *TimeServerSpec {
return typed.NewResource[TimeServerSpecSpec, TimeServerSpecRD](

View File

@ -21,17 +21,6 @@ type TimeServerStatusSpec struct {
NTPServers []string `yaml:"timeServers"`
}
// DeepCopy generates a deep copy of TimeServerStatusSpec.
func (spec TimeServerStatusSpec) DeepCopy() TimeServerStatusSpec {
cp := spec
if spec.NTPServers != nil {
cp.NTPServers = make([]string, len(spec.NTPServers))
copy(cp.NTPServers, spec.NTPServers)
}
return cp
}
// NewTimeServerStatus initializes a TimeServerStatus resource.
func NewTimeServerStatus(namespace resource.Namespace, id resource.ID) *TimeServerStatus {
return typed.NewResource[TimeServerStatusSpec, TimeServerStatusRD](

View File

@ -10,6 +10,9 @@ import (
"github.com/cosi-project/runtime/pkg/resource/typed"
)
//nolint:lll
//go:generate deep-copy -type CPUSpec -type MemorySpec -header-file ../../../../hack/boilerplate.txt -o deep_copy.generated.go .
// CPUType is type of Etcd resource.
const CPUType = resource.Type("CPUStats.perf.talos.dev")
@ -53,11 +56,6 @@ func NewCPU() *CPU {
)
}
// DeepCopy implements typed.Deepcopyable interface.
func (spec CPUSpec) DeepCopy() CPUSpec {
return spec
}
// CPURD is an auxiliary type for CPU resource.
type CPURD struct{}

View File

@ -0,0 +1,23 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Code generated by "deep-copy -type CPUSpec -type MemorySpec -header-file ../../../../hack/boilerplate.txt -o deep_copy.generated.go ."; DO NOT EDIT.
package perf
// DeepCopy generates a deep copy of CPUSpec.
func (o CPUSpec) DeepCopy() CPUSpec {
var cp CPUSpec = o
if o.CPU != nil {
cp.CPU = make([]CPUStat, len(o.CPU))
copy(cp.CPU, o.CPU)
}
return cp
}
// DeepCopy generates a deep copy of MemorySpec.
func (o MemorySpec) DeepCopy() MemorySpec {
var cp MemorySpec = o
return cp
}

View File

@ -79,11 +79,6 @@ func NewMemory() *Memory {
)
}
// DeepCopy implements typed.Deepcopyable interface.
func (spec MemorySpec) DeepCopy() MemorySpec {
return spec
}
// MemoryRD is an auxiliary type for Memory resource.
type MemoryRD struct{}

View File

@ -0,0 +1,35 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Code generated by "deep-copy -type KernelModuleSpecSpec -type KernelParamSpecSpec -type KernelParamStatusSpec -type MountStatusSpec -header-file ../../../../hack/boilerplate.txt -o deep_copy.generated.go ."; DO NOT EDIT.
package runtime
// DeepCopy generates a deep copy of KernelModuleSpecSpec.
func (o KernelModuleSpecSpec) DeepCopy() KernelModuleSpecSpec {
var cp KernelModuleSpecSpec = o
return cp
}
// DeepCopy generates a deep copy of KernelParamSpecSpec.
func (o KernelParamSpecSpec) DeepCopy() KernelParamSpecSpec {
var cp KernelParamSpecSpec = o
return cp
}
// DeepCopy generates a deep copy of KernelParamStatusSpec.
func (o KernelParamStatusSpec) DeepCopy() KernelParamStatusSpec {
var cp KernelParamStatusSpec = o
return cp
}
// DeepCopy generates a deep copy of MountStatusSpec.
func (o MountStatusSpec) DeepCopy() MountStatusSpec {
var cp MountStatusSpec = o
if o.Options != nil {
cp.Options = make([]string, len(o.Options))
copy(cp.Options, o.Options)
}
return cp
}

View File

@ -12,6 +12,9 @@ import (
"github.com/talos-systems/talos/pkg/machinery/extensions"
)
//nolint:lll
//go:generate deep-copy -type KernelModuleSpecSpec -type KernelParamSpecSpec -type KernelParamStatusSpec -type MountStatusSpec -header-file ../../../../hack/boilerplate.txt -o deep_copy.generated.go .
// ExtensionStatusType is type of Extension resource.
const ExtensionStatusType = resource.Type("ExtensionStatuses.runtime.talos.dev")

View File

@ -30,11 +30,6 @@ func NewKernelModuleSpec(namespace resource.Namespace, id resource.ID) *KernelMo
)
}
// DeepCopy implements typed.DeepCopyable interface.
func (spec KernelModuleSpecSpec) DeepCopy() KernelModuleSpecSpec {
return spec
}
// KernelModuleSpecRD is auxiliary resource data for KernelModuleSpec.
type KernelModuleSpecRD struct{}

View File

@ -35,11 +35,6 @@ type KernelParamSpecSpec struct {
IgnoreErrors bool `yaml:"ignoreErrors"`
}
// DeepCopy implements typed.DeepCopyable interface.
func (spec KernelParamSpecSpec) DeepCopy() KernelParamSpecSpec {
return spec
}
// NewKernelParamSpec initializes a KernelParamSpec resource.
func NewKernelParamSpec(namespace resource.Namespace, id resource.ID) *KernelParamSpec {
return typed.NewResource[KernelParamSpecSpec, KernelParamSpecRD](

View File

@ -31,11 +31,6 @@ func NewKernelParamStatus(namespace resource.Namespace, id resource.ID) *KernelP
)
}
// DeepCopy implements typed.DeepCopyable interface.
func (spec KernelParamStatusSpec) DeepCopy() KernelParamStatusSpec {
return spec
}
// KernelParamStatusRD is auxiliary resource data for KernelParamStatus.
type KernelParamStatusRD struct{}

View File

@ -32,11 +32,6 @@ func NewMountStatus(namespace resource.Namespace, id resource.ID) *MountStatus {
)
}
// DeepCopy implements typed.DeepCopyable interface.
func (spec MountStatusSpec) DeepCopy() MountStatusSpec {
return spec
}
// MountStatusRD is auxiliary resource data for MountStatus.
type MountStatusRD struct{}

View File

@ -15,6 +15,9 @@ import (
"github.com/talos-systems/talos/pkg/machinery/proto"
)
//nolint:lll
//go:generate deep-copy -type APICertsSpec -type CertSANSpec -type EtcdCertsSpec -type EtcdRootSpec -type KubeletSpec -type KubernetesCertsSpec -type KubernetesRootSpec -type OSRootSpec -header-file ../../../../hack/boilerplate.txt -o deep_copy.generated.go .
// APIType is type of API resource.
const APIType = resource.Type("ApiCertificates.secrets.talos.dev")
@ -81,11 +84,6 @@ func (spec *APICertsSpec) UnmarshalProto(protoBytes []byte) error {
return nil
}
// DeepCopy implements the DeepCopyable interface.
func (spec APICertsSpec) DeepCopy() APICertsSpec {
return spec
}
// APIRD provides auxiliary methods for API.
type APIRD struct{}

View File

@ -54,15 +54,6 @@ func (CertSANRD) ResourceDefinition(resource.Metadata, CertSANSpec) meta.Resourc
}
}
// DeepCopy implements DeepCopyable.
func (spec CertSANSpec) DeepCopy() CertSANSpec {
return CertSANSpec{
IPs: append([]netaddr.IP(nil), spec.IPs...),
DNSNames: append([]string(nil), spec.DNSNames...),
FQDN: spec.FQDN,
}
}
// Reset the list of SANs.
func (spec *CertSANSpec) Reset() {
spec.DNSNames = nil

View File

@ -0,0 +1,155 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Code generated by "deep-copy -type APICertsSpec -type CertSANSpec -type EtcdCertsSpec -type EtcdRootSpec -type KubeletSpec -type KubernetesCertsSpec -type KubernetesRootSpec -type OSRootSpec -header-file ../../../../hack/boilerplate.txt -o deep_copy.generated.go ."; DO NOT EDIT.
package secrets
import (
"inet.af/netaddr"
"net"
"net/url"
)
// DeepCopy generates a deep copy of APICertsSpec.
func (o APICertsSpec) DeepCopy() APICertsSpec {
var cp APICertsSpec = o
if o.CA != nil {
cp.CA = o.CA.DeepCopy()
}
if o.Client != nil {
cp.Client = o.Client.DeepCopy()
}
if o.Server != nil {
cp.Server = o.Server.DeepCopy()
}
return cp
}
// DeepCopy generates a deep copy of CertSANSpec.
func (o CertSANSpec) DeepCopy() CertSANSpec {
var cp CertSANSpec = o
if o.IPs != nil {
cp.IPs = make([]netaddr.IP, len(o.IPs))
copy(cp.IPs, o.IPs)
}
if o.DNSNames != nil {
cp.DNSNames = make([]string, len(o.DNSNames))
copy(cp.DNSNames, o.DNSNames)
}
return cp
}
// DeepCopy generates a deep copy of EtcdCertsSpec.
func (o EtcdCertsSpec) DeepCopy() EtcdCertsSpec {
var cp EtcdCertsSpec = o
if o.Etcd != nil {
cp.Etcd = o.Etcd.DeepCopy()
}
if o.EtcdPeer != nil {
cp.EtcdPeer = o.EtcdPeer.DeepCopy()
}
if o.EtcdAdmin != nil {
cp.EtcdAdmin = o.EtcdAdmin.DeepCopy()
}
if o.EtcdAPIServer != nil {
cp.EtcdAPIServer = o.EtcdAPIServer.DeepCopy()
}
return cp
}
// DeepCopy generates a deep copy of EtcdRootSpec.
func (o EtcdRootSpec) DeepCopy() EtcdRootSpec {
var cp EtcdRootSpec = o
if o.EtcdCA != nil {
cp.EtcdCA = o.EtcdCA.DeepCopy()
}
return cp
}
// DeepCopy generates a deep copy of KubeletSpec.
func (o KubeletSpec) DeepCopy() KubeletSpec {
var cp KubeletSpec = o
if o.Endpoint != nil {
cp.Endpoint = new(url.URL)
*cp.Endpoint = *o.Endpoint
if o.Endpoint.User != nil {
cp.Endpoint.User = new(url.Userinfo)
*cp.Endpoint.User = *o.Endpoint.User
}
}
if o.CA != nil {
cp.CA = o.CA.DeepCopy()
}
return cp
}
// DeepCopy generates a deep copy of KubernetesCertsSpec.
func (o KubernetesCertsSpec) DeepCopy() KubernetesCertsSpec {
var cp KubernetesCertsSpec = o
if o.APIServer != nil {
cp.APIServer = o.APIServer.DeepCopy()
}
if o.APIServerKubeletClient != nil {
cp.APIServerKubeletClient = o.APIServerKubeletClient.DeepCopy()
}
if o.FrontProxy != nil {
cp.FrontProxy = o.FrontProxy.DeepCopy()
}
return cp
}
// DeepCopy generates a deep copy of KubernetesRootSpec.
func (o KubernetesRootSpec) DeepCopy() KubernetesRootSpec {
var cp KubernetesRootSpec = o
if o.Endpoint != nil {
cp.Endpoint = new(url.URL)
*cp.Endpoint = *o.Endpoint
if o.Endpoint.User != nil {
cp.Endpoint.User = new(url.Userinfo)
*cp.Endpoint.User = *o.Endpoint.User
}
}
if o.CertSANs != nil {
cp.CertSANs = make([]string, len(o.CertSANs))
copy(cp.CertSANs, o.CertSANs)
}
if o.APIServerIPs != nil {
cp.APIServerIPs = make([]net.IP, len(o.APIServerIPs))
copy(cp.APIServerIPs, o.APIServerIPs)
for i2 := range o.APIServerIPs {
if o.APIServerIPs[i2] != nil {
cp.APIServerIPs[i2] = make([]byte, len(o.APIServerIPs[i2]))
copy(cp.APIServerIPs[i2], o.APIServerIPs[i2])
}
}
}
if o.CA != nil {
cp.CA = o.CA.DeepCopy()
}
if o.ServiceAccount != nil {
cp.ServiceAccount = o.ServiceAccount.DeepCopy()
}
if o.AggregatorCA != nil {
cp.AggregatorCA = o.AggregatorCA.DeepCopy()
}
return cp
}
// DeepCopy generates a deep copy of OSRootSpec.
func (o OSRootSpec) DeepCopy() OSRootSpec {
var cp OSRootSpec = o
if o.CA != nil {
cp.CA = o.CA.DeepCopy()
}
if o.CertSANIPs != nil {
cp.CertSANIPs = make([]netaddr.IP, len(o.CertSANIPs))
copy(cp.CertSANIPs, o.CertSANIPs)
}
if o.CertSANDNSNames != nil {
cp.CertSANDNSNames = make([]string, len(o.CertSANDNSNames))
copy(cp.CertSANDNSNames, o.CertSANDNSNames)
}
return cp
}

View File

@ -36,11 +36,6 @@ func NewEtcd() *Etcd {
)
}
// DeepCopy implements the DeepCopyable interface.
func (s EtcdCertsSpec) DeepCopy() EtcdCertsSpec {
return s
}
// EtcdRD provides auxiliary methods for Etcd.
type EtcdRD struct{}

View File

@ -33,11 +33,6 @@ func NewEtcdRoot(id resource.ID) *EtcdRoot {
)
}
// DeepCopy implements the DeepCopyable interface.
func (s EtcdRootSpec) DeepCopy() EtcdRootSpec {
return s
}
// EtcdRootRD provides auxiliary methods for EtcdRoot.
type EtcdRootRD struct{}

View File

@ -40,11 +40,6 @@ func NewKubelet(id resource.ID) *Kubelet {
)
}
// DeepCopy implements the DeepCopyable interface.
func (s KubeletSpec) DeepCopy() KubeletSpec {
return s
}
// KubeletRD provides auxiliary methods for Kubelet.
type KubeletRD struct{}

View File

@ -42,11 +42,6 @@ func NewKubernetes() *Kubernetes {
)
}
// DeepCopy implements the DeepCopyable interface.
func (s KubernetesCertsSpec) DeepCopy() KubernetesCertsSpec {
return s
}
// KubernetesRD provides auxiliary methods for Kubernetes.
type KubernetesRD struct{}

View File

@ -49,11 +49,6 @@ func NewKubernetesRoot(id resource.ID) *KubernetesRoot {
)
}
// DeepCopy implements the DeepCopyable interface.
func (spec KubernetesRootSpec) DeepCopy() KubernetesRootSpec {
return spec
}
// KubernetesRootRD provides auxiliary methods for KubernetesRoot.
type KubernetesRootRD struct{}

View File

@ -38,11 +38,6 @@ func NewOSRoot(id resource.ID) *OSRoot {
)
}
// DeepCopy implements the DeepCopyable interface.
func (spec OSRootSpec) DeepCopy() OSRootSpec {
return spec
}
// OSRootRD provides auxiliary methods for OSRoot.
type OSRootRD struct{}

View File

@ -0,0 +1,13 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Code generated by "deep-copy -type StatusSpec -header-file ../../../../hack/boilerplate.txt -o deep_copy.generated.go ."; DO NOT EDIT.
package time
// DeepCopy generates a deep copy of StatusSpec.
func (o StatusSpec) DeepCopy() StatusSpec {
var cp StatusSpec = o
return cp
}

View File

@ -12,6 +12,9 @@ import (
"github.com/talos-systems/talos/pkg/machinery/resources/v1alpha1"
)
//nolint:lll
//go:generate deep-copy -type StatusSpec -header-file ../../../../hack/boilerplate.txt -o deep_copy.generated.go .
// StatusType is type of TimeSync resource.
const StatusType = resource.Type("TimeStatuses.v1alpha1.talos.dev")
@ -41,11 +44,6 @@ func NewStatus() *Status {
)
}
// DeepCopy implements the DeepCopyable interface.
func (s StatusSpec) DeepCopy() StatusSpec {
return s
}
// StatusRD provides auxiliary methods for Status.
type StatusRD struct{}

View File

@ -0,0 +1,13 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
// Code generated by "deep-copy -type ServiceSpec -header-file ../../../../hack/boilerplate.txt -o deep_copy.generated.go ."; DO NOT EDIT.
package v1alpha1
// DeepCopy generates a deep copy of ServiceSpec.
func (o ServiceSpec) DeepCopy() ServiceSpec {
var cp ServiceSpec = o
return cp
}

View File

@ -10,6 +10,9 @@ import (
"github.com/cosi-project/runtime/pkg/resource/typed"
)
//nolint:lll
//go:generate deep-copy -type ServiceSpec -header-file ../../../../hack/boilerplate.txt -o deep_copy.generated.go .
// ServiceType is type of Service resource.
const ServiceType = resource.Type("Services.v1alpha1.talos.dev")
@ -31,11 +34,6 @@ func NewService(id resource.ID) *Service {
)
}
// DeepCopy implements the DeepCopyable interface.
func (s ServiceSpec) DeepCopy() ServiceSpec {
return s
}
// ServiceRD provides auxiliary methods for Service.
type ServiceRD struct{}