You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: contributors/devel/sig-architecture/api_changes.md
+12-4Lines changed: 12 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -716,7 +716,12 @@ This section covers one specific user journey:
716
716
* make DV authoritative for that field
717
717
718
718
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.
720
725
721
726
Note: for this new-field DV-native flow, use direct tags with no prefix. Do
722
727
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:
1048
1053
* gate off, field omitted
1049
1054
* gate off, old value unchanged on update
1050
1055
* 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.
1051
1059
1052
1060
These cases mattered in practice and line up with review feedback on earlier
1053
1061
PRs:
@@ -1353,9 +1361,9 @@ After code generation, run the unit tests for the resource you changed.
1353
1361
If declarative validation covers the new field correctly, do not also add new
1354
1362
checks for that field in `pkg/apis/<group>/validation/validation.go`.
1355
1363
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
0 commit comments