Skip to content

Commit

Permalink
update api validation doc
Browse files Browse the repository at this point in the history
  • Loading branch information
yuwenma committed Sep 16, 2024
1 parent ce526ba commit def5fda
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 17 deletions.
File renamed without changes.
4 changes: 2 additions & 2 deletions docs/develop-resources/guides/2-define-apis.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ According to the above principles, you shall decide how to process the following

* Add the parent field and mark as required

* See detailed [requirements and example](https://github.com/yuwenma/k8s-config-connector/blob/CR-validation/docs/develop-resources/api-validations.md#rule-3-parent) (TODO: update link)
* See detailed [requirements and example](../api-conventions/validations.md#rule-3-parent) (TODO: update link)

* Replace any field that is a resource reference to `<resource>Ref `and add the resource to `./apis/refs` if not exist.` `

* See [direct resource reference validation rules](https://github.com/yuwenma/k8s-config-connector/blob/resource-ref/docs/develop-resources/resource-reference.md) (TODO: update link). This validation shall consider the actual resource field’ usage and can be done in follow-up PRs

* Add **non** output-only fields to `spec`, excluding imperative fields.

* Add other CR validations according to the [Direct Resource API Validation Guide](https://github.com/yuwenma/k8s-config-connector/blob/CR-validation/docs/develop-resources/api-validations.md) (TODO: update link)
* Add other CR validations according to the [Direct Resource API Validation Guide](../api-conventions/validations.md)

* (Only for TF/DCL Beta) Existing `spec` and `status` fields should still be there, except the [output-only spec](https://paste.googleplex.com/4694303066030080) should be removed.

Expand Down
3 changes: 1 addition & 2 deletions docs/develop-resources/scenarios/alpha-to-beta.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ If the resource is TF-based or DCL-based, you shall migrate them to [the Direct

## From Direct Alpha to Beta

If the resource is already a Direct resource, you can follow [step 5.2](https://github.com/yuwenma/k8s-config-connector/blob/scifi-guide/docs/develop-resources/guides/5-releases.md#52-bump-from-v1alpha1-to-v1beta1) (TODO: update the link)
and submit a single PR
If the resource is already a Direct resource, you can follow [step 5.2](../guides/5-releases.md#52-bump-from-v1alpha1-to-v1beta1) and submit a single PR
8 changes: 4 additions & 4 deletions docs/develop-resources/scenarios/migrate-tf-resource-alpha.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Add MockGCP tests

Follow [Step 1](https://github.com/yuwenma/k8s-config-connector/blob/scifi-guide/docs/develop-resources/guides/1-add-mockgcp-tests.md)
Follow [Step 1](../guides/1-add-mockgcp-tests.md)

1. The 1st PR should set the `create.yaml `and `update.yaml `fields the same value for both test suites, with `_http.log `telling the matching HTTP request/response, and `_generated_object_<resource>.golden.yaml` telling the output-only fields.

Expand All @@ -16,7 +16,7 @@ Follow [Step 1](https://github.com/yuwenma/k8s-config-connector/blob/scifi-guide

## Add API

Follow [Step 2](https://github.com/yuwenma/k8s-config-connector/blob/scifi-guide/docs/develop-resources/guides/2-define-apis.md)
Follow [Step 2](../guides/2-define-apis.md)

The PR shall contain the types and deepcopy codes. It shall follow the Direct resource recommended styles and conventions. (TODO add the link) **It can change the existing fields since this is a Alpha resource**.

Expand All @@ -30,13 +30,13 @@ The PR shall contain the types and deepcopy codes. It shall follow the Direct re

## Add the mapper

Follow [Step 3](https://github.com/yuwenma/k8s-config-connector/blob/scifi-guide/docs/develop-resources/guides/3-add-mapper.md)
Follow [Step 3](../guides/3-add-mapper.md)

This PR adds the Direct mapper. You can do this together with the previous step or the next step if no additional manual changes are needed.

## Add the controller

Follow [Step 4](https://github.com/yuwenma/k8s-config-connector/blob/scifi-guide/docs/develop-resources/guides/4-add-controller.md).
Follow [Step 4](../guides/4-add-controller.md).

* Use the `KCC_USE_DIRECT_RECONCILERS` flag [exampe](https://github.com/GoogleCloudPlatform/k8s-config-connector/blob/0bbac86ace6ab2f4051b574f026d5fe47fa05b75/dev/tasks/run-e2e#L27). This will override the tf2crd and dcl2crd label to force using the Direct controller.

Expand Down
8 changes: 4 additions & 4 deletions docs/develop-resources/scenarios/migrate-tf-resource-beta.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Add MockGCP tests

Follow [Step 1](https://github.com/yuwenma/k8s-config-connector/blob/scifi-guide/docs/develop-resources/guides/1-add-mockgcp-tests.md)
Follow [Step 1](../guides/1-add-mockgcp-tests.md)

1. The 1st PR should set the `create.yaml `and `update.yaml `fields the same value for both test suites, with `_http.log `telling the matching HTTP request/response, and `_generated_object_<resource>.golden.yaml` telling the output-only fields.

Expand All @@ -16,7 +16,7 @@ Follow [Step 1](https://github.com/yuwenma/k8s-config-connector/blob/scifi-guide

## Add the backward compatible API

Follow [Step 2](https://github.com/yuwenma/k8s-config-connector/blob/scifi-guide/docs/develop-resources/guides/2-define-apis.md)
Follow [Step 2](../guides/2-define-apis.md)

The PR shall contain the types and deepcopy codes. It shall make modifications to make sure the CRDs are the same, because Beta resource has to be backward compatible.

Expand All @@ -34,13 +34,13 @@ Note: *Do not use* `excluded_resources`, we want the presubmit to validate the e

## Add the backward compatible mapper

Follow [Step 3](https://github.com/yuwenma/k8s-config-connector/blob/scifi-guide/docs/develop-resources/guides/3-add-mapper.md)
Follow [Step 3](../guides/3-add-mapper.md)

The PR adds the Direct mapper. You can do this together with the previous step or the next step if no additional manual changes are needed. Using `/*NOTYET .. */` to comment out new functions, same as the last step.

## Add the direct controller

Follow [Step 4](https://github.com/yuwenma/k8s-config-connector/blob/scifi-guide/docs/develop-resources/guides/4-add-controller.md)
Follow [Step 4](../guides/4-add-controller.md)

* Use the `KCC_USE_DIRECT_RECONCILERS` flag [exampe](https://github.com/GoogleCloudPlatform/k8s-config-connector/blob/0bbac86ace6ab2f4051b574f026d5fe47fa05b75/dev/tasks/run-e2e#L27).

Expand Down
2 changes: 1 addition & 1 deletion docs/develop-resources/scenarios/new-field.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ The apis directory the contains the existing API types of the resource.

## 2. Resolve resource reference

If the newly added fields contain resource references, you should have a second PR to update the resource reference, following [4.2 resolve resource references](https://github.com/yuwenma/k8s-config-connector/blob/scifi-guide/docs/develop-resources/guides/4-add-controller.md#42-resolve-resource-references) (TODO: update the link)
If the newly added fields contain resource references, you should have a second PR to update the resource reference, following [4.2 resolve resource references](../guides/4-add-controller.md#42-resolve-resource-references) (TODO: update the link)

Add a new test suite with `dependencies.yaml` to cover the referenced fields.
2 changes: 1 addition & 1 deletion docs/develop-resources/scenarios/new-resource.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Different than other scenarios, developing a pure Direct resource requires you t

1. A basic API from the auto-generated code, including all required fields (Step 2)
2. A basic Direct controller (Step 3 and 4).
3. Define `create.yaml` and `update.yaml` to run against the real GCP (Step 1 [record real gcp](https://github.com/yuwenma/k8s-config-connector/blob/scifi-guide/docs/develop-resources/guides/1-add-mockgcp-tests.md#record-real-gcp-log)) (TODO update link)
3. Define `create.yaml` and `update.yaml` to run against the real GCP (Step 1 [record real gcp](../guides/1-add-mockgcp-tests.md#record-real-gcp-log)) (TODO update link)

### PR reviews

Expand Down
3 changes: 0 additions & 3 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit def5fda

Please sign in to comment.