Skip to content

Commit eaa5b92

Browse files
committed
enable the KAL condition linter
1 parent 30dce62 commit eaa5b92

20 files changed

+150
-104
lines changed

.golangci-kal.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ linters:
2121
- "ssatags"
2222
- "nomaps"
2323
- "integers"
24-
- "conditions"
2524
- "jsontags"
2625
- "requiredfields"
2726
- "optionalfields"

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ REGISTRY ?= docker.io/linode
55
IMAGE_NAME ?= cluster-api-provider-linode
66
CONTROLLER_IMAGE ?= $(REGISTRY)/$(IMAGE_NAME)
77
TAG ?= dev
8-
ENVTEST_K8S_VERSION := 1.30.0
8+
ENVTEST_K8S_VERSION := $(shell go list -m -f '{{.Version}}' k8s.io/client-go)
99
VERSION ?= $(shell git describe --always --tag --dirty=-dev)
1010
BUILD_ARGS := --build-arg VERSION=$(VERSION)
1111
SHELL = /usr/bin/env bash -o pipefail
@@ -154,7 +154,7 @@ docs:
154154

155155
.PHONY: test
156156
test: generate fmt vet envtest ## Run tests.
157-
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(CACHE_BIN) -p path)" go test -race -timeout 60s `go list ./... | grep -v ./mock$$` -coverprofile cover.out.tmp
157+
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use ${ENVTEST_K8S_VERSION#v} --bin-dir $(CACHE_BIN) -p path)" go test -race -timeout 60s `go list ./... | grep -v ./mock$$` -coverprofile cover.out.tmp
158158
grep -v "zz_generated.*" cover.out.tmp > cover.out
159159
rm cover.out.tmp
160160

api/v1alpha2/linodecluster_types.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,14 @@ type LinodeClusterSpec struct {
7171

7272
// LinodeClusterStatus defines the observed state of LinodeCluster
7373
type LinodeClusterStatus struct {
74+
// conditions define the current service state of the LinodeCluster.
75+
// +optional
76+
// +listType=map
77+
// +listMapKey=type
78+
// +patchStrategy=merge
79+
// +patchMergeKey=type
80+
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
81+
7482
// ready denotes that the cluster (infrastructure) is ready.
7583
// +optional
7684
Ready bool `json:"ready"`
@@ -86,10 +94,6 @@ type LinodeClusterStatus struct {
8694
// for logging and human consumption.
8795
// +optional
8896
FailureMessage *string `json:"failureMessage,omitempty"`
89-
90-
// conditions defines current service state of the LinodeCluster.
91-
// +optional
92-
Conditions []metav1.Condition `json:"conditions,omitempty"`
9397
}
9498

9599
// +kubebuilder:object:root=true

api/v1alpha2/linodefirewall_types.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,14 @@ type LinodeFirewallSpec struct {
7676

7777
// LinodeFirewallStatus defines the observed state of LinodeFirewall
7878
type LinodeFirewallStatus struct {
79+
// conditions define the current service state of the LinodeFirewall.
80+
// +optional
81+
// +listType=map
82+
// +listMapKey=type
83+
// +patchStrategy=merge
84+
// +patchMergeKey=type
85+
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
86+
7987
// ready is true when the provider resource is ready.
8088
// +optional
8189
// +kubebuilder:default=false
@@ -118,10 +126,6 @@ type LinodeFirewallStatus struct {
118126
// controller's output.
119127
// +optional
120128
FailureMessage *string `json:"failureMessage,omitempty"`
121-
122-
// conditions define the current service state of the LinodeFirewall.
123-
// +optional
124-
Conditions []metav1.Condition `json:"conditions,omitempty"`
125129
}
126130

127131
// +kubebuilder:object:root=true

api/v1alpha2/linodemachine_types.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,14 @@ type VPCIPv4 struct {
455455

456456
// LinodeMachineStatus defines the observed state of LinodeMachine
457457
type LinodeMachineStatus struct {
458+
// conditions define the current service state of the LinodeMachine.
459+
// +optional
460+
// +listType=map
461+
// +listMapKey=type
462+
// +patchStrategy=merge
463+
// +patchMergeKey=type
464+
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
465+
458466
// ready is true when the provider resource is ready.
459467
// +optional
460468
// +kubebuilder:default=false
@@ -513,10 +521,6 @@ type LinodeMachineStatus struct {
513521
// +optional
514522
FailureMessage *string `json:"failureMessage,omitempty"`
515523

516-
// conditions defines current service state of the LinodeMachine.
517-
// +optional
518-
Conditions []metav1.Condition `json:"conditions,omitempty"`
519-
520524
// tags are the tags applied to the Linode Machine.
521525
// +optional
522526
Tags []string `json:"tags,omitempty"`

api/v1alpha2/linodemachinetemplate_types.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ type LinodeMachineTemplateSpec struct {
3030
// LinodeMachineTemplateStatus defines the observed state of LinodeMachineTemplate
3131
// It is used to store the status of the LinodeMachineTemplate, such as tags.
3232
type LinodeMachineTemplateStatus struct {
33+
// conditions define the current service state of the LinodeMachineTemplate
34+
// +optional
35+
// +listType=map
36+
// +listMapKey=type
37+
// +patchStrategy=merge
38+
// +patchMergeKey=type
39+
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
3340

3441
// tags that are currently applied to the LinodeMachineTemplate.
3542
// +optional
@@ -38,10 +45,6 @@ type LinodeMachineTemplateStatus struct {
3845
// firewallID that is currently applied to the LinodeMachineTemplate.
3946
// +optional
4047
FirewallID int `json:"firewallID,omitempty"`
41-
42-
// conditions represent the latest available observations of a LinodeMachineTemplate's current state.
43-
// +optional
44-
Conditions []metav1.Condition `json:"conditions,omitempty"`
4548
}
4649

4750
// LinodeMachineTemplateResource describes the data needed to create a LinodeMachine from a template.

api/v1alpha2/linodeobjectstoragebucket_types.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,14 @@ type LinodeObjectStorageBucketSpec struct {
6868

6969
// LinodeObjectStorageBucketStatus defines the observed state of LinodeObjectStorageBucket
7070
type LinodeObjectStorageBucketStatus struct {
71+
// conditions define the current service state of the LinodeObjectStorageBucket.
72+
// +optional
73+
// +listType=map
74+
// +listMapKey=type
75+
// +patchStrategy=merge
76+
// +patchMergeKey=type
77+
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
78+
7179
// ready denotes that the bucket has been provisioned along with access keys.
7280
// +optional
7381
// +kubebuilder:default=false
@@ -79,10 +87,6 @@ type LinodeObjectStorageBucketStatus struct {
7987
// +optional
8088
FailureMessage *string `json:"failureMessage,omitempty"`
8189

82-
// conditions specify the service state of the LinodeObjectStorageBucket.
83-
// +optional
84-
Conditions []metav1.Condition `json:"conditions,omitempty"`
85-
8690
// hostname is the address assigned to the bucket.
8791
// +optional
8892
Hostname *string `json:"hostname,omitempty"`

api/v1alpha2/linodeobjectstoragekey_types.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,14 @@ type LinodeObjectStorageKeySpec struct {
101101

102102
// LinodeObjectStorageKeyStatus defines the observed state of LinodeObjectStorageKey
103103
type LinodeObjectStorageKeyStatus struct {
104+
// conditions define the current service state of the LinodeObjectStorageKey.
105+
// +optional
106+
// +listType=map
107+
// +listMapKey=type
108+
// +patchStrategy=merge
109+
// +patchMergeKey=type
110+
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
111+
104112
// ready denotes that the key has been provisioned.
105113
// +optional
106114
// +kubebuilder:default=false
@@ -112,14 +120,6 @@ type LinodeObjectStorageKeyStatus struct {
112120
// +optional
113121
FailureMessage *string `json:"failureMessage,omitempty"`
114122

115-
// conditions specify the service state of the LinodeObjectStorageKey.
116-
// +optional
117-
// +listType=map
118-
// +listMapKey=type
119-
// +patchStrategy=merge
120-
// +patchMergeKey=type
121-
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
122-
123123
// creationTime specifies the creation timestamp for the secret.
124124
// +optional
125125
CreationTime *metav1.Time `json:"creationTime,omitempty"`

api/v1alpha2/linodeplacementgroup_types.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ type LinodePlacementGroupSpec struct {
5959

6060
// LinodePlacementGroupStatus defines the observed state of LinodePlacementGroup
6161
type LinodePlacementGroupStatus struct {
62+
// conditions define the current service state of the LinodePlacementGroup.
63+
// +optional
64+
// +listType=map
65+
// +listMapKey=type
66+
// +patchStrategy=merge
67+
// +patchMergeKey=type
68+
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
69+
6270
// ready is true when the provider resource is ready.
6371
// +optional
6472
// +kubebuilder:default=false
@@ -101,10 +109,6 @@ type LinodePlacementGroupStatus struct {
101109
// controller's output.
102110
// +optional
103111
FailureMessage *string `json:"failureMessage,omitempty"`
104-
105-
// conditions defines current service state of the LinodePlacementGroup.
106-
// +optional
107-
Conditions []metav1.Condition `json:"conditions,omitempty"`
108112
}
109113

110114
// +kubebuilder:object:root=true

api/v1alpha2/linodevpc_types.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,14 @@ type VPCSubnetCreateOptionsIPv6 struct {
134134

135135
// LinodeVPCStatus defines the observed state of LinodeVPC
136136
type LinodeVPCStatus struct {
137+
// conditions define the current service state of the LinodeVPC.
138+
// +optional
139+
// +listType=map
140+
// +listMapKey=type
141+
// +patchStrategy=merge
142+
// +patchMergeKey=type
143+
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
144+
137145
// ready is true when the provider resource is ready.
138146
// +optional
139147
// +kubebuilder:default=false
@@ -176,10 +184,6 @@ type LinodeVPCStatus struct {
176184
// controller's output.
177185
// +optional
178186
FailureMessage *string `json:"failureMessage,omitempty"`
179-
180-
// conditions define the current service state of the LinodeVPC.
181-
// +optional
182-
Conditions []metav1.Condition `json:"conditions,omitempty"`
183187
}
184188

185189
// +kubebuilder:object:root=true

0 commit comments

Comments
 (0)