Skip to content

Commit 9f73369

Browse files
chore(deps): update https://github.com/kubernetes-sigs/kube-api-linter digest to 65a570b (#551)
* chore(deps): update https://github.com/kubernetes-sigs/kube-api-linter digest to 65a570b * chore: adapt to kube-api-linter changes --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Patryk Małek <patryk.malek@konghq.com>
1 parent 528d2c8 commit 9f73369

File tree

36 files changed

+212
-78
lines changed

36 files changed

+212
-78
lines changed

.custom-gcl.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ name: golangci-kube-api-linter
44
destination: ./bin
55
plugins:
66
- module: 'sigs.k8s.io/kube-api-linter'
7-
version: bdb40c631b356cf8018a246ec5b95e44b0fa9031
7+
version: 65a570bd22aac3fe2eb0c3721b1cc4ea6ec41e48

.golangci-kube-api.yaml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,33 @@ linters:
7171
- kubeapilinter
7272
path: api/konnect/v1alpha1/.*
7373
text: "conditions: Conditions field must be the first field in the struct"
74+
75+
# TODO: remove this.
76+
- linters:
77+
- kubeapilinter
78+
path: api/.*
79+
text: "requiredfields: field .* should have the omitempty tag."
80+
81+
# TODO: remove this.
82+
- linters:
83+
- kubeapilinter
84+
path: api/.*
85+
text: "requiredfields: field .* does not allow the zero value. It must have the omitzero tag."
86+
87+
# TODO: remove this.
88+
- linters:
89+
- kubeapilinter
90+
path: api/konnect/(v1alpha1|v1alpha2)/.*
91+
text: 'requiredfields: field .* has a valid zero value .* but the validation is not complete'
92+
93+
# TODO: remove this.
94+
- linters:
95+
- kubeapilinter
96+
path: api/gateway-operator/v2beta1/shared_types.go
97+
text: 'requiredfields: field .* has a valid zero value .* but the validation is not complete'
98+
99+
# TODO: remove this.
100+
- linters:
101+
- kubeapilinter
102+
path: api/gateway-operator/v2beta1/shared_types.go
103+
text: 'requiredfields: field Strategy has a valid zero value .* and should be a pointer.'

api/common/v1alpha1/controlplaneref_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ type KonnectIDType string
8585
type KonnectNamespacedRef struct {
8686
// Name is the name of the Konnect Control Plane.
8787
// +required
88+
// +kubebuilder:validation:MinLength=1
8889
Name string `json:"name"`
8990

9091
// TODO: Implement cross namespace references:

api/common/v1alpha1/extensionref_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ type ExtensionRef struct {
2929
// Kind is kind of the extension resource.
3030
//
3131
// +required
32+
// +kubebuilder:validation:MinLength=1
3233
Kind string `json:"kind"`
3334

3435
// NamespacedRef is a reference to the extension resource.

api/gateway-operator/v2beta1/controlplane_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ type ControlPlaneDataPlaneTargetRef struct {
300300
// Ref is the name of the DataPlane to configure.
301301
//
302302
// +required
303+
// +kubebuilder:validation:MinLength=1
303304
Name string `json:"name"`
304305
}
305306

api/gateway-operator/v2beta1/shared_types.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,13 @@ type HorizontalScaling struct {
5555
// alpha feature gate HPAScaleToZero is enabled and at least one Object or External
5656
// metric is configured. Scaling is active as long as at least one metric value is
5757
// available.
58+
//
5859
// +optional
5960
MinReplicas *int32 `json:"minReplicas,omitempty" protobuf:"varint,2,opt,name=minReplicas"`
6061

6162
// maxReplicas is the upper limit for the number of replicas to which the autoscaler can scale up.
6263
// It cannot be less that minReplicas.
64+
//
6365
// +required
6466
MaxReplicas int32 `json:"maxReplicas" protobuf:"varint,3,opt,name=maxReplicas"`
6567

@@ -71,13 +73,15 @@ type HorizontalScaling struct {
7173
// increased, and vice-versa. See the individual metric source types for
7274
// more information about how each type of metric must respond.
7375
// If not set, the default metric will be set to 80% average CPU utilization.
76+
//
7477
// +listType=atomic
7578
// +optional
7679
Metrics []autoscalingv2.MetricSpec `json:"metrics,omitempty" protobuf:"bytes,4,rep,name=metrics"`
7780

7881
// behavior configures the scaling behavior of the target
7982
// in both Up and Down directions (scaleUp and scaleDown fields respectively).
8083
// If not set, the default HPAScalingRules for scale up and scale down are used.
84+
//
8185
// +optional
8286
Behavior *autoscalingv2.HorizontalPodAutoscalerBehavior `json:"behavior,omitempty" protobuf:"bytes,5,opt,name=behavior"`
8387
}
@@ -249,6 +253,7 @@ type NamespacedName struct {
249253
// Name is the name of the resource.
250254
//
251255
// +required
256+
// +kubebuilder:validation:MinLength=1
252257
Name string `json:"name"`
253258

254259
// Namespace is the namespace of the resource.

api/konnect/v1alpha1/konnect_apiauthconfiguration_types.go

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ type KonnectAPIAuthConfigurationSpec struct {
7777
// Please refer to https://docs.konghq.com/konnect/network/ for the list of supported hostnames.
7878
//
7979
// +required
80+
// +kubebuilder:validation:MinLength=1
8081
// +kubebuilder:validation:XValidation:rule="size(self) > 0", message="Server URL is required"
8182
// +kubebuilder:validation:XValidation:rule="self == oldSelf", message="Server URL is immutable"
8283
// +kubebuilder:validation:XValidation:rule="isURL(self) ? url(self).getScheme() == 'https' : true", message="Server URL must use HTTPs if specifying scheme"
@@ -87,6 +88,18 @@ type KonnectAPIAuthConfigurationSpec struct {
8788
// KonnectAPIAuthConfigurationStatus is the status of the KonnectAPIAuthConfiguration resource.
8889
// +apireference:kgo:include
8990
type KonnectAPIAuthConfigurationStatus struct {
91+
// Conditions describe the status of the Konnect configuration.
92+
//
93+
// +optional
94+
// +listType=map
95+
// +listMapKey=type
96+
// +patchStrategy=merge
97+
// +patchMergeKey=type
98+
// +kubebuilder:validation:MinItems=1
99+
// +kubebuilder:validation:MaxItems=8
100+
// +kubebuilder:default={{type: "Valid", status: "Unknown", reason:"Pending", message:"Waiting for controller", lastTransitionTime: "1970-01-01T00:00:00Z"}}
101+
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
102+
90103
// OrganizationID is the unique identifier of the organization in Konnect.
91104
//
92105
// +optional
@@ -96,15 +109,6 @@ type KonnectAPIAuthConfigurationStatus struct {
96109
//
97110
// +optional
98111
ServerURL string `json:"serverURL,omitempty"`
99-
100-
// Conditions describe the status of the Konnect configuration.
101-
// +listType=map
102-
// +listMapKey=type
103-
// +kubebuilder:validation:MinItems=1
104-
// +kubebuilder:validation:MaxItems=8
105-
// +kubebuilder:default={{type: "Valid", status: "Unknown", reason:"Pending", message:"Waiting for controller", lastTransitionTime: "1970-01-01T00:00:00Z"}}
106-
// +optional
107-
Conditions []metav1.Condition `json:"conditions,omitempty"`
108112
}
109113

110114
// KonnectAPIAuthConfigurationList contains a list of KonnectAPIAuthConfiguration resources.

api/konnect/v1alpha1/konnect_cloudgateway_dataplane_configuration_types.go

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ type KonnectCloudGatewayDataPlaneGroupConfigurationSpec struct {
4848
// Version specifies the desired Kong Gateway version.
4949
//
5050
// +required
51+
// +kubebuilder:validation:MinLength=1
5152
Version string `json:"version"`
5253

5354
// DataplaneGroups is a list of desired data-plane groups that describe where
@@ -92,6 +93,7 @@ type KonnectConfigurationDataPlaneGroup struct {
9293
// Region for cloud provider region.
9394
//
9495
// +required
96+
// +kubebuilder:validation:MinLength=1
9597
Region string `json:"region"`
9698

9799
// NetworkRef is the reference to the network that this data-plane group will be deployed on.
@@ -198,37 +200,41 @@ type ConfigurationDataPlaneGroupAutoscaleStatic struct {
198200
// KonnectCloudGatewayDataPlaneGroupConfigurationStatus defines the observed state of KonnectCloudGatewayDataPlaneGroupConfiguration.
199201
// +apireference:kgo:include
200202
type KonnectCloudGatewayDataPlaneGroupConfigurationStatus struct {
201-
konnectv1alpha2.KonnectEntityStatusWithControlPlaneRef `json:",inline"`
202-
203-
// DataPlaneGroups is a list of deployed data-plane groups.
204-
//
205-
// +optional
206-
DataPlaneGroups []KonnectCloudGatewayDataPlaneGroupConfigurationStatusGroup `json:"dataplane_groups,omitempty"`
207-
208203
// Conditions describe the current conditions of the KonnectCloudGatewayDataPlaneGroupConfiguration.
209204
//
210205
// Known condition types are:
211206
//
212207
// * "Programmed"
213208
//
209+
// +optional
214210
// +listType=map
215211
// +listMapKey=type
212+
// +patchStrategy=merge
213+
// +patchMergeKey=type
216214
// +kubebuilder:validation:MaxItems=8
217215
// +kubebuilder:default={{type: "Programmed", status: "Unknown", reason:"Pending", message:"Waiting for controller", lastTransitionTime: "1970-01-01T00:00:00Z"}}
216+
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
217+
218+
// DataPlaneGroups is a list of deployed data-plane groups.
219+
//
218220
// +optional
219-
Conditions []metav1.Condition `json:"conditions,omitempty"`
221+
DataPlaneGroups []KonnectCloudGatewayDataPlaneGroupConfigurationStatusGroup `json:"dataplane_groups,omitempty"`
222+
223+
konnectv1alpha2.KonnectEntityStatusWithControlPlaneRef `json:",inline"`
220224
}
221225

222226
// KonnectCloudGatewayDataPlaneGroupConfigurationStatusGroup defines the observed state of a deployed data-plane group.
223227
type KonnectCloudGatewayDataPlaneGroupConfigurationStatusGroup struct {
224228
// ID is the ID of the deployed data-plane group.
225229
//
226230
// +required
231+
// +kubebuilder:validation:MinLength=1
227232
ID string `json:"id"`
228233

229234
// CloudGatewayNetworkID is the ID of the cloud gateway network.
230235
//
231236
// +required
237+
// +kubebuilder:validation:MinLength=1
232238
CloudGatewayNetworkID string `json:"cloud_gateway_network_id"`
233239

234240
// Name of cloud provider.
@@ -239,6 +245,7 @@ type KonnectCloudGatewayDataPlaneGroupConfigurationStatusGroup struct {
239245
// Region ID for cloud provider region.
240246
//
241247
// +required
248+
// +kubebuilder:validation:MinLength=1
242249
Region string `json:"region"`
243250

244251
// PrivateIPAddresses is a list of private IP addresses of the internal load balancer that proxies traffic to this data-plane group.
@@ -254,6 +261,7 @@ type KonnectCloudGatewayDataPlaneGroupConfigurationStatusGroup struct {
254261
// State is the current state of the data plane group. Can be e.g. initializing, ready, terminating.
255262
//
256263
// +required
264+
// +kubebuilder:validation:MinLength=1
257265
State string `json:"state"`
258266
}
259267

api/konnect/v1alpha1/konnect_cloudgateway_network_types.go

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,19 @@ type KonnectCloudGatewayNetworkSpec struct {
5656
// Specifies the name of the network on Konnect.
5757
//
5858
// +required
59+
// +kubebuilder:validation:MinLength=1
5960
Name string `json:"name"`
6061

6162
// Specifies the provider Account ID.
6263
//
6364
// +required
65+
// +kubebuilder:validation:MinLength=1
6466
CloudGatewayProviderAccountID string `json:"cloud_gateway_provider_account_id"`
6567

6668
// Region ID for cloud provider region.
6769
//
6870
// +required
71+
// +kubebuilder:validation:MinLength=1
6972
Region string `json:"region"`
7073

7174
// List of availability zones that the network is attached to.
@@ -78,6 +81,7 @@ type KonnectCloudGatewayNetworkSpec struct {
7881
// CIDR block configuration for the network.
7982
//
8083
// +required
84+
// +kubebuilder:validation:MinLength=1
8185
CidrBlock string `json:"cidr_block"`
8286

8387
// Initial state for creating a network.
@@ -92,25 +96,27 @@ type KonnectCloudGatewayNetworkSpec struct {
9296
// KonnectCloudGatewayNetworkStatus defines the observed state of KonnectCloudGatewayNetwork.
9397
// +apireference:kgo:include
9498
type KonnectCloudGatewayNetworkStatus struct {
95-
konnectv1alpha2.KonnectEntityStatus `json:",inline"`
96-
97-
// State is the current state of the network. Can be e.g. initializing, ready, terminating.
98-
//
99-
// +optional
100-
State string `json:"state,omitempty"`
101-
10299
// Conditions describe the current conditions of the KonnectCloudGatewayNetwork.
103100
//
104101
// Known condition types are:
105102
//
106103
// * "Programmed"
107104
//
105+
// +optional
108106
// +listType=map
109107
// +listMapKey=type
108+
// +patchStrategy=merge
109+
// +patchMergeKey=type
110110
// +kubebuilder:validation:MaxItems=8
111111
// +kubebuilder:default={{type: "Programmed", status: "Unknown", reason:"Pending", message:"Waiting for controller", lastTransitionTime: "1970-01-01T00:00:00Z"}}
112+
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
113+
114+
// State is the current state of the network. Can be e.g. initializing, ready, terminating.
115+
//
112116
// +optional
113-
Conditions []metav1.Condition `json:"conditions,omitempty"`
117+
State string `json:"state,omitempty"`
118+
119+
konnectv1alpha2.KonnectEntityStatus `json:",inline"`
114120
}
115121

116122
// GetKonnectAPIAuthConfigurationRef returns the Konnect API Auth Configuration Ref.

api/konnect/v1alpha1/konnect_cloudgateway_transitgateway_types.go

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,12 @@ type AwsTransitGatewayAttachmentConfig struct {
154154
// TransitGatewayID is the AWS transit gateway ID to create attachment to.
155155
//
156156
// +required
157+
// +kubebuilder:validation:MinLength=1
157158
TransitGatewayID string `json:"transit_gateway_id"`
158159
// RAMShareArn is the resource share ARN to verify request to create transit gateway attachment.
159160
//
160161
// +required
162+
// +kubebuilder:validation:MinLength=1
161163
RAMShareArn string `json:"ram_share_arn"`
162164
}
163165

@@ -166,42 +168,48 @@ type AzureVNETPeeringAttachmentConfig struct {
166168
// TenantID is the tenant ID for the Azure VNET Peering attachment.
167169
//
168170
// +required
171+
// +kubebuilder:validation:MinLength=1
169172
TenantID string `json:"tenant_id"`
170173
// SubscriptionID is the subscription ID for the Azure VNET Peering attachment.
171174
//
172175
// +required
176+
// +kubebuilder:validation:MinLength=1
173177
SubscriptionID string `json:"subscription_id"`
174178
// ResourceGroupName is the resource group name for the Azure VNET Peering attachment.
175179
//
176180
// +required
181+
// +kubebuilder:validation:MinLength=1
177182
ResourceGroupName string `json:"resource_group_name"`
178183
// VnetName is the VNET Name for the Azure VNET Peering attachment.
179184
//
180185
// +required
186+
// +kubebuilder:validation:MinLength=1
181187
VnetName string `json:"vnet_name"`
182188
}
183189

184190
// KonnectCloudGatewayTransitGatewayStatus defines the current state of KonnectCloudGatewayTransitGateway.
185191
type KonnectCloudGatewayTransitGatewayStatus struct {
186-
konnectv1alpha2.KonnectEntityStatusWithNetworkRef `json:",inline"`
187-
188-
// State is the state of the transit gateway on Konnect side.
189-
//
190-
// +optional
191-
State sdkkonnectcomp.TransitGatewayState `json:"state,omitempty"`
192-
193192
// Conditions describe the current conditions of the KonnectCloudGatewayDataPlaneGroupConfiguration.
194193
//
195194
// Known condition types are:
196195
//
197196
// * "Programmed"
198197
//
198+
// +optional
199199
// +listType=map
200200
// +listMapKey=type
201+
// +patchStrategy=merge
202+
// +patchMergeKey=type
201203
// +kubebuilder:validation:MaxItems=8
202204
// +kubebuilder:default={{type: "Programmed", status: "Unknown", reason:"Pending", message:"Waiting for controller", lastTransitionTime: "1970-01-01T00:00:00Z"}}
205+
Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"`
206+
207+
konnectv1alpha2.KonnectEntityStatusWithNetworkRef `json:",inline"`
208+
209+
// State is the state of the transit gateway on Konnect side.
210+
//
203211
// +optional
204-
Conditions []metav1.Condition `json:"conditions,omitempty"`
212+
State sdkkonnectcomp.TransitGatewayState `json:"state,omitempty"`
205213
}
206214

207215
// KonnectCloudGatewayTransitGatewayList contains a list of KonnectCloudGatewayTransitGateway.

0 commit comments

Comments
 (0)