Skip to content

Commit 962fe20

Browse files
committed
address-feedback: doc clarifications
1 parent bf0efac commit 962fe20

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

contributors/devel/sig-architecture/api_changes.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -716,7 +716,12 @@ This section covers one specific user journey:
716716
* make DV authoritative for that field
717717

718718
For a new field, use either declarative validation or handwritten validation
719-
for that field's checks, but not both.
719+
for that field's validation logic, but not both (do not mix for a single field).
720+
721+
This guidance assumes the API type is plumbed for declarative
722+
validation. If the type already has existing DV migrated/shadowed fields (`+k8s:alpha`/`+k8s:beta`) and still relies on fields w/ handwritten validation and/or shadowed DV, those older fields can continue to
723+
exist as-is, but do not introduce that split for the new field covered by this
724+
section.
720725

721726
Note: for this new-field DV-native flow, use direct tags with no prefix. Do
722727
not use `+k8s:alpha(...)` or `+k8s:beta(...)` here. Those tags are for
@@ -1048,6 +1053,9 @@ For a new feature-gated spec field, cover at least:
10481053
* gate off, field omitted
10491054
* gate off, old value unchanged on update
10501055
* gate off, old value changed on update
1056+
Expect this to be rejected. With the standard
1057+
`ifDisabled(...)=+k8s:forbidden` pattern, the update should return a
1058+
forbidden error because it is attempting to write a disabled field value.
10511059

10521060
These cases mattered in practice and line up with review feedback on earlier
10531061
PRs:
@@ -1353,9 +1361,9 @@ After code generation, run the unit tests for the resource you changed.
13531361
If declarative validation covers the new field correctly, do not also add new
13541362
checks for that field in `pkg/apis/<group>/validation/validation.go`.
13551363

1356-
If the field needs handwritten validation because DV cannot yet express the
1357-
rule, prefer handwritten validation for that field rather than mixing DV and
1358-
handwritten validation for the same field.
1364+
If DV can cover some of the new field's checks but cannot cover all of them,
1365+
prefer handwritten validation for that field rather than splitting one field's
1366+
checks between DV and handwritten validation.
13591367

13601368
## Edit version conversions
13611369

0 commit comments

Comments
 (0)