From a4122130ea65cc9cccbd747a57af21718bb98f5a Mon Sep 17 00:00:00 2001 From: jasonvigil Date: Wed, 4 Dec 2024 15:20:15 -0800 Subject: [PATCH] feat: Add note for project dependency gotcha in mockgcp docs --- docs/develop-resources/deep-dives/1-add-mockgcp-tests.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/develop-resources/deep-dives/1-add-mockgcp-tests.md b/docs/develop-resources/deep-dives/1-add-mockgcp-tests.md index 576c554ea4..90d8bacce9 100644 --- a/docs/develop-resources/deep-dives/1-add-mockgcp-tests.md +++ b/docs/develop-resources/deep-dives/1-add-mockgcp-tests.md @@ -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.