Skip to content

Commit 8fa4ce2

Browse files
authored
Merge pull request #3224 from Nordix/lentzi90/kal-ssatags
✨ Enable ssatags linter and fix findings
2 parents 20a1532 + d2d6a13 commit 8fa4ce2

13 files changed

Lines changed: 179 additions & 27 deletions

.golangci-kal.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ linters:
3232
# having the omitempty value in their json tag where appropriate.
3333
- "optionalorrequired" # Every field should be marked as optional or required.
3434
- "requiredfields" # Required fields should have omitempty/omitzero, and should only be pointers when the zero value is valid.
35-
# - "ssatags" # Ensure array fields have the appropriate listType markers.
35+
- "ssatags" # Ensure array fields have the appropriate listType markers.
3636
- "statusoptional" # Ensure all first children within status should be optional.
3737
- "statussubresource" # All root objects that have a status field should have a status subresource.
3838
- "uniquemarkers" # Ensure that types and fields do not contain more than a single definition of a marker that should only be present once.

api/v1beta2/openstackcluster_types.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,8 @@ type OpenStackClusterStatus struct {
233233
APIServerManagedLoadBalancer *LoadBalancer `json:"apiServerManagedLoadBalancer,omitempty"`
234234

235235
// failureDomains represent OpenStack availability zones
236+
// +listType=map
237+
// +listMapKey=name
236238
// +optional
237239
FailureDomains []clusterv1.FailureDomain `json:"failureDomains,omitempty"`
238240

api/v1beta2/openstackmachine_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,12 @@ type OpenStackMachineSpec struct {
112112

113113
// ports to be attached to the server instance. They are created if a port with the given name does not already exist.
114114
// If not specified a default port will be added for the default cluster network.
115+
// +listType=atomic
115116
// +optional
116117
Ports []PortOpts `json:"ports,omitempty"`
117118

118119
// securityGroups is a list of security groups to assign to the instance.
120+
// +listType=atomic
119121
// +optional
120122
SecurityGroups []SecurityGroupParam `json:"securityGroups,omitempty"`
121123

@@ -218,6 +220,7 @@ type OpenStackMachineStatus struct {
218220
InstanceID optional.String `json:"instanceID,omitempty"`
219221

220222
// addresses contains the OpenStack instance associated addresses.
223+
// +listType=atomic
221224
// +optional
222225
Addresses []corev1.NodeAddress `json:"addresses,omitempty"`
223226

api/v1beta2/types.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,12 +346,14 @@ type SubnetSpec struct {
346346

347347
// dnsNameservers holds a list of DNS server addresses that will be provided when creating
348348
// the subnet. These addresses need to have the same IP version as CIDR.
349+
// +listType=atomic
349350
// +optional
350351
DNSNameservers []string `json:"dnsNameservers,omitempty"`
351352

352353
// allocationPools is an array of AllocationPool objects that will be applied to OpenStack Subnet being created.
353354
// If set, OpenStack will only allocate these IPs for Machines. It will still be possible to create ports from
354355
// outside of these ranges manually.
356+
// +listType=atomic
355357
// +optional
356358
AllocationPools []AllocationPool `json:"allocationPools,omitempty"`
357359
}
@@ -424,6 +426,7 @@ type ResolvedPortSpecFields struct {
424426
// addresses. If not specified, the MAC Address will be the MAC Address
425427
// of the port. Depending on the configuration of Neutron, it may be
426428
// supported to specify a CIDR instead of a specific IP address.
429+
// +listType=atomic
427430
// +optional
428431
AllowedAddressPairs []AddressPair `json:"allowedAddressPairs,omitempty"`
429432

@@ -751,6 +754,7 @@ type NetworkStatus struct {
751754
ID string `json:"id,omitempty"`
752755

753756
// tags is a list of tags on the network.
757+
// +listType=set
754758
// +optional
755759
Tags []string `json:"tags,omitempty"`
756760
}
@@ -760,6 +764,7 @@ type NetworkStatusWithSubnets struct {
760764
NetworkStatus `json:",inline"`
761765

762766
// subnets is a list of subnets associated with the default cluster network. Machines which use the default cluster network will get an address from all of these subnets.
767+
// +listType=atomic
763768
// +optional
764769
Subnets []Subnet `json:"subnets,omitempty"`
765770
}
@@ -781,6 +786,7 @@ type Subnet struct {
781786
CIDR string `json:"cidr,omitempty"`
782787

783788
// tags is a list of tags on the subnet.
789+
// +listType=set
784790
// +optional
785791
Tags []string `json:"tags,omitempty"`
786792
}
@@ -796,9 +802,11 @@ type Router struct {
796802
// +kubebuilder:validation:MinLength=1
797803
ID string `json:"id,omitempty"`
798804
// tags is a list of tags on the router.
805+
// +listType=set
799806
// +optional
800807
Tags []string `json:"tags,omitempty"`
801808
// ips is a list of IP addresses assigned to the router.
809+
// +listType=set
802810
// +optional
803811
IPs []string `json:"ips,omitempty"`
804812
}
@@ -822,9 +830,11 @@ type LoadBalancer struct {
822830
// +kubebuilder:validation:MinLength=1
823831
InternalIP string `json:"internalIP,omitempty"`
824832
// allowedCIDRs is a list of CIDRs that are allowed to access the load balancer.
833+
// +listType=set
825834
// +optional
826835
AllowedCIDRs []string `json:"allowedCIDRs,omitempty"`
827836
// tags is a list of tags on the load balancer.
837+
// +listType=set
828838
// +optional
829839
Tags []string `json:"tags,omitempty"`
830840
// loadBalancerNetwork contains information about network and/or subnets which the
@@ -906,6 +916,7 @@ type SecurityGroupRuleSpec struct {
906916

907917
// remoteManagedGroups is the remote managed groups to be associated with this security group rule.
908918
// You can specify either remoteGroupID or remoteIPPrefix or remoteManagedGroups.
919+
// +listType=set
909920
// +optional
910921
RemoteManagedGroups []ManagedSecurityGroupName `json:"remoteManagedGroups,omitempty"`
911922
}
@@ -1091,12 +1102,14 @@ type ResolvedMachineSpec struct {
10911102
FlavorID string `json:"flavorID,omitempty"`
10921103

10931104
// ports is the fully resolved list of ports to create for the machine.
1105+
// +listType=atomic
10941106
// +optional
10951107
Ports []ResolvedPortSpec `json:"ports,omitempty"`
10961108
}
10971109

10981110
type MachineResources struct {
10991111
// ports is the status of the ports created for the machine.
1112+
// +listType=atomic
11001113
// +optional
11011114
Ports []PortStatus `json:"ports,omitempty"`
11021115
}

api_violations.report

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,6 @@ API rule violation: list_type_missing,sigs.k8s.io/cluster-api-provider-openstack
2525
API rule violation: list_type_missing,sigs.k8s.io/cluster-api-provider-openstack/api/v1beta1,Subnet,Tags
2626
API rule violation: list_type_missing,sigs.k8s.io/cluster-api-provider-openstack/api/v1beta1,SubnetSpec,AllocationPools
2727
API rule violation: list_type_missing,sigs.k8s.io/cluster-api-provider-openstack/api/v1beta1,SubnetSpec,DNSNameservers
28-
API rule violation: list_type_missing,sigs.k8s.io/cluster-api-provider-openstack/api/v1beta2,LoadBalancer,AllowedCIDRs
29-
API rule violation: list_type_missing,sigs.k8s.io/cluster-api-provider-openstack/api/v1beta2,LoadBalancer,Tags
30-
API rule violation: list_type_missing,sigs.k8s.io/cluster-api-provider-openstack/api/v1beta2,MachineResources,Ports
31-
API rule violation: list_type_missing,sigs.k8s.io/cluster-api-provider-openstack/api/v1beta2,NetworkStatus,Tags
32-
API rule violation: list_type_missing,sigs.k8s.io/cluster-api-provider-openstack/api/v1beta2,NetworkStatusWithSubnets,Subnets
33-
API rule violation: list_type_missing,sigs.k8s.io/cluster-api-provider-openstack/api/v1beta2,OpenStackClusterStatus,FailureDomains
34-
API rule violation: list_type_missing,sigs.k8s.io/cluster-api-provider-openstack/api/v1beta2,OpenStackMachineSpec,Ports
35-
API rule violation: list_type_missing,sigs.k8s.io/cluster-api-provider-openstack/api/v1beta2,OpenStackMachineSpec,SecurityGroups
36-
API rule violation: list_type_missing,sigs.k8s.io/cluster-api-provider-openstack/api/v1beta2,OpenStackMachineStatus,Addresses
37-
API rule violation: list_type_missing,sigs.k8s.io/cluster-api-provider-openstack/api/v1beta2,ResolvedMachineSpec,Ports
38-
API rule violation: list_type_missing,sigs.k8s.io/cluster-api-provider-openstack/api/v1beta2,ResolvedPortSpecFields,AllowedAddressPairs
39-
API rule violation: list_type_missing,sigs.k8s.io/cluster-api-provider-openstack/api/v1beta2,Router,IPs
40-
API rule violation: list_type_missing,sigs.k8s.io/cluster-api-provider-openstack/api/v1beta2,Router,Tags
41-
API rule violation: list_type_missing,sigs.k8s.io/cluster-api-provider-openstack/api/v1beta2,SecurityGroupRuleSpec,RemoteManagedGroups
42-
API rule violation: list_type_missing,sigs.k8s.io/cluster-api-provider-openstack/api/v1beta2,Subnet,Tags
43-
API rule violation: list_type_missing,sigs.k8s.io/cluster-api-provider-openstack/api/v1beta2,SubnetSpec,AllocationPools
44-
API rule violation: list_type_missing,sigs.k8s.io/cluster-api-provider-openstack/api/v1beta2,SubnetSpec,DNSNameservers
4528
API rule violation: list_type_missing,sigs.k8s.io/cluster-api/api/core/v1beta1,ClusterClassPatch,Definitions
4629
API rule violation: list_type_missing,sigs.k8s.io/cluster-api/api/core/v1beta1,ClusterClassSpec,Patches
4730
API rule violation: list_type_missing,sigs.k8s.io/cluster-api/api/core/v1beta1,ClusterClassSpec,Variables

cmd/models-schema/zz_generated.openapi.go

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

0 commit comments

Comments
 (0)