Skip to content

Commit 43a07db

Browse files
committed
Updated kube-api-linter version to the latest. After update relax conditions checks in .golangci-kal.yml (comment out conditions config). The older version was not picking them.
1 parent 44bbc87 commit 43a07db

18 files changed

+97
-45
lines changed

.golangci-kal.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ linters:
3232
disable:
3333
- "*" # We will manually enable new linters after understanding the impact. Disable all by default.
3434
lintersConfig:
35-
conditions:
36-
isFirstField: Warn # Require conditions to be the first field in the status struct.
37-
usePatchStrategy: Forbid # Conditions should not use the patch strategy on CRDs.
38-
useProtobuf: Forbid # We don't use protobuf, so protobuf tags are not required.
35+
# conditions:
36+
# isFirstField: Warn # Require conditions to be the first field in the status struct.
37+
# usePatchStrategy: Forbid # Conditions should not use the patch strategy on CRDs.
38+
# useProtobuf: Forbid # We don't use protobuf, so protobuf tags are not required.
3939
# jsonTags:
4040
# jsonTagRegex: "^[a-z][a-z0-9]*(?:[A-Z][a-z0-9]*)*$" # The default regex is appropriate for our use case.
4141
# optionalOrRequired:

api/v1beta1/awsmachine_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ type AWSMachineSpec struct {
7777
// InstanceType is the type of instance to create. Example: m4.xlarge
7878
// +kubebuilder:validation:Required
7979
// +kubebuilder:validation:MinLength:=2
80-
InstanceType string `json:"instanceType"`
80+
InstanceType string `json:"instanceType,omitempty"`
8181

8282
// AdditionalTags is an optional set of tags to add to an instance, in addition to the ones added by default by the
8383
// AWS provider. If both the AWSCluster and the AWSMachine specify the same tag name with different values, the

api/v1beta2/awsmachine_types.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ type AWSMachineSpec struct {
114114
// InstanceType is the type of instance to create. Example: m4.xlarge
115115
// +kubebuilder:validation:Required
116116
// +kubebuilder:validation:MinLength:=2
117-
InstanceType string `json:"instanceType"`
117+
InstanceType string `json:"instanceType,omitempty"`
118118

119119
// AdditionalTags is an optional set of tags to add to an instance, in addition to the ones added by default by the
120120
// AWS provider. If both the AWSCluster and the AWSMachine specify the same tag name with different values, the

config/crd/bases/controlplane.cluster.x-k8s.io_awsmanagedcontrolplanes.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,7 @@ spec:
878878
description: |-
879879
This is also known as audience. The ID for the client application that makes
880880
authentication requests to the OpenID identity provider.
881+
minLength: 1
881882
type: string
882883
groupsClaim:
883884
description: The JWT claim that the provider uses to return your
@@ -894,6 +895,7 @@ spec:
894895
The name of the OIDC provider configuration.
895896
896897
IdentityProviderConfigName is a required field
898+
minLength: 1
897899
type: string
898900
issuerUrl:
899901
description: |-
@@ -904,6 +906,8 @@ spec:
904906
not. Typically the URL consists of only a hostname, like https://server.example.org
905907
or https://example.com. This URL should point to the level below .well-known/openid-configuration
906908
and must be publicly accessible over the internet.
909+
minLength: 1
910+
pattern: ^https://.+
907911
type: string
908912
requiredClaims:
909913
additionalProperties:
@@ -3050,6 +3054,7 @@ spec:
30503054
description: |-
30513055
This is also known as audience. The ID for the client application that makes
30523056
authentication requests to the OpenID identity provider.
3057+
minLength: 1
30533058
type: string
30543059
groupsClaim:
30553060
description: The JWT claim that the provider uses to return your
@@ -3066,6 +3071,7 @@ spec:
30663071
The name of the OIDC provider configuration.
30673072
30683073
IdentityProviderConfigName is a required field
3074+
minLength: 1
30693075
type: string
30703076
issuerUrl:
30713077
description: |-
@@ -3076,6 +3082,8 @@ spec:
30763082
not. Typically the URL consists of only a hostname, like https://server.example.org
30773083
or https://example.com. This URL should point to the level below .well-known/openid-configuration
30783084
and must be publicly accessible over the internet.
3085+
minLength: 1
3086+
pattern: ^https://.+
30793087
type: string
30803088
requiredClaims:
30813089
additionalProperties:

config/crd/bases/controlplane.cluster.x-k8s.io_awsmanagedcontrolplanetemplates.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -880,6 +880,7 @@ spec:
880880
description: |-
881881
This is also known as audience. The ID for the client application that makes
882882
authentication requests to the OpenID identity provider.
883+
minLength: 1
883884
type: string
884885
groupsClaim:
885886
description: The JWT claim that the provider uses to return
@@ -896,6 +897,7 @@ spec:
896897
The name of the OIDC provider configuration.
897898
898899
IdentityProviderConfigName is a required field
900+
minLength: 1
899901
type: string
900902
issuerUrl:
901903
description: |-
@@ -906,6 +908,8 @@ spec:
906908
not. Typically the URL consists of only a hostname, like https://server.example.org
907909
or https://example.com. This URL should point to the level below .well-known/openid-configuration
908910
and must be publicly accessible over the internet.
911+
minLength: 1
912+
pattern: ^https://.+
909913
type: string
910914
requiredClaims:
911915
additionalProperties:

config/crd/bases/controlplane.cluster.x-k8s.io_rosacontrolplanes.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,7 @@ spec:
285285
claim:
286286
description: Claim is a JWT token claim to be used in
287287
the mapping
288+
minLength: 1
288289
type: string
289290
prefix:
290291
description: |-
@@ -310,6 +311,7 @@ spec:
310311
claim:
311312
description: Claim is a JWT token claim to be used in
312313
the mapping
314+
minLength: 1
313315
type: string
314316
prefix:
315317
description: Prefix is prepended to claim to prevent
@@ -417,6 +419,7 @@ spec:
417419
name:
418420
description: Name is the metadata.name of the referenced
419421
object.
422+
minLength: 1
420423
type: string
421424
required:
422425
- name
@@ -425,6 +428,7 @@ spec:
425428
description: |-
426429
URL is the serving URL of the token issuer.
427430
Must use the https:// scheme.
431+
minLength: 1
428432
pattern: ^https:\/\/[^\s]
429433
type: string
430434
required:
@@ -457,6 +461,7 @@ spec:
457461
name:
458462
description: Name is the metadata.name of the referenced
459463
object.
464+
minLength: 1
460465
type: string
461466
required:
462467
- name
@@ -474,6 +479,7 @@ spec:
474479
client configuration
475480
maxLength: 63
476481
minLength: 1
482+
pattern: ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$
477483
type: string
478484
extraScopes:
479485
description: ExtraScopes is an optional set of scopes

config/crd/bases/infrastructure.cluster.x-k8s.io_awsmachinepools.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ spec:
8080
awsLaunchTemplate:
8181
description: AWSLaunchTemplate specifies the launch template and version
8282
to use when an instance is launched.
83+
minProperties: 1
8384
properties:
8485
additionalSecurityGroups:
8586
description: |-
@@ -582,6 +583,7 @@ spec:
582583
awsLaunchTemplate:
583584
description: AWSLaunchTemplate specifies the launch template and version
584585
to use when an instance is launched.
586+
minProperties: 1
585587
properties:
586588
additionalSecurityGroups:
587589
description: |-

config/crd/bases/infrastructure.cluster.x-k8s.io_awsmanagedmachinepools.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ spec:
8989
AWSLaunchTemplate specifies the launch template to use to create the managed node group.
9090
If AWSLaunchTemplate is specified, certain node group configuraions outside of launch template
9191
are prohibited (https://docs.aws.amazon.com/eks/latest/userguide/launch-templates.html).
92+
minProperties: 1
9293
properties:
9394
additionalSecurityGroups:
9495
description: |-
@@ -349,9 +350,11 @@ spec:
349350
type: string
350351
key:
351352
description: Key is the key of the taint
353+
minLength: 1
352354
type: string
353355
value:
354356
description: Value is the value of the taint
357+
minLength: 1
355358
type: string
356359
required:
357360
- effect
@@ -591,6 +594,7 @@ spec:
591594
AWSLaunchTemplate specifies the launch template to use to create the managed node group.
592595
If AWSLaunchTemplate is specified, certain node group configuraions outside of launch template
593596
are prohibited (https://docs.aws.amazon.com/eks/latest/userguide/launch-templates.html).
597+
minProperties: 1
594598
properties:
595599
additionalSecurityGroups:
596600
description: |-
@@ -1085,9 +1089,11 @@ spec:
10851089
type: string
10861090
key:
10871091
description: Key is the key of the taint
1092+
minLength: 1
10881093
type: string
10891094
value:
10901095
description: Value is the value of the taint
1096+
minLength: 1
10911097
type: string
10921098
required:
10931099
- effect

config/crd/bases/infrastructure.cluster.x-k8s.io_rosamachinepools.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ spec:
9090
type: string
9191
instanceType:
9292
description: InstanceType specifies the AWS instance type
93+
minLength: 1
9394
type: string
9495
labels:
9596
additionalProperties:
@@ -143,6 +144,7 @@ spec:
143144
type: string
144145
key:
145146
description: The taint key to be applied to a node.
147+
minLength: 1
146148
type: string
147149
value:
148150
description: The taint value corresponding to the taint key.

controlplane/eks/api/v1beta1/types.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ type Addon struct {
127127
// Name is the name of the addon
128128
// +kubebuilder:validation:MinLength:=2
129129
// +kubebuilder:validation:Required
130-
Name string `json:"name"`
130+
Name string `json:"name,omitempty"`
131131
// Version is the version of the addon to use
132132
Version string `json:"version"`
133133
// Configuration of the EKS addon
@@ -223,7 +223,8 @@ type OIDCIdentityProviderConfig struct {
223223
// This is also known as audience. The ID for the client application that makes
224224
// authentication requests to the OpenID identity provider.
225225
// +kubebuilder:validation:Required
226-
ClientID string `json:"clientId"`
226+
// +kubebuilder:validation:MinLength=1
227+
ClientID string `json:"clientId,omitempty"`
227228

228229
// The JWT claim that the provider uses to return your groups.
229230
// +optional
@@ -239,7 +240,8 @@ type OIDCIdentityProviderConfig struct {
239240
//
240241
// IdentityProviderConfigName is a required field
241242
// +kubebuilder:validation:Required
242-
IdentityProviderConfigName string `json:"identityProviderConfigName"`
243+
// +kubebuilder:validation:MinLength=1
244+
IdentityProviderConfigName string `json:"identityProviderConfigName,omitempty"`
243245

244246
// The URL of the OpenID identity provider that allows the API server to discover
245247
// public signing keys for verifying tokens. The URL must begin with https://
@@ -250,7 +252,9 @@ type OIDCIdentityProviderConfig struct {
250252
// and must be publicly accessible over the internet.
251253
//
252254
// +kubebuilder:validation:Required
253-
IssuerURL string `json:"issuerUrl"`
255+
// +kubebuilder:validation:MinLength=1
256+
// +kubebuilder:validation:Pattern=`^https://.+`
257+
IssuerURL string `json:"issuerUrl,omitempty"`
254258

255259
// The key value pairs that describe required claims in the identity token.
256260
// If set, each claim is verified to be present in the token with a matching

0 commit comments

Comments
 (0)