Skip to content

Commit 23e65bd

Browse files
committed
Remove unused fields from ExternalNetwork
1 parent f0da60b commit 23e65bd

File tree

12 files changed

+109
-81
lines changed

12 files changed

+109
-81
lines changed

api/v1alpha5/conversion.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,3 +256,19 @@ func Convert_v1alpha5_Network_To_v1alpha7_Network(in *Network, out *infrav1.Netw
256256
// PortOpts has been removed in v1alpha7
257257
return autoConvert_v1alpha5_Network_To_v1alpha7_Network(in, out, s)
258258
}
259+
260+
func Convert_v1alpha5_Network_To_v1alpha7_NetworkStatus(in *Network, out *infrav1.NetworkStatus, _ conversion.Scope) error {
261+
out.ID = in.ID
262+
out.Name = in.Name
263+
out.Tags = in.Tags
264+
265+
return nil
266+
}
267+
268+
func Convert_v1alpha7_NetworkStatus_To_v1alpha5_Network(in *infrav1.NetworkStatus, out *Network, _ conversion.Scope) error {
269+
out.ID = in.ID
270+
out.Name = in.Name
271+
out.Tags = in.Tags
272+
273+
return nil
274+
}

api/v1alpha5/zz_generated.conversion.go

Lines changed: 13 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1alpha6/conversion.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,3 +436,19 @@ func Convert_v1alpha6_Network_To_v1alpha7_Network(in *Network, out *infrav1.Netw
436436
// PortOpts has been removed in v1alpha7
437437
return autoConvert_v1alpha6_Network_To_v1alpha7_Network(in, out, s)
438438
}
439+
440+
func Convert_v1alpha6_Network_To_v1alpha7_NetworkStatus(in *Network, out *infrav1.NetworkStatus, _ conversion.Scope) error {
441+
out.ID = in.ID
442+
out.Name = in.Name
443+
out.Tags = in.Tags
444+
445+
return nil
446+
}
447+
448+
func Convert_v1alpha7_NetworkStatus_To_v1alpha6_Network(in *infrav1.NetworkStatus, out *Network, _ conversion.Scope) error {
449+
out.ID = in.ID
450+
out.Name = in.Name
451+
out.Tags = in.Tags
452+
453+
return nil
454+
}

api/v1alpha6/conversion_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,18 @@ func TestFuzzyConversion(t *testing.T) {
6060
instance.RootVolume = nil
6161
instance.ServerGroupID = ""
6262
},
63+
64+
func(status *OpenStackClusterStatus, c fuzz.Continue) {
65+
c.FuzzNoCustom(status)
66+
67+
// None of the following fields have ever been set in v1alpha6
68+
if status.ExternalNetwork != nil {
69+
status.ExternalNetwork.Subnet = nil
70+
status.ExternalNetwork.PortOpts = nil
71+
status.ExternalNetwork.Router = nil
72+
status.ExternalNetwork.APIServerLoadBalancer = nil
73+
}
74+
},
6375
}
6476
}
6577

api/v1alpha6/zz_generated.conversion.go

Lines changed: 13 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/v1alpha7/openstackcluster_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ type OpenStackClusterStatus struct {
159159
// It includes Subnets and Router.
160160
Network *Network `json:"network,omitempty"`
161161

162-
// External Network contains information about the created OpenStack external network.
163-
ExternalNetwork *Network `json:"externalNetwork,omitempty"`
162+
// externalNetwork contains information about the external network used for default ingress and egress traffic.
163+
ExternalNetwork *NetworkStatus `json:"externalNetwork,omitempty"`
164164

165165
// FailureDomains represent OpenStack availability zones
166166
FailureDomains clusterv1.FailureDomains `json:"failureDomains,omitempty"`

api/v1alpha7/types.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,15 @@ type Network struct {
196196
APIServerLoadBalancer *LoadBalancer `json:"apiServerLoadBalancer,omitempty"`
197197
}
198198

199+
// NetworkStatus contains basic information about an existing neutron network.
200+
type NetworkStatus struct {
201+
Name string `json:"name"`
202+
ID string `json:"id"`
203+
204+
//+optional
205+
Tags []string `json:"tags,omitempty"`
206+
}
207+
199208
// Subnet represents basic information about the associated OpenStack Neutron Subnet.
200209
type Subnet struct {
201210
Name string `json:"name"`

api/v1alpha7/zz_generated.deepcopy.go

Lines changed: 21 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

config/crd/bases/infrastructure.cluster.x-k8s.io_openstackclusters.yaml

Lines changed: 2 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -4469,78 +4469,13 @@ spec:
44694469
- rules
44704470
type: object
44714471
externalNetwork:
4472-
description: External Network contains information about the created
4473-
OpenStack external network.
4472+
description: externalNetwork contains information about the external
4473+
network used for default ingress and egress traffic.
44744474
properties:
4475-
apiServerLoadBalancer:
4476-
description: Be careful when using APIServerLoadBalancer, because
4477-
this field is optional and therefore not set in all cases
4478-
properties:
4479-
allowedCIDRs:
4480-
items:
4481-
type: string
4482-
type: array
4483-
id:
4484-
type: string
4485-
internalIP:
4486-
type: string
4487-
ip:
4488-
type: string
4489-
name:
4490-
type: string
4491-
tags:
4492-
items:
4493-
type: string
4494-
type: array
4495-
required:
4496-
- id
4497-
- internalIP
4498-
- ip
4499-
- name
4500-
type: object
45014475
id:
45024476
type: string
45034477
name:
45044478
type: string
4505-
router:
4506-
description: Router represents basic information about the associated
4507-
OpenStack Neutron Router.
4508-
properties:
4509-
id:
4510-
type: string
4511-
ips:
4512-
items:
4513-
type: string
4514-
type: array
4515-
name:
4516-
type: string
4517-
tags:
4518-
items:
4519-
type: string
4520-
type: array
4521-
required:
4522-
- id
4523-
- name
4524-
type: object
4525-
subnet:
4526-
description: Subnet represents basic information about the associated
4527-
OpenStack Neutron Subnet.
4528-
properties:
4529-
cidr:
4530-
type: string
4531-
id:
4532-
type: string
4533-
name:
4534-
type: string
4535-
tags:
4536-
items:
4537-
type: string
4538-
type: array
4539-
required:
4540-
- cidr
4541-
- id
4542-
- name
4543-
type: object
45444479
tags:
45454480
items:
45464481
type: string

pkg/cloud/services/loadbalancer/loadbalancer_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func Test_ReconcileLoadBalancer(t *testing.T) {
4343
DisableAPIServerFloatingIP: true,
4444
},
4545
Status: infrav1.OpenStackClusterStatus{
46-
ExternalNetwork: &infrav1.Network{
46+
ExternalNetwork: &infrav1.NetworkStatus{
4747
ID: "aaaaaaaa-bbbb-cccc-dddd-111111111111",
4848
},
4949
Network: &infrav1.Network{

0 commit comments

Comments
 (0)