feat: Add exceptions for conflicting markers in kube-api-linter

This commit is contained in:
yongruilin
2025-10-22 18:01:22 +00:00
parent 12b5106809
commit 7d1500bb1e
3 changed files with 39 additions and 0 deletions

View File

@@ -143,6 +143,19 @@ linters:
path: "staging/src/k8s.io/api/resource/"
- text: "Conditions field in AllocatedDeviceStatus has incorrect tags, should be: `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,5,rep,name=conditions\"`"
path: "staging/src/k8s.io/api/resource/"
# Pre-existing issues from the conflictmarkers linter
# The Error field in some older API types is marked as both optional and required.
# This is incorrect, but cannot be changed without breaking changes.
- text: "field PortStatus.Error has conflicting markers: optional_vs_required: {\\[optional\\], \\[kubebuilder:validation:Required\\]}. fields cannot be both optional and required"
path: "staging/src/k8s.io/api/core/v1/types.go"
- text: "field IngressPortStatus.Error has conflicting markers: optional_vs_required: {\\[optional\\], \\[kubebuilder:validation:Required\\]}. fields cannot be both optional and required"
path: "staging/src/k8s.io/api/extensions/v1beta1/types.go"
- text: "field IngressPortStatus.Error has conflicting markers: optional_vs_required: {\\[optional\\], \\[kubebuilder:validation:Required\\]}. fields cannot be both optional and required"
path: "staging/src/k8s.io/api/networking/v1/types.go"
- text: "field IngressPortStatus.Error has conflicting markers: optional_vs_required: {\\[optional\\], \\[kubebuilder:validation:Required\\]}. fields cannot be both optional and required"
path: "staging/src/k8s.io/api/networking/v1beta1/types.go"
default: standard
enable: # please keep this alphabetized

View File

@@ -159,6 +159,19 @@ linters:
path: "staging/src/k8s.io/api/resource/"
- text: "Conditions field in AllocatedDeviceStatus has incorrect tags, should be: `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,5,rep,name=conditions\"`"
path: "staging/src/k8s.io/api/resource/"
# Pre-existing issues from the conflictmarkers linter
# The Error field in some older API types is marked as both optional and required.
# This is incorrect, but cannot be changed without breaking changes.
- text: "field PortStatus.Error has conflicting markers: optional_vs_required: {\\[optional\\], \\[kubebuilder:validation:Required\\]}. fields cannot be both optional and required"
path: "staging/src/k8s.io/api/core/v1/types.go"
- text: "field IngressPortStatus.Error has conflicting markers: optional_vs_required: {\\[optional\\], \\[kubebuilder:validation:Required\\]}. fields cannot be both optional and required"
path: "staging/src/k8s.io/api/extensions/v1beta1/types.go"
- text: "field IngressPortStatus.Error has conflicting markers: optional_vs_required: {\\[optional\\], \\[kubebuilder:validation:Required\\]}. fields cannot be both optional and required"
path: "staging/src/k8s.io/api/networking/v1/types.go"
- text: "field IngressPortStatus.Error has conflicting markers: optional_vs_required: {\\[optional\\], \\[kubebuilder:validation:Required\\]}. fields cannot be both optional and required"
path: "staging/src/k8s.io/api/networking/v1beta1/types.go"
default: none
enable: # please keep this alphabetized

View File

@@ -19,3 +19,16 @@
path: "staging/src/k8s.io/api/resource/"
- text: "Conditions field in AllocatedDeviceStatus has incorrect tags, should be: `json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,5,rep,name=conditions\"`"
path: "staging/src/k8s.io/api/resource/"
# Pre-existing issues from the conflictmarkers linter
# The Error field in some older API types is marked as both optional and required.
# This is incorrect, but cannot be changed without breaking changes.
- text: "field PortStatus.Error has conflicting markers: optional_vs_required: {\\[optional\\], \\[kubebuilder:validation:Required\\]}. fields cannot be both optional and required"
path: "staging/src/k8s.io/api/core/v1/types.go"
- text: "field IngressPortStatus.Error has conflicting markers: optional_vs_required: {\\[optional\\], \\[kubebuilder:validation:Required\\]}. fields cannot be both optional and required"
path: "staging/src/k8s.io/api/extensions/v1beta1/types.go"
- text: "field IngressPortStatus.Error has conflicting markers: optional_vs_required: {\\[optional\\], \\[kubebuilder:validation:Required\\]}. fields cannot be both optional and required"
path: "staging/src/k8s.io/api/networking/v1/types.go"
- text: "field IngressPortStatus.Error has conflicting markers: optional_vs_required: {\\[optional\\], \\[kubebuilder:validation:Required\\]}. fields cannot be both optional and required"
path: "staging/src/k8s.io/api/networking/v1beta1/types.go"