Skip to content

Commit 120bc68

Browse files
committed
ManagedSecurityGroups: fix missing omitemptys on optional fields
1 parent c2e8b49 commit 120bc68

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

api/v1alpha5/conversion_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func TestConvertFrom(t *testing.T) {
5151
},
5252
ObjectMeta: metav1.ObjectMeta{
5353
Annotations: map[string]string{
54-
"cluster.x-k8s.io/conversion-data": "{\"spec\":{\"apiServerLoadBalancer\":{},\"controlPlaneEndpoint\":{\"host\":\"\",\"port\":0},\"disableAPIServerFloatingIP\":false,\"disableExternalNetwork\":false,\"externalNetwork\":{},\"identityRef\":{\"cloudName\":\"\",\"name\":\"\"},\"managedSecurityGroups\":null,\"network\":{}},\"status\":{\"ready\":false}}",
54+
"cluster.x-k8s.io/conversion-data": "{\"spec\":{\"apiServerLoadBalancer\":{},\"controlPlaneEndpoint\":{\"host\":\"\",\"port\":0},\"disableAPIServerFloatingIP\":false,\"disableExternalNetwork\":false,\"externalNetwork\":{},\"identityRef\":{\"cloudName\":\"\",\"name\":\"\"},\"network\":{}},\"status\":{\"ready\":false}}",
5555
},
5656
},
5757
},
@@ -72,7 +72,7 @@ func TestConvertFrom(t *testing.T) {
7272
},
7373
ObjectMeta: metav1.ObjectMeta{
7474
Annotations: map[string]string{
75-
"cluster.x-k8s.io/conversion-data": "{\"spec\":{\"template\":{\"spec\":{\"apiServerLoadBalancer\":{},\"controlPlaneEndpoint\":{\"host\":\"\",\"port\":0},\"disableAPIServerFloatingIP\":false,\"disableExternalNetwork\":false,\"externalNetwork\":{},\"identityRef\":{\"cloudName\":\"\",\"name\":\"\"},\"managedSecurityGroups\":null,\"network\":{}}}}}",
75+
"cluster.x-k8s.io/conversion-data": "{\"spec\":{\"template\":{\"spec\":{\"apiServerLoadBalancer\":{},\"controlPlaneEndpoint\":{\"host\":\"\",\"port\":0},\"disableAPIServerFloatingIP\":false,\"disableExternalNetwork\":false,\"externalNetwork\":{},\"identityRef\":{\"cloudName\":\"\",\"name\":\"\"},\"network\":{}}}}}",
7676
},
7777
},
7878
},

api/v1beta1/openstackcluster_types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ type OpenStackClusterSpec struct {
123123
// It's possible to add additional rules to the managed security groups.
124124
// When defined to an empty struct, the managed security groups will be created with the default rules.
125125
// +optional
126-
ManagedSecurityGroups *ManagedSecurityGroups `json:"managedSecurityGroups"`
126+
ManagedSecurityGroups *ManagedSecurityGroups `json:"managedSecurityGroups,omitempty"`
127127

128128
// DisablePortSecurity disables the port security of the network created for the
129129
// Kubernetes cluster, which also disables SecurityGroups
@@ -272,7 +272,7 @@ type ManagedSecurityGroups struct {
272272
// +listType=map
273273
// +listMapKey=name
274274
// +optional
275-
AllNodesSecurityGroupRules []SecurityGroupRuleSpec `json:"allNodesSecurityGroupRules" patchStrategy:"merge" patchMergeKey:"name"`
275+
AllNodesSecurityGroupRules []SecurityGroupRuleSpec `json:"allNodesSecurityGroupRules,omitempty" patchStrategy:"merge" patchMergeKey:"name"`
276276

277277
// AllowAllInClusterTraffic allows all ingress and egress traffic between cluster nodes when set to true.
278278
// +kubebuilder:default=false

0 commit comments

Comments
 (0)