Skip to content

Commit 47fb1b5

Browse files
authored
Merge pull request #8702 from vpnachev/fix-typos/api_changes
Fix two typos and trim trailing whitespaces in api_changes.md
2 parents 7ec6475 + 6565153 commit 47fb1b5

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

contributors/devel/sig-architecture/api_changes.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -647,15 +647,15 @@ Of course, code needs tests - `pkg/apis/<group>/validation/validation_test.go`.
647647

648648
### Declarative Validation
649649

650-
For new APIs, developers should use declarative validation for all validation rules that declarative validation supports.
651-
See the [declarative validation tag catalog](https://kubernetes.io/docs/reference/using-api/declarative-validation/) for the list of supported validation rules.
652-
This allows you to define validation rules directly on the API types using special Go comment tags.
650+
For new APIs, developers should use declarative validation for all validation rules that declarative validation supports.
651+
See the [declarative validation tag catalog](https://kubernetes.io/docs/reference/using-api/declarative-validation/) for the list of supported validation rules.
652+
This allows you to define validation rules directly on the API types using special Go comment tags.
653653
These validation rules are easier to write, review, and maintain as they live alongside the type and field definitions.
654654

655655
A new code generator, `validation-gen`, processes these tags to produce the validation logic automatically, reducing the need to write manual validation code in `validation.go`.
656656

657657

658-
Setting up validation code generation involves the following steps.
658+
Setting up validation code generation involves the following steps.
659659
For APIs already using declarative validation, the first 2 plumbing steps can be skipped:
660660
- Register the desired API group with validation-gen, similar to other code generators([Example PR doc.go change](https://github.com/kubernetes/kubernetes/pull/130724))
661661
- Wire up the `strategy.go` for the desired API group to use declarative validation ([Example PR strategy.go change](https://github.com/kubernetes/kubernetes/pull/130724))
@@ -695,16 +695,16 @@ type ReplicationControllerSpec struct {
695695

696696
In this example, the `+k8s:optional` and `+k8s:minimum=0` tags specify that the `Replicas` and `MinReadySeconds` fields are optional and must have a value of at least 0 if present.
697697

698-
After adding these tags to your types, you will need to run the code generator to create or update the validation functions.
699-
This is typically done by running `make update` or `hack/update-codegen.sh`.
700-
To only run the declarative validation code generator, use `hack/update-codegen.sh validation`.
701-
Running the validation-gen code generator will create a `zz_generated.validations.go` file for the declarative validations of the associated tagged API types and fields.
698+
After adding these tags to your types, you will need to run the code generator to create or update the validation functions.
699+
This is typically done by running `make update` or `hack/update-codegen.sh`.
700+
To only run the declarative validation code generator, use `hack/update-codegen.sh validation`.
701+
Running the validation-gen code generator will create a `zz_generated.validations.go` file for the declarative validations of the associated tagged API types and fields.
702702
The generated validation methods in this file are then called via the modified `strategy.go` file in the above steps.
703703

704-
Testing the validation logic for the behaviour of a type is identical to the testing that would be done for hand-written validation code.
704+
Testing the validation logic for the behaviour of a type is identical to the testing that would be done for hand-written validation code.
705705
Users will need to write go unit tests similar to what is done for hand-written validation logic that verify specific cases are allowed, disallowed, etc and the validation behaviour is as expected.
706706

707-
While the goal is to express as much validation declaratively as possible, some complex or validation rules might still require manual implementation in `validation.go`.
707+
While the goal is to express as much validation declaratively as possible, some complex or validation rules might still require manual implementation in `validation.go`.
708708

709709
## Edit version conversions
710710

@@ -775,7 +775,7 @@ The generators that create go code have a `--go-header-file` flag
775775
which should be a file that contains the header that should be
776776
included. This header is the copyright that should be present at the
777777
top of the generated file and should be checked with the
778-
[`repo-infra/verify/verify-boilerplane.sh`](https://git.k8s.io/repo-infra/verify/verify-boilerplate.sh)
778+
[`repo-infra/verify/verify-boilerplate.sh`](https://git.k8s.io/repo-infra/verify/verify-boilerplate.sh)
779779
script at a later stage of the build.
780780

781781
To invoke these generators, you can run `make update`, which runs a bunch of
@@ -1310,7 +1310,7 @@ best illustrates these cases:
13101310

13111311
A good example of ratcheting validation was introduced in [this pull request](https://github.com/kubernetes/kubernetes/pull/130233).
13121312
It introduced validation for the optional `.spec.serviceName` field for StatefulSet,
1313-
such that old resources (nregarldess of whether they are valid or not) will succeed
1313+
such that old resources (regardless of whether they are valid or not) will succeed
13141314
the validation check, but new resources must adhere to stricter validation rules
13151315
for that field. The relevant changes include:
13161316
- A struct with options passed to validation methods (here it's the `StatefulSetValidationOptions`

0 commit comments

Comments
 (0)