Skip to content

Commit 23a6173

Browse files
Merge pull request #10025 from dlom/add-deepcopy-to-types
CORS-4266: Add generated DeepCopy implementations for pkg/types/installconfig
2 parents 324432a + f8aa3f7 commit 23a6173

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+9459
-23
lines changed

data/data/install.openshift.io_installconfigs.yaml

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5583,7 +5583,6 @@ spec:
55835583
items:
55845584
type: string
55855585
type: array
5586-
uniqueItems: true
55875586
apiVIP:
55885587
description: |-
55895588
DeprecatedAPIVIP is the VIP to use for internal API communication
@@ -5600,7 +5599,6 @@ spec:
56005599
type: string
56015600
maxItems: 2
56025601
type: array
5603-
uniqueItems: true
56045602
bootstrapExternalStaticDNS:
56055603
description: |-
56065604
BootstrapExternalStaticDNS is the static network DNS of the bootstrap node.
@@ -5782,7 +5780,6 @@ spec:
57825780
type: string
57835781
maxItems: 2
57845782
type: array
5785-
uniqueItems: true
57865783
libvirtURI:
57875784
default: qemu:///system
57885785
description: |-
@@ -6360,7 +6357,6 @@ spec:
63606357
type: string
63616358
maxItems: 2
63626359
type: array
6363-
uniqueItems: true
63646360
clusterOSImage:
63656361
description: ClusterOSImage overrides the url provided in rhcos.json
63666362
to download the RHCOS Image.
@@ -6748,7 +6744,6 @@ spec:
67486744
type: string
67496745
maxItems: 2
67506746
type: array
6751-
uniqueItems: true
67526747
loadBalancer:
67536748
description: |-
67546749
LoadBalancer defines how the load balancer used by the cluster is configured.
@@ -6898,7 +6893,6 @@ spec:
68986893
type: string
68996894
maxItems: 2
69006895
type: array
6901-
uniqueItems: true
69026896
cloud:
69036897
description: Cloud is the name of OpenStack cloud to use from
69046898
clouds.yaml.
@@ -7074,7 +7068,6 @@ spec:
70747068
type: string
70757069
maxItems: 2
70767070
type: array
7077-
uniqueItems: true
70787071
lbFloatingIP:
70797072
description: |-
70807073
LbFloatingIP is the IP address of an available floating IP in your OpenStack cluster
@@ -7177,7 +7170,6 @@ spec:
71777170
type: string
71787171
maxItems: 2
71797172
type: array
7180-
uniqueItems: true
71817173
defaultMachinePlatform:
71827174
description: |-
71837175
DefaultMachinePlatform is the default configuration used when
@@ -7301,7 +7293,6 @@ spec:
73017293
type: string
73027294
maxItems: 2
73037295
type: array
7304-
uniqueItems: true
73057296
loadBalancer:
73067297
description: |-
73077298
LoadBalancer defines how the load balancer used by the cluster is configured.
@@ -7727,7 +7718,6 @@ spec:
77277718
type: string
77287719
maxItems: 2
77297720
type: array
7730-
uniqueItems: true
77317721
cluster:
77327722
description: |-
77337723
Cluster is the name of the cluster virtual machines will be cloned into.
@@ -8075,7 +8065,6 @@ spec:
80758065
type: string
80768066
maxItems: 2
80778067
type: array
8078-
uniqueItems: true
80798068
loadBalancer:
80808069
description: |-
80818070
LoadBalancer defines how the load balancer used by the cluster is configured.

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ require (
132132
k8s.io/apimachinery v0.34.1
133133
k8s.io/client-go v0.34.1
134134
k8s.io/cloud-provider-vsphere v1.31.0
135+
k8s.io/code-generator v0.34.1
135136
k8s.io/klog v1.0.0
136137
k8s.io/klog/v2 v2.130.1
137138
k8s.io/utils v0.0.0-20250820121507-0af2bda4dd1d
@@ -347,6 +348,7 @@ require (
347348
k8s.io/cli-runtime v0.33.4 // indirect
348349
k8s.io/cluster-bootstrap v0.33.3 // indirect
349350
k8s.io/component-base v0.34.1 // indirect
351+
k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f // indirect
350352
k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b // indirect
351353
k8s.io/kubectl v0.33.4 // indirect
352354
sigs.k8s.io/kustomize/api v0.19.0 // indirect

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,10 +1172,14 @@ k8s.io/client-go v0.34.1/go.mod h1:kA8v0FP+tk6sZA0yKLRG67LWjqufAoSHA2xVGKw9Of8=
11721172
k8s.io/cluster-bootstrap v0.33.3 h1:u2NTxJ5CFSBFXaDxLQoOWMly8eni31psVso+caq6uwI=
11731173
k8s.io/cluster-bootstrap v0.33.3/go.mod h1:p970f8u8jf273zyQ5raD8WUu2XyAl0SAWOY82o7i/ds=
11741174
k8s.io/code-generator v0.23.3/go.mod h1:S0Q1JVA+kSzTI1oUvbKAxZY/DYbA/ZUb4Uknog12ETk=
1175+
k8s.io/code-generator v0.34.1 h1:WpphT26E+j7tEgIUfFr5WfbJrktCGzB3JoJH9149xYc=
1176+
k8s.io/code-generator v0.34.1/go.mod h1:DeWjekbDnJWRwpw3s0Jat87c+e0TgkxoR4ar608yqvg=
11751177
k8s.io/component-base v0.34.1 h1:v7xFgG+ONhytZNFpIz5/kecwD+sUhVE6HU7qQUiRM4A=
11761178
k8s.io/component-base v0.34.1/go.mod h1:mknCpLlTSKHzAQJJnnHVKqjxR7gBeHRv0rPXA7gdtQ0=
11771179
k8s.io/gengo v0.0.0-20210813121822-485abfe95c7c/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
11781180
k8s.io/gengo v0.0.0-20211129171323-c02415ce4185/go.mod h1:FiNAH4ZV3gBg2Kwh89tzAEV2be7d5xI0vBa/VySYy3E=
1181+
k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f h1:SLb+kxmzfA87x4E4brQzB33VBbT2+x7Zq9ROIHmGn9Q=
1182+
k8s.io/gengo/v2 v2.0.0-20250604051438-85fd79dbfd9f/go.mod h1:EJykeLsmFC60UQbYJezXkEsG2FLrt0GPNkU5iK5GWxU=
11791183
k8s.io/klog v1.0.0 h1:Pt+yjF5aB1xDSVbau4VsWe+dQNzA0qv1LlXdC2dF6Q8=
11801184
k8s.io/klog v1.0.0/go.mod h1:4Bi6QPql/J/LkTDqv7R/cd3hPo4k2DG6Ptcz060Ez5I=
11811185
k8s.io/klog/v2 v2.0.0/go.mod h1:PBfzABfn139FHAV07az/IF9Wp1bkk3vpT2XSJ76fSDE=

pkg/ipnet/ipnet.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,22 @@ func MustParseCIDR(s string) *IPNet {
9595
}
9696
return cidr
9797
}
98+
99+
// DeepCopyInto copies the receiver into out. out must be non-nil.
100+
func (ipnet *IPNet) DeepCopyInto(out *IPNet) {
101+
if ipnet == nil {
102+
*out = IPNet{}
103+
} else {
104+
*out = *ipnet
105+
}
106+
}
107+
108+
// DeepCopy copies the receiver, creating a new IPNet.
109+
func (ipnet *IPNet) DeepCopy() *IPNet {
110+
if ipnet == nil {
111+
return nil
112+
}
113+
out := new(IPNet)
114+
ipnet.DeepCopyInto(out)
115+
return out
116+
}

pkg/ipnet/ipnet_test.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,36 @@ func TestUnmarshal(t *testing.T) {
5656
})
5757
}
5858
}
59+
60+
func TestDeepCopy(t *testing.T) {
61+
for _, ipNetIn := range []*IPNet{
62+
{},
63+
{IPNet: net.IPNet{
64+
IP: net.IP{192, 168, 0, 10},
65+
Mask: net.IPv4Mask(255, 255, 255, 0),
66+
}},
67+
} {
68+
t.Run(ipNetIn.String(), func(t *testing.T) {
69+
t.Run("DeepCopyInto", func(t *testing.T) {
70+
ipNetOut := &IPNet{}
71+
ipNetIn.DeepCopyInto(ipNetOut)
72+
if ipNetOut.String() != ipNetIn.String() {
73+
t.Fatalf("%v != %v", ipNetOut, ipNetIn)
74+
}
75+
if ipNetOut == ipNetIn {
76+
t.Fatalf("DeepCopyInto did not deep copy (pointers are equal)")
77+
}
78+
})
79+
80+
t.Run("DeepCopy", func(t *testing.T) {
81+
ipNetOut := ipNetIn.DeepCopy()
82+
if ipNetOut.String() != ipNetIn.String() {
83+
t.Fatalf("%v != %v", ipNetOut, ipNetIn)
84+
}
85+
if ipNetOut == ipNetIn {
86+
t.Fatalf("DeepCopy did not deep copy (pointers are equal)")
87+
}
88+
})
89+
})
90+
}
91+
}

pkg/types/aws/doc.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Package aws contains AWS-specific structures for installer
22
// configuration and management.
3+
// +k8s:deepcopy-gen=package
34
package aws
45

56
// Name is name for the AWS platform.

0 commit comments

Comments
 (0)