Skip to content

Commit b926621

Browse files
committed
Enable nobools linter
1 parent 04a4f62 commit b926621

File tree

97 files changed

+311
-309
lines changed

Some content is hidden

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

97 files changed

+311
-309
lines changed

.golangci-kal.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ linters:
2222
#- "integers" # Ensure only int32 and int64 are used for integers.
2323
#- "jsontags" # Ensure every field has a json tag.
2424
#- "maxlength" # Ensure all strings and arrays have maximum lengths/maximum items.
25-
#- "nobools" # Bools do not evolve over time, should use enums instead.
25+
- "nobools" # Bools do not evolve over time, should use enums instead.
2626
#- "nofloats" # Ensure floats are not used.
2727
#- "optionalorrequired" # Every field should be marked as `+optional` or `+required`.
2828
# - "requiredfields" # Required fields should not be pointers, and should not have `omitempty`.

api/v1beta1/awscluster_types.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,12 @@ type Bastion struct {
131131
// Enabled allows this provider to create a bastion host instance
132132
// with a public ip to access the VPC private network.
133133
// +optional
134-
Enabled bool `json:"enabled"`
134+
Enabled bool `json:"enabled"` //nolint:kubeapilinter // nobools: Existing API field, not changing to preserve backwards compatibility.
135135

136136
// DisableIngressRules will ensure there are no Ingress rules in the bastion host's security group.
137137
// Requires AllowedCIDRBlocks to be empty.
138138
// +optional
139-
DisableIngressRules bool `json:"disableIngressRules,omitempty"`
139+
DisableIngressRules bool `json:"disableIngressRules,omitempty"` //nolint:kubeapilinter // nobools: Existing API field, not changing to preserve backwards compatibility.
140140

141141
// AllowedCIDRBlocks is a list of CIDR blocks allowed to access the bastion host.
142142
// They are set as ingress rules for the Bastion host's Security Group (defaults to 0.0.0.0/0).
@@ -180,7 +180,7 @@ type AWSLoadBalancerSpec struct {
180180
//
181181
// Defaults to false.
182182
// +optional
183-
CrossZoneLoadBalancing bool `json:"crossZoneLoadBalancing"`
183+
CrossZoneLoadBalancing bool `json:"crossZoneLoadBalancing"` //nolint:kubeapilinter // nobools: Existing API field, not changing to preserve backwards compatibility.
184184

185185
// Subnets sets the subnets that should be applied to the control plane load balancer (defaults to discovered subnets for managed VPCs or an empty set for unmanaged VPCs)
186186
// +optional
@@ -200,7 +200,7 @@ type AWSLoadBalancerSpec struct {
200200
// AWSClusterStatus defines the observed state of AWSCluster.
201201
type AWSClusterStatus struct {
202202
// +kubebuilder:default=false
203-
Ready bool `json:"ready"`
203+
Ready bool `json:"ready"` //nolint:kubeapilinter // nobools: Existing API field, not changing to preserve backwards compatibility.
204204
Network NetworkStatus `json:"networkStatus,omitempty"`
205205
FailureDomains clusterv1beta1.FailureDomains `json:"failureDomains,omitempty"`
206206
Bastion *Instance `json:"bastion,omitempty"`

api/v1beta1/awsmachine_types.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ type AWSMachineSpec struct {
9595
// 2. Cluster/flavor setting
9696
// 3. Subnet default
9797
// +optional
98-
PublicIP *bool `json:"publicIP,omitempty"`
98+
PublicIP *bool `json:"publicIP,omitempty"` //nolint:kubeapilinter // nobools: Existing API field, not changing to preserve backwards compatibility.
9999

100100
// AdditionalSecurityGroups is an array of references to security groups that should be applied to the
101101
// instance. These security groups would be set in addition to any security groups defined
@@ -137,7 +137,7 @@ type AWSMachineSpec struct {
137137
// user data stored in aws secret manager is always gzip-compressed.
138138
//
139139
// +optional
140-
UncompressedUserData *bool `json:"uncompressedUserData,omitempty"`
140+
UncompressedUserData *bool `json:"uncompressedUserData,omitempty"` //nolint:kubeapilinter // nobools: Existing API field, not changing to preserve backwards compatibility.
141141

142142
// CloudInit defines options related to the bootstrapping systems where
143143
// CloudInit is used.
@@ -165,7 +165,7 @@ type CloudInit struct {
165165
// or AWS Systems Manager Parameter Store to ensure privacy of userdata.
166166
// By default, a cloud-init boothook shell script is prepended to download
167167
// the userdata from Secrets Manager and additionally delete the secret.
168-
InsecureSkipSecretsManager bool `json:"insecureSkipSecretsManager,omitempty"`
168+
InsecureSkipSecretsManager bool `json:"insecureSkipSecretsManager,omitempty"` //nolint:kubeapilinter // nobools: Existing API field, not changing to preserve backwards compatibility.
169169

170170
// SecretCount is the number of secrets used to form the complete secret
171171
// +optional
@@ -199,12 +199,12 @@ type Ignition struct {
199199
type AWSMachineStatus struct {
200200
// Ready is true when the provider resource is ready.
201201
// +optional
202-
Ready bool `json:"ready"`
202+
Ready bool `json:"ready"` //nolint:kubeapilinter // nobools: Existing API field, not changing to preserve backwards compatibility.
203203

204204
// Interruptible reports that this machine is using spot instances and can therefore be interrupted by CAPI when it receives a notice that the spot instance is to be terminated by AWS.
205205
// This will be set to true when SpotMarketOptions is not nil (i.e. this machine is using a spot instance).
206206
// +optional
207-
Interruptible bool `json:"interruptible,omitempty"`
207+
Interruptible bool `json:"interruptible,omitempty"` //nolint:kubeapilinter // nobools: Existing API field, not changing to preserve backwards compatibility.
208208

209209
// Addresses contains the AWS instance associated addresses.
210210
Addresses []clusterv1beta1.MachineAddress `json:"addresses,omitempty"`

api/v1beta1/network_types.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ type ClassicELBAttributes struct {
125125

126126
// CrossZoneLoadBalancing enables the classic load balancer load balancing.
127127
// +optional
128-
CrossZoneLoadBalancing bool `json:"crossZoneLoadBalancing,omitempty"`
128+
CrossZoneLoadBalancing bool `json:"crossZoneLoadBalancing,omitempty"` //nolint:kubeapilinter // nobools: Existing API field, not changing to preserve backwards compatibility.
129129
}
130130

131131
// ClassicELBListener defines an AWS classic load balancer listener.
@@ -258,12 +258,12 @@ type SubnetSpec struct {
258258

259259
// IsPublic defines the subnet as a public subnet. A subnet is public when it is associated with a route table that has a route to an internet gateway.
260260
// +optional
261-
IsPublic bool `json:"isPublic"`
261+
IsPublic bool `json:"isPublic"` //nolint:kubeapilinter // nobools: Existing API field, not changing to preserve backwards compatibility.
262262

263263
// IsIPv6 defines the subnet as an IPv6 subnet. A subnet is IPv6 when it is associated with a VPC that has IPv6 enabled.
264264
// IPv6 is only supported in managed clusters, this field cannot be set on AWSCluster object.
265265
// +optional
266-
IsIPv6 bool `json:"isIpv6,omitempty"`
266+
IsIPv6 bool `json:"isIpv6,omitempty"` //nolint:kubeapilinter // nobools: Existing API field, not changing to preserve backwards compatibility.
267267

268268
// RouteTableID is the routing table id associated with the subnet.
269269
// +optional

api/v1beta1/types.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,10 @@ type Instance struct {
174174
PublicIP *string `json:"publicIp,omitempty"`
175175

176176
// Specifies whether enhanced networking with ENA is enabled.
177-
ENASupport *bool `json:"enaSupport,omitempty"`
177+
ENASupport *bool `json:"enaSupport,omitempty"` //nolint:kubeapilinter // nobools: Existing API field, not changing to preserve backwards compatibility.
178178

179179
// Indicates whether the instance is optimized for Amazon EBS I/O.
180-
EBSOptimized *bool `json:"ebsOptimized,omitempty"`
180+
EBSOptimized *bool `json:"ebsOptimized,omitempty"` //nolint:kubeapilinter // nobools: Existing API field, not changing to preserve backwards compatibility.
181181

182182
// Configuration options for the root storage volume.
183183
// +optional
@@ -233,7 +233,7 @@ type Volume struct {
233233

234234
// Encrypted is whether the volume should be encrypted or not.
235235
// +optional
236-
Encrypted *bool `json:"encrypted,omitempty"`
236+
Encrypted *bool `json:"encrypted,omitempty"` //nolint:kubeapilinter // nobools: Existing API field, not changing to preserve backwards compatibility.
237237

238238
// EncryptionKey is the KMS key to use to encrypt the volume. Can be either a KMS key ID or ARN.
239239
// If Encrypted is set and this is omitted, the default AWS key will be used.

api/v1beta2/awscluster_types.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,12 @@ type Bastion struct {
143143
// Enabled allows this provider to create a bastion host instance
144144
// with a public ip to access the VPC private network.
145145
// +optional
146-
Enabled bool `json:"enabled"`
146+
Enabled bool `json:"enabled"` //nolint:kubeapilinter // nobools: Existing API field, not changing to preserve backwards compatibility.
147147

148148
// DisableIngressRules will ensure there are no Ingress rules in the bastion host's security group.
149149
// Requires AllowedCIDRBlocks to be empty.
150150
// +optional
151-
DisableIngressRules bool `json:"disableIngressRules,omitempty"`
151+
DisableIngressRules bool `json:"disableIngressRules,omitempty"` //nolint:kubeapilinter // nobools: Existing API field, not changing to preserve backwards compatibility.
152152

153153
// AllowedCIDRBlocks is a list of CIDR blocks allowed to access the bastion host.
154154
// They are set as ingress rules for the Bastion host's Security Group (defaults to 0.0.0.0/0).
@@ -208,7 +208,7 @@ type AWSLoadBalancerSpec struct {
208208
//
209209
// Defaults to false.
210210
// +optional
211-
CrossZoneLoadBalancing bool `json:"crossZoneLoadBalancing"`
211+
CrossZoneLoadBalancing bool `json:"crossZoneLoadBalancing"` //nolint:kubeapilinter // nobools: Existing API field, not changing to preserve backwards compatibility.
212212

213213
// Subnets sets the subnets that should be applied to the control plane load balancer (defaults to discovered subnets for managed VPCs or an empty set for unmanaged VPCs)
214214
// +optional
@@ -247,11 +247,11 @@ type AWSLoadBalancerSpec struct {
247247

248248
// DisableHostsRewrite disabled the hair pinning issue solution that adds the NLB's address as 127.0.0.1 to the hosts
249249
// file of each instance. This is by default, false.
250-
DisableHostsRewrite bool `json:"disableHostsRewrite,omitempty"`
250+
DisableHostsRewrite bool `json:"disableHostsRewrite,omitempty"` //nolint:kubeapilinter // nobools: Existing API field, not changing to preserve backwards compatibility.
251251

252252
// PreserveClientIP lets the user control if preservation of client ips must be retained or not.
253253
// If this is enabled 6443 will be opened to 0.0.0.0/0.
254-
PreserveClientIP bool `json:"preserveClientIP,omitempty"`
254+
PreserveClientIP bool `json:"preserveClientIP,omitempty"` //nolint:kubeapilinter // nobools: Existing API field, not changing to preserve backwards compatibility.
255255
}
256256

257257
// AdditionalListenerSpec defines the desired state of an
@@ -276,7 +276,7 @@ type AdditionalListenerSpec struct {
276276
// AWSClusterStatus defines the observed state of AWSCluster.
277277
type AWSClusterStatus struct {
278278
// +kubebuilder:default=false
279-
Ready bool `json:"ready"`
279+
Ready bool `json:"ready"` //nolint:kubeapilinter // nobools: Existing API field, not changing to preserve backwards compatibility.
280280
Network NetworkStatus `json:"networkStatus,omitempty"`
281281
FailureDomains clusterv1beta1.FailureDomains `json:"failureDomains,omitempty"`
282282
Bastion *Instance `json:"bastion,omitempty"`
@@ -312,7 +312,7 @@ type S3Bucket struct {
312312

313313
// BestEffortDeleteObjects defines whether access/permission errors during object deletion should be ignored.
314314
// +optional
315-
BestEffortDeleteObjects *bool `json:"bestEffortDeleteObjects,omitempty"`
315+
BestEffortDeleteObjects *bool `json:"bestEffortDeleteObjects,omitempty"` //nolint:kubeapilinter // nobools: Existing API field, not changing to preserve backwards compatibility.
316316
}
317317

318318
// +kubebuilder:object:root=true

api/v1beta2/awscluster_webhook_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func TestAWSClusterValidateCreate(t *testing.T) {
5050
tests := []struct {
5151
name string
5252
cluster *AWSCluster
53-
wantErr bool
53+
wantErr bool //nolint:kubeapilinter // nobools: Existing API field, not changing to preserve backwards compatibility.
5454
expect func(g *WithT, res *AWSLoadBalancerSpec)
5555
}{
5656
{
@@ -789,7 +789,7 @@ func TestAWSClusterValidateUpdate(t *testing.T) {
789789
name string
790790
oldCluster *AWSCluster
791791
newCluster *AWSCluster
792-
wantErr bool
792+
wantErr bool //nolint:kubeapilinter // nobools: Existing API field, not changing to preserve backwards compatibility.
793793
}{
794794
{
795795
name: "Control Plane LB type is immutable when switching from disabled to any",
@@ -1343,7 +1343,7 @@ func TestAWSClusterValidateAllowedCIDRBlocks(t *testing.T) {
13431343
tests := []struct {
13441344
name string
13451345
awsc *AWSCluster
1346-
wantErr bool
1346+
wantErr bool //nolint:kubeapilinter // nobools: Existing API field, not changing to preserve backwards compatibility.
13471347
}{
13481348
{
13491349
name: "allow valid CIDRs",

api/v1beta2/awsclustercontrolleridentity_webhook_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func TestAWSClusterControllerIdentityCreationValidation(t *testing.T) {
3030
tests := []struct {
3131
name string
3232
identity *AWSClusterControllerIdentity
33-
wantError bool
33+
wantError bool //nolint:kubeapilinter // nobools: Existing API field, not changing to preserve backwards compatibility.
3434
}{
3535
{
3636
name: "only allow AWSClusterControllerIdentity creation with name default",
@@ -71,7 +71,7 @@ func TestAWSClusterControllerIdentityLabelSelectorAsSelectorValidation(t *testin
7171
tests := []struct {
7272
name string
7373
selectors map[string]string
74-
wantError bool
74+
wantError bool //nolint:kubeapilinter // nobools: Existing API field, not changing to preserve backwards compatibility.
7575
}{
7676
{
7777
name: "should not return error for valid selector",
@@ -140,7 +140,7 @@ func TestAWSClusterControllerValidateUpdate(t *testing.T) {
140140
tests := []struct {
141141
name string
142142
identity *AWSClusterControllerIdentity
143-
wantError bool
143+
wantError bool //nolint:kubeapilinter // nobools: Existing API field, not changing to preserve backwards compatibility.
144144
}{
145145
{
146146
name: "do not allow any spec changes",
@@ -211,7 +211,7 @@ func TestAWSClusterControllerIdentityUpdateValidation(t *testing.T) {
211211
tests := []struct {
212212
name string
213213
identity *AWSClusterControllerIdentity
214-
wantError bool
214+
wantError bool //nolint:kubeapilinter // nobools: Existing API field, not changing to preserve backwards compatibility.
215215
}{
216216
{
217217
name: "should not return error for valid selector",

api/v1beta2/awsclusterroleidentity_webhook_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func TestAWSClusterRoleValidateCreate(t *testing.T) {
3030
tests := []struct {
3131
name string
3232
identity *AWSClusterRoleIdentity
33-
wantError bool
33+
wantError bool //nolint:kubeapilinter // nobools: Existing API field, not changing to preserve backwards compatibility.
3434
}{
3535
{
3636
name: "do not allow nil sourceIdentityRef",
@@ -77,7 +77,7 @@ func TestCreateAWSClusterRoleIdentityLabelSelectorAsSelectorValidation(t *testin
7777
tests := []struct {
7878
name string
7979
selectors map[string]string
80-
wantError bool
80+
wantError bool //nolint:kubeapilinter // nobools: Existing API field, not changing to preserve backwards compatibility.
8181
}{
8282
{
8383
name: "should not return error for valid selector",
@@ -184,7 +184,7 @@ func TestAWSClusterRoleIdentityUpdateValidation(t *testing.T) {
184184
tests := []struct {
185185
name string
186186
identity *AWSClusterRoleIdentity
187-
wantError bool
187+
wantError bool //nolint:kubeapilinter // nobools: Existing API field, not changing to preserve backwards compatibility.
188188
}{
189189
{
190190
name: "should not return error for valid selector",

api/v1beta2/awsclusterstaticidentity_webhook_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ func TestCreateAWSClusterStaticIdentityValidation(t *testing.T) {
3030
tests := []struct {
3131
name string
3232
selectors map[string]string
33-
wantError bool
33+
wantError bool //nolint:kubeapilinter // nobools: Existing API field, not changing to preserve backwards compatibility.
3434
}{
3535
{
3636
name: "should not return error for valid selector",
@@ -98,7 +98,7 @@ func TestAWSClusterStaticValidateUpdate(t *testing.T) {
9898
tests := []struct {
9999
name string
100100
identity *AWSClusterStaticIdentity
101-
wantError bool
101+
wantError bool //nolint:kubeapilinter // nobools: Existing API field, not changing to preserve backwards compatibility.
102102
}{
103103
{
104104
name: "do not allow any spec changes",
@@ -162,7 +162,7 @@ func TestAWSClusterStaticIdentityUpdateLabelSelectorValidation(t *testing.T) {
162162
tests := []struct {
163163
name string
164164
identity *AWSClusterStaticIdentity
165-
wantError bool
165+
wantError bool //nolint:kubeapilinter // nobools: Existing API field, not changing to preserve backwards compatibility.
166166
}{
167167
{
168168
name: "should not return error for valid selector",

0 commit comments

Comments
 (0)