Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add note for project dependency gotcha in mockgcp docs #3313

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/develop-resources/deep-dives/1-add-mockgcp-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ Create a directory for your resource [pkg/test/resourcefixture/testdata/basic](p
Just to add the `create.yaml`, `update.yaml` and `dependencies.yaml` (if applicable) to each bottommost directory.
These three files are all Kubernetes config files, except that `create.yaml` and `update.yaml` only holds the your Config Connector CR object, and the `dependencies.yaml` holds all the dependent objects.

Note: Do not add your GCP Project (the output of `gcloud config get project`) as a dependency in `dependencies.yaml` and run `hack/record-gcp` (even with the `cnrm.cloud.google.com/deletion-policy: abandon` annotation). If your GCP project is listed as a dependency, Config Connector will add the label `cnrm-test: true` to your project during test runs (because it labels all test resources with `cnrm-test: true`). This is likely not desirable, because the label indicates that your GCP project is a test resource. Instead, you can refer to your development project in the `create.yaml` and `update.yaml` resources via an external project reference, with the `${projectId}` template variable. For example:
```
projectRef:
external: ${projectId}
```

## 1.2 Write the MockGCP server

Follow [this guide](https://github.com/GoogleCloudPlatform/k8s-config-connector/blob/master/mockgcp/README.md) to write a mock gcp server.
Expand Down