Skip to content

Commit 69b4e2c

Browse files
committed
Update KAL to enable new required fields policy
1 parent 356d265 commit 69b4e2c

File tree

13 files changed

+641
-321
lines changed

13 files changed

+641
-321
lines changed

.golangci.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,20 @@ linters:
2929
# Discoverability is for configuration APIs, generally singletons.
3030
# Refer to the API conventions for when to use discoverability (not our default stance).
3131
policy: Ignore
32+
requiredFields:
33+
pointers:
34+
# This will force pointers when the field is required, but only when the zero
35+
# value is a valid user choice, and has a semantic difference to being omitted (e.g. replicas allows 0).
36+
policy: SuggestFix
37+
omitempty:
38+
# This will force omitempty on required fields.
39+
# We do this so that the behaviour of not setting a value for the field is the same between
40+
# both structured and unstructured clients.
41+
policy: SuggestFix
42+
omitzero:
43+
# This will force omitzero on required struct fields.
44+
# This means they can be omitted correctly and prevents the need for pointers to structs.
45+
policy: SuggestFix
3246
uniqueMarkers:
3347
customMarkers:
3448
- identifier: "openshift:validation:FeatureGateAwareEnum"

tools/go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ require (
3030
k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff
3131
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397
3232
sigs.k8s.io/controller-tools v0.15.0
33-
sigs.k8s.io/kube-api-linter v0.0.0-20250729132427-47bfeef6cd38
33+
sigs.k8s.io/kube-api-linter v0.0.0-20250808120943-48643eb2563d
3434
sigs.k8s.io/yaml v1.4.0
3535
)
3636

tools/go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -994,6 +994,8 @@ sigs.k8s.io/kube-api-linter v0.0.0-20250723124831-1b29e82a0f55 h1:kD9x5uu1/A7wvh
994994
sigs.k8s.io/kube-api-linter v0.0.0-20250723124831-1b29e82a0f55/go.mod h1:Jxl3NU9lRf9WJ8dgwgF4U6tLF229jR/KEvtxSwRAKnE=
995995
sigs.k8s.io/kube-api-linter v0.0.0-20250729132427-47bfeef6cd38 h1:5WuFSvNbquqwM82aBQ36AfsFGsf2Jc0OJM4SCC2rw4w=
996996
sigs.k8s.io/kube-api-linter v0.0.0-20250729132427-47bfeef6cd38/go.mod h1:Jxl3NU9lRf9WJ8dgwgF4U6tLF229jR/KEvtxSwRAKnE=
997+
sigs.k8s.io/kube-api-linter v0.0.0-20250808120943-48643eb2563d h1:BcgCRoMLmIxRTLokQ1K1LAle+21fKPqgA6OvzN04xEg=
998+
sigs.k8s.io/kube-api-linter v0.0.0-20250808120943-48643eb2563d/go.mod h1:Jxl3NU9lRf9WJ8dgwgF4U6tLF229jR/KEvtxSwRAKnE=
997999
sigs.k8s.io/randfill v0.0.0-20250304075658-069ef1bbf016/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY=
9981000
sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU=
9991001
sigs.k8s.io/randfill v1.0.0/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY=

tools/vendor/modules.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2378,7 +2378,7 @@ sigs.k8s.io/controller-tools/pkg/webhook
23782378
## explicit; go 1.21
23792379
sigs.k8s.io/json
23802380
sigs.k8s.io/json/internal/golang/encoding/json
2381-
# sigs.k8s.io/kube-api-linter v0.0.0-20250729132427-47bfeef6cd38
2381+
# sigs.k8s.io/kube-api-linter v0.0.0-20250808120943-48643eb2563d
23822382
## explicit; go 1.24.0
23832383
sigs.k8s.io/kube-api-linter/pkg/analysis/commentstart
23842384
sigs.k8s.io/kube-api-linter/pkg/analysis/conditions
@@ -2406,6 +2406,7 @@ sigs.k8s.io/kube-api-linter/pkg/analysis/statusoptional
24062406
sigs.k8s.io/kube-api-linter/pkg/analysis/statussubresource
24072407
sigs.k8s.io/kube-api-linter/pkg/analysis/uniquemarkers
24082408
sigs.k8s.io/kube-api-linter/pkg/analysis/utils
2409+
sigs.k8s.io/kube-api-linter/pkg/analysis/utils/serialization
24092410
sigs.k8s.io/kube-api-linter/pkg/config
24102411
sigs.k8s.io/kube-api-linter/pkg/markers
24112412
sigs.k8s.io/kube-api-linter/pkg/plugin

tools/vendor/sigs.k8s.io/kube-api-linter/pkg/analysis/conflictingmarkers/doc.go

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

tools/vendor/sigs.k8s.io/kube-api-linter/pkg/analysis/optionalfields/analyzer.go

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

0 commit comments

Comments
 (0)