When a resource is promoted to Beta, the direct controller should typically become the default. This is achieved by ensuring the v1beta1 CRD does not contain the cnrm.cloud.google.com/tf2crd or cnrm.cloud.google.com/dcl2crd labels, and then regenerating the static controller configuration.
For detailed instructions, please see 4-add-controller.md, under "Scenario 3: Promoting an alpha direct resource to beta".
-
Copy-paste
./apis/service>/v1alpha1to./apis/service>/v1beta1usinggit mv(this is for PR review) and make sure the./apis/service>/v1alpha1is still there.- NOTE: if you have more than one resource in your service, only copy the files relevant to your resource for now. You will need to re-run
dev/tasks/generate-crdsfor thedeepcopyfile.
- NOTE: if you have more than one resource in your service, only copy the files relevant to your resource for now. You will need to re-run
-
Update the new package version to
v1beta1 -
Update all direct controller imports to use the
v1beta1api of your resource -
For all the fixtures tests under pkg/test/resourcefixture/testdata make sure your resources use the
v1beta1version. -
Add
kubebuilder:storageversiontag tov1beta1API. example -
Run
dev/tasks/generate-crdsto patch your resource's CRD with thev1beta1version.
-
For resource that is purely direct controller based, add the resource name to
pureDirectResourcesinIsPureDirectResourcefunction in sets.go. -
If the resource is found in the resource-autogen allowlist, remove it from the list.
- Make sure a directory exist under config/samples/resources.
For example, if the kind is
spannerinstance, the directory should beconfig/samples/resources/spannerinstance. - Make sure a a sample YAML file named
<service>-<version>-<kind>.yamlexist under the directory. - Look at example in pkg/test/resourcefixture/testdata/basic////-minimal/create.yaml to fill in the content for the sample YAML.
- Fulfill the following requirements for the sample YAML file (the path is in JSON format).
- The
.metadata.nameis in the format<kind>-sample(lower case). - If the resource has a
.spec.projectReffield, useprojects/${PROJECT_ID?}literally as.spec.projectRef.externalvalue.
- The
- Enable your service API in SUPPORTED_SERVICES if it's not there.
- If the test takes more than 10 minutes to finish, add it to LONG_RUNNING_SAMPLES_TESTS_REGEX in ./scripts/shared-vars-public.sh.
Run the sample
go test -v -tags=integration ./config/tests/samples/create -test.run TestAll -run-tests <your_sample_test_name>your_sample_test_name is the sample suite directory name, i.e spannerinstance
Replace the environment variables to real values before running the tests.
We have a script that generates snippet files for Cloud Code using our samples.
If you created multiple samples (i.e. multiple samples subdirectories), you must
tell the script which sample to use for generating snippets. Update the
preferredSampleForResource map in
pkg/snippet/snippetgeneration/snippetgeneration.go.
All beta resource can have a Google Reference documentation Connector reference doc. Please follow the steps to add the reference doc.
-
Copy one of existing files under scripts/generate-google3-docs/resource-reference/templates, and name it like
spanner_spannerinstance.tmpl, (i.e., _.tmpl). -
Add a paragraph to briefly introduce the resource at the very top of the file.
-
If additional setup is necessary before the newly added resource can be applied successfully, and the setup can't be done via the Config Connector resources or features, add a "Prerequisites" section to explain the prerequisites steps, E.g. scripts/generate-google3-docs/resource-reference/generated/resource-docs/containerattached/containerattachedcluster.md and scripts/generate-google3-docs/resource-reference/generated/resource-docs/secretmanager/secretmanagersecret.md
-
Update scripts/generate-google3-docs/resource-reference/overview.md by adding a row for your resource to the resource table. Note that {{spanner_name}} is the template variable for Cloud Spanner. The template variables for gcp product names can be found here.
-
Update scripts/generate-google3-docs/resource-reference/_toc.yaml by adding an entry and path to the corresponding API section. If there is no entry for the API, add one.
-
Run
make resource-docs. You should see your resource generated to the scripts/generate-google3-docs/resource-reference/generated/resource-docs folder. -
Wait for the next Config Connector release, the release sheriff will publish the reference doc in Google based on the auto-generated doc folder.
Once you finish adding an Alpha resource, a Beta resource, or new fields to existing resources, you can add a releasenote for the next release. The release sheriff will publish the note.