|
18 | 18 | - [StatusOptional](#statusoptional) - Ensures status fields are marked as optional |
19 | 19 | - [StatusSubresource](#statussubresource) - Validates status subresource configuration |
20 | 20 | - [UniqueMarkers](#uniquemarkers) - Ensures unique marker definitions |
21 | | -- [ConflictingMarkers](#conflictingmarkers) - Detects and reports when mutually exclusive markers are used on the same field |
22 | 21 |
|
23 | 22 | ## Conditions |
24 | 23 |
|
@@ -390,57 +389,3 @@ Taking the example configuration from above: |
390 | 389 | - Marker definitions of `custom:SomeCustomMarker:fruit=apple,color=red` and `custom:SomeCustomMarker:fruit=orange,color=red` would _not_ violate the uniqueness requirement. |
391 | 390 |
|
392 | 391 | Each entry in `customMarkers` must have a unique `identifier`. |
393 | | - |
394 | | -## ConflictingMarkers |
395 | | - |
396 | | -The `conflictingmarkers` linter detects and reports when mutually exclusive markers are used on the same field. |
397 | | -This prevents common configuration errors and unexpected behavior in Kubernetes API types. |
398 | | - |
399 | | -The linter reports issues when markers from two or more sets of a conflict definition are present on the same field. |
400 | | -It does NOT report issues when multiple markers from the same set are present - only when markers from |
401 | | -different sets within the same conflict definition are found together. |
402 | | - |
403 | | -The linter is configurable and allows users to define sets of conflicting markers. |
404 | | -Each conflict set must specify: |
405 | | -- A unique name for the conflict |
406 | | -- Multiple sets of markers that are mutually exclusive with each other (at least 2 sets) |
407 | | -- A description explaining why the markers conflict |
408 | | - |
409 | | -### Configuration |
410 | | - |
411 | | -```yaml |
412 | | -lintersConfig: |
413 | | - conflictingmarkers: |
414 | | - conflicts: |
415 | | - - name: "optional_vs_required" |
416 | | - sets: |
417 | | - - ["optional", "+kubebuilder:validation:Optional", "+k8s:validation:optional"] |
418 | | - - ["required", "+kubebuilder:validation:Required", "+k8s:validation:required"] |
419 | | - description: "A field cannot be both optional and required" |
420 | | - - name: "default_vs_required" |
421 | | - sets: |
422 | | - - ["default", "+kubebuilder:default"] |
423 | | - - ["required", "+kubebuilder:validation:Required", "+k8s:validation:required"] |
424 | | - description: "A field with a default value cannot be required" |
425 | | - - name: "three_way_conflict" |
426 | | - sets: |
427 | | - - ["marker5", "marker6"] |
428 | | - - ["marker7", "marker8"] |
429 | | - - ["marker9", "marker10"] |
430 | | - description: "Three-way conflict between marker sets" |
431 | | - - name: "mutually_exclusive_validation" |
432 | | - sets: |
433 | | - - ["optional", "+kubebuilder:validation:Optional"] |
434 | | - - ["required", "+kubebuilder:validation:Required"] |
435 | | - - ["default", "+kubebuilder:default"] |
436 | | - description: "A field cannot be optional, required, and have a default value" |
437 | | - - name: "my_custom_conflict" |
438 | | - sets: |
439 | | - - ["custom:marker1", "custom:marker2"] |
440 | | - - ["custom:marker3", "custom:marker4"] |
441 | | - description: "These markers conflict because..." |
442 | | -``` |
443 | | - |
444 | | -**Note**: This linter is not enabled by default and must be explicitly enabled in the configuration. |
445 | | - |
446 | | -The linter does not provide automatic fixes as it cannot determine which conflicting marker should be removed. |
0 commit comments