Skip to content

Commit 8144c39

Browse files
committed
feat: add merge strategy markers
This commit adds merge strategy markers to our v1alpha6 API. This is required for Server-Side Apply (SSA) to work correctly. SSA is used in Cluster API v1.2, and not having these markers might cause issues when using ClusterClass patches. This only adds a subset of markers, where it was possible. I skipped adding markers for two cases: - We have many slices that do not have any proper map keys, as all fields are optional. This includes mostly "filter" structs, for example `NetworkParam` and `SecurityGroupParam`. - The selected map key may not be optional (`omitempty`). If it is, it can not be used as the map key. This applied to structs `AddressPair` and `ExternalRouterIPParam`. Further documentation: - CAPI v1.2 provider migration: https://cluster-api.sigs.k8s.io/developer/providers/v1.1-to-v1.2.html#required-api-changes-for-providers - SSA Markers: https://kubernetes.io/docs/reference/using-api/server-side-apply/#merge-strategy
1 parent 53998d3 commit 8144c39

7 files changed

+30
-0
lines changed

api/v1alpha6/openstackcluster_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ type OpenStackClusterSpec struct {
4848
// DNSNameservers is the list of nameservers for OpenStack Subnet being created.
4949
// Set this value when you need create a new network/subnet while the access
5050
// through DNS is required.
51+
// +listType=set
5152
DNSNameservers []string `json:"dnsNameservers,omitempty"`
5253
// ExternalRouterIPs is an array of externalIPs on the respective subnets.
5354
// This is necessary if the router needs a fixed ip in a specific subnet.
@@ -117,13 +118,15 @@ type OpenStackClusterSpec struct {
117118
DisablePortSecurity bool `json:"disablePortSecurity,omitempty"`
118119

119120
// Tags for all resources in cluster
121+
// +listType=set
120122
Tags []string `json:"tags,omitempty"`
121123

122124
// ControlPlaneEndpoint represents the endpoint used to communicate with the control plane.
123125
// +optional
124126
ControlPlaneEndpoint clusterv1.APIEndpoint `json:"controlPlaneEndpoint"`
125127

126128
// ControlPlaneAvailabilityZones is the az to deploy control plane to
129+
// +listType=set
127130
ControlPlaneAvailabilityZones []string `json:"controlPlaneAvailabilityZones,omitempty"`
128131

129132
// Bastion is the OpenStack instance to login the nodes

api/v1alpha6/openstackmachine_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ type OpenStackMachineSpec struct {
7878

7979
// Machine tags
8080
// Requires Nova api 2.52 minimum!
81+
// +listType=set
8182
Tags []string `json:"tags,omitempty"`
8283

8384
// Metadata mapping. Allows you to create a map of key value pairs to add to the server instance.

api/v1alpha6/types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ type PortOpts struct {
118118
TenantID string `json:"tenantId,omitempty"`
119119
ProjectID string `json:"projectId,omitempty"`
120120
// The uuids of the security groups to assign to the instance
121+
// +listType=set
121122
SecurityGroups *[]string `json:"securityGroups,omitempty"`
122123
// The names, uuids, filters or any combination these of the security groups to assign to the instance
123124
SecurityGroupFilters []SecurityGroupParam `json:"securityGroupFilters,omitempty"`
@@ -142,6 +143,7 @@ type PortOpts struct {
142143

143144
// Tags applied to the port (and corresponding trunk, if a trunk is configured.)
144145
// These tags are applied in addition to the instance's tags, which will also be applied to the port.
146+
// +listType=set
145147
Tags []string `json:"tags,omitempty"`
146148
}
147149

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4593,6 +4593,7 @@ spec:
45934593
items:
45944594
type: string
45954595
type: array
4596+
x-kubernetes-list-type: set
45964597
tags:
45974598
description: Tags applied to the port (and corresponding
45984599
trunk, if a trunk is configured.) These tags are applied
@@ -4601,6 +4602,7 @@ spec:
46014602
items:
46024603
type: string
46034604
type: array
4605+
x-kubernetes-list-type: set
46044606
tenantId:
46054607
type: string
46064608
trunk:
@@ -4692,6 +4694,7 @@ spec:
46924694
items:
46934695
type: string
46944696
type: array
4697+
x-kubernetes-list-type: set
46954698
trunk:
46964699
description: Whether the server instance is created on a trunk
46974700
port or not.
@@ -4709,6 +4712,7 @@ spec:
47094712
items:
47104713
type: string
47114714
type: array
4715+
x-kubernetes-list-type: set
47124716
controlPlaneEndpoint:
47134717
description: ControlPlaneEndpoint represents the endpoint used to
47144718
communicate with the control plane.
@@ -4751,6 +4755,7 @@ spec:
47514755
items:
47524756
type: string
47534757
type: array
4758+
x-kubernetes-list-type: set
47544759
externalNetworkId:
47554760
description: ExternalNetworkID is the ID of an external OpenStack
47564761
Network. This is necessary to get public internet to the VMs.
@@ -4898,6 +4903,7 @@ spec:
48984903
items:
48994904
type: string
49004905
type: array
4906+
x-kubernetes-list-type: set
49014907
type: object
49024908
status:
49034909
description: OpenStackClusterStatus defines the observed state of OpenStackCluster.
@@ -5116,6 +5122,7 @@ spec:
51165122
items:
51175123
type: string
51185124
type: array
5125+
x-kubernetes-list-type: set
51195126
tags:
51205127
description: Tags applied to the port (and corresponding
51215128
trunk, if a trunk is configured.) These tags are applied
@@ -5124,6 +5131,7 @@ spec:
51245131
items:
51255132
type: string
51265133
type: array
5134+
x-kubernetes-list-type: set
51275135
tenantId:
51285136
type: string
51295137
trunk:
@@ -5504,6 +5512,7 @@ spec:
55045512
items:
55055513
type: string
55065514
type: array
5515+
x-kubernetes-list-type: set
55075516
tags:
55085517
description: Tags applied to the port (and corresponding trunk,
55095518
if a trunk is configured.) These tags are applied in addition
@@ -5512,6 +5521,7 @@ spec:
55125521
items:
55135522
type: string
55145523
type: array
5524+
x-kubernetes-list-type: set
55155525
tenantId:
55165526
type: string
55175527
trunk:
@@ -5806,6 +5816,7 @@ spec:
58065816
items:
58075817
type: string
58085818
type: array
5819+
x-kubernetes-list-type: set
58095820
tags:
58105821
description: Tags applied to the port (and corresponding trunk,
58115822
if a trunk is configured.) These tags are applied in addition
@@ -5814,6 +5825,7 @@ spec:
58145825
items:
58155826
type: string
58165827
type: array
5828+
x-kubernetes-list-type: set
58175829
tenantId:
58185830
type: string
58195831
trunk:

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1827,6 +1827,7 @@ spec:
18271827
items:
18281828
type: string
18291829
type: array
1830+
x-kubernetes-list-type: set
18301831
tags:
18311832
description: Tags applied to the port (and corresponding
18321833
trunk, if a trunk is configured.) These tags
@@ -1835,6 +1836,7 @@ spec:
18351836
items:
18361837
type: string
18371838
type: array
1839+
x-kubernetes-list-type: set
18381840
tenantId:
18391841
type: string
18401842
trunk:
@@ -1929,6 +1931,7 @@ spec:
19291931
items:
19301932
type: string
19311933
type: array
1934+
x-kubernetes-list-type: set
19321935
trunk:
19331936
description: Whether the server instance is created
19341937
on a trunk port or not.
@@ -1947,6 +1950,7 @@ spec:
19471950
items:
19481951
type: string
19491952
type: array
1953+
x-kubernetes-list-type: set
19501954
controlPlaneEndpoint:
19511955
description: ControlPlaneEndpoint represents the endpoint
19521956
used to communicate with the control plane.
@@ -1992,6 +1996,7 @@ spec:
19921996
items:
19931997
type: string
19941998
type: array
1999+
x-kubernetes-list-type: set
19952000
externalNetworkId:
19962001
description: ExternalNetworkID is the ID of an external OpenStack
19972002
Network. This is necessary to get public internet to the
@@ -2143,6 +2148,7 @@ spec:
21432148
items:
21442149
type: string
21452150
type: array
2151+
x-kubernetes-list-type: set
21462152
type: object
21472153
required:
21482154
- spec

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1729,6 +1729,7 @@ spec:
17291729
items:
17301730
type: string
17311731
type: array
1732+
x-kubernetes-list-type: set
17321733
tags:
17331734
description: Tags applied to the port (and corresponding trunk,
17341735
if a trunk is configured.) These tags are applied in addition
@@ -1737,6 +1738,7 @@ spec:
17371738
items:
17381739
type: string
17391740
type: array
1741+
x-kubernetes-list-type: set
17401742
tenantId:
17411743
type: string
17421744
trunk:
@@ -1826,6 +1828,7 @@ spec:
18261828
items:
18271829
type: string
18281830
type: array
1831+
x-kubernetes-list-type: set
18291832
trunk:
18301833
description: Whether the server instance is created on a trunk port
18311834
or not.

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,6 +1439,7 @@ spec:
14391439
items:
14401440
type: string
14411441
type: array
1442+
x-kubernetes-list-type: set
14421443
tags:
14431444
description: Tags applied to the port (and corresponding
14441445
trunk, if a trunk is configured.) These tags are applied
@@ -1447,6 +1448,7 @@ spec:
14471448
items:
14481449
type: string
14491450
type: array
1451+
x-kubernetes-list-type: set
14501452
tenantId:
14511453
type: string
14521454
trunk:
@@ -1538,6 +1540,7 @@ spec:
15381540
items:
15391541
type: string
15401542
type: array
1543+
x-kubernetes-list-type: set
15411544
trunk:
15421545
description: Whether the server instance is created on a trunk
15431546
port or not.

0 commit comments

Comments
 (0)