Add exception for union type in scheduling API

We need to add a marker to allow podgroup to be marked up correctly as a union type, and then teach the nonpointerstructs linter how to understand this
This commit is contained in:
Joel Speed
2026-01-22 11:13:50 +00:00
parent 0ebf47cb08
commit 0b10375aec
3 changed files with 21 additions and 0 deletions

View File

@@ -224,6 +224,13 @@ linters:
# jsontags: 'Port' must be capitalized for backward compatibility
- text: 'jsontags: field DaemonEndpoint.Port json tag does not match'
path: "staging/src/k8s.io/api/core/v1/types.go"
# NonPointerStructs - Existing fields that are non-pointer structs but where the current rules are incorrect.
# The PodGroup.Policy field is a union type, but is not marked up as a union, nor does nonpointerstructs understand unions today.
# Validation makes this require at least one of the fields within to be set.
- text: "nonpointerstructs: field PodGroup.Policy is a non-pointer struct with no required fields. It must be marked as optional."
path: "staging/src/k8s.io/api/scheduling/v1alpha1/types.go"
- linters:
- forbidigo

View File

@@ -235,6 +235,13 @@ linters:
# jsontags: 'Port' must be capitalized for backward compatibility
- text: 'jsontags: field DaemonEndpoint.Port json tag does not match'
path: "staging/src/k8s.io/api/core/v1/types.go"
# NonPointerStructs - Existing fields that are non-pointer structs but where the current rules are incorrect.
# The PodGroup.Policy field is a union type, but is not marked up as a union, nor does nonpointerstructs understand unions today.
# Validation makes this require at least one of the fields within to be set.
- text: "nonpointerstructs: field PodGroup.Policy is a non-pointer struct with no required fields. It must be marked as optional."
path: "staging/src/k8s.io/api/scheduling/v1alpha1/types.go"
- linters:
- forbidigo

View File

@@ -100,3 +100,10 @@
# jsontags: 'Port' must be capitalized for backward compatibility
- text: 'jsontags: field DaemonEndpoint.Port json tag does not match'
path: "staging/src/k8s.io/api/core/v1/types.go"
# NonPointerStructs - Existing fields that are non-pointer structs but where the current rules are incorrect.
# The PodGroup.Policy field is a union type, but is not marked up as a union, nor does nonpointerstructs understand unions today.
# Validation makes this require at least one of the fields within to be set.
- text: "nonpointerstructs: field PodGroup.Policy is a non-pointer struct with no required fields. It must be marked as optional."
path: "staging/src/k8s.io/api/scheduling/v1alpha1/types.go"