Skip to content

Commit

Permalink
Merge pull request GoogleCloudPlatform#2838 from xiaoweim/update_scif…
Browse files Browse the repository at this point in the history
…i_guide

docs: modifications on SciFi migraiton documents
  • Loading branch information
google-oss-prow[bot] authored Oct 18, 2024
2 parents fea6226 + 37d508d commit fa48ebd
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions docs/develop-resources/api-conventions/validations.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ One future improvement can be having generate-types detect the “Immutable.”

Parent field should be required and immutable.

Note that parent is not a field name. It refers to the pre-requisite of the resource in question. You can identify the parent field through to the cloud resource's parent segment in the URL. For example, for GKE clusters, the [GET request URL](https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1/projects.zones.clusters/get) `https://container.googleapis.com/v1/projects/{projectId}/zones/{zone}/clusters/{clusterId}` has `projectId` and `zone` in the parent segment. Therefore, for GKE clusters, projectRef and zone will be the parent fields.


### Required

Expand Down
2 changes: 2 additions & 0 deletions docs/develop-resources/guides/3-add-mapper.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ go run . generate-mapper \
--api-dir $REPO_ROOT/apis
```

**Note**: We suggest using the same proto for your mock GCP and for you type-generation tool to generate the Config Connector API and mapper to avoid mismatch in schema definitions. There are some exceptions where you need to [replace the proto go package](https://github.com/xiaoweim/k8s-config-connector/blob/master/dev/tools/controllerbuilder/pkg/codegen/mappergenerator.go#L132).

### Simple path

If no comments marked `MISSING` and all the mapper functions look good, you are done. You can move to “Add the controller” (step 4).
Expand Down
2 changes: 2 additions & 0 deletions docs/develop-resources/guides/4-add-controller.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ hack/compare-mock fixtures/<your_resource_test>
KCC_USE_DIRECT_RECONCILERS=<YOUR KIND> hack/compare-mock fixtures/<your_resource_test>
```

* Note: Differences in http.logs such as `user-agent` and method url are expected. Please regenerate test logs before `compare-mock`.

### Exit Criteria

* The PRs shall pass the MockGCP tests
Expand Down
4 changes: 2 additions & 2 deletions docs/develop-resources/scenarios/migrate-tf-resource-beta.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Follow [Step 1](../guides/1-add-mockgcp-tests.md)

### PR Reviews

* We require the PR to contain the real GCP record for `_generated_object_<resource>.golden.yaml` and `_http.log`
* We require the 1st PR to show git diff between the real GCP record and the mock GCP record for `_generated_object_<resource>.golden.yaml` and `_http.log`
* We require the 2nd PR git diff can show the mutable fileds in `update.yaml`.
* We require the `_generated_object_<resource>.golden.yaml` reflecting the mutable fields are successfully updated.
* We require the `dependencies.yaml` to cover all referenced fields, and the `_http.log` showing the Cloud requests. You need to implement those dependencies' MockGCP methods as well.
Expand All @@ -23,7 +23,7 @@ The PR shall contain the types and deepcopy codes. It shall make modifications t

* You may need to modify the auto-generated `types.go` to keep the existing fields the same (even if it is not following the recommended styles and conventions). You can run `dev/tasks/generate-crds` (repeatedly) to make sure the CRD are the same (comment changes are acceptable).

* Add `cnrm.cloud.google.com/dcl2crd: "true"` or `cnrm.cloud.google.com/tf2crd: "true"` to the API tag [example](https://github.com/GoogleCloudPlatform/k8s-config-connector/blob/0bbac86ace6ab2f4051b574f026d5fe47fa05b75/pkg/controller/direct/redis/cluster/roundtrip_test.go#L92), to continue using TF-based controllers.
* Add `cnrm.cloud.google.com/dcl2crd: "true"` or `cnrm.cloud.google.com/tf2crd: "true"` to the API tag [example](https://github.com/GoogleCloudPlatform/k8s-config-connector/blob/0bbac86ace6ab2f4051b574f026d5fe47fa05b75/pkg/controller/direct/redis/cluster/roundtrip_test.go#L92), to continue using DCL-based or TF-based controllers.

* You may see some new fields added to the CRD. These are expected since the TF/DCL based resources could be out of date (and users are looking forward to these new fields!). You **shall comment out** those new fields using `/*NOTYET ..*/` in this PR if they are not supported in the TF-based controller yet (we will add them later).

Expand Down
3 changes: 3 additions & 0 deletions mockgcp/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ Broadly the steps are:

* Note: Ensure you pick the same version the controller uses to call the GCP API during GCP resource instantiation.

* Note: If the Config Connector resource does not map to a GCP resource, please refer to the REST API of the relevant GCP resource and find the proto file that covers the resource's API endpoints.(You may not find a proto file that matches the name of that Config Connector resource)


* (Optional) If you determine that the proto file is not up to date, or if it doesn't exist at all, refer to the [Generating Proto](#generating-proto) section

1. (Optional). If you're adding an API outside of `googleapis/google/cloud`,
Expand Down

0 comments on commit fa48ebd

Please sign in to comment.