Skip to content

Latest commit

 

History

History
90 lines (60 loc) · 5.27 KB

File metadata and controls

90 lines (60 loc) · 5.27 KB

5. Release

5.1 Turn on your Direct controller (TF/DCL Beta Only)

For TF-based Beta resource

  • Remove the cnrm.cloud.google.com/tf2crd: "true" label from the CRD will turn on SciFi controller. example

For DCL-based Beta resource

  • Remove the cnrm.cloud.google.com/dcl2crd: "true" label from the CRD will turn on SciFi controller.

5.2 Bump from v1alpha1 to v1beta1

  • Copy-paste ./apis/service>/v1alpha1 to./apis/service>/v1beta1using git mv (this is for PR review) and make sure the ./apis/service>/v1alpha1 is 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-crds for the deepcopy file.
  • Update the new package version to v1beta1

  • Update all direct controller imports to use the v1beta1 api of your resource

  • For all the fixtures tests under pkg/test/resourcefixture/testdata make sure your resources use the v1beta1 version.

  • Add kubebuilder:storageversion tag to v1beta1 API. example

  • Run dev/taks/generate-crds to patch your resource's CRD with the v1beta1 version.

5.3 Turn on doc auto-generation (direct resource only)

  • Add the direct resource to config/servicemappings, only specify the name, kind and direct(true) example

  • For resource that is purely direct controller based, add the resource name to pureDirectResources in IsPureDirectResource function in sets.go.

  • If the resource is found in the resource-autogen allowlist, remove it from the list.

5.4 Add samples

  1. In config/samples/resources, create a new directory for the resource's samples: mkdir spannerinstance.
  2. Follow the sample guidelines and create sample(s) for the resource.

Run/Disable Sample Tests

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 scheduler-job-pubsub

Replace the environment variables to real values before running the tests.

Cloud Code Snippets

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.

5.5 Add reference document

To add or update the Config Connector reference doc, please do the following.

  1. Copy one of existing files under scripts/generate-google3-docs/resource-reference/templates, and name it like spanner_spannerinstance.tmpl, (i.e., _.tmpl).

  2. Add a paragraph to briefly introduce the resource at the very top of the file.

  3. 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

  4. Update scripts/generate-google3-docs/resource-reference/overview.md by adding a row for your resource to the resource table.

  5. 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.

To generate the new resource doc, run make resource-docs. You should see your resource generated to the scripts/generate-google3-docs/resource-reference/generated/resource-docs folder.