Using package google.cloud.bigquery.v2 for resource group BigQuery
As part of moving resources from Terraform controllers to direct controllers (Epic #5954), we need to create the Go types for BigQueryDatasetAccess.
Currently, BigQueryDatasetAccess is managed by the Terraform controller (marked with tf2crd=true). The goal is to create the Go types in apis/bigquery/v1beta1/ so that we can eventually migrate the controller implementation to the "direct" approach.
Instructions
-
Create a generate.sh:
Create apis/bigquery/v1beta1/generate.sh which includes BigQueryDatasetAccess.
It likely maps to something like google.cloud.bigquery.v2.
Example:
go run . generate-types \
--service google.cloud.bigquery.v2 \
--api-version bigquery.cnrm.cloud.google.com/v1beta1 \
--resource BigQueryDatasetAccess:DatasetAccess \
--include-skipped-output
go run . generate-mapper \
--service google.cloud.bigquery.v2 \
--api-version bigquery.cnrm.cloud.google.com/v1beta1 \
--include-skipped-output
-
Set the write permission on the new apis/bigquery/v1beta1/generate.sh file. You should do this by running both chmod +x apis/bigquery/v1beta1/generate.sh and git add --chmod=+x apis/bigquery/v1beta1/generate.sh.
-
Generate Scaffolding:
Run apis/bigquery/v1beta1/generate.sh. This should create apis/bigquery/v1beta1/datasetaccess_types.go.
-
Iterate on Types:
Compare the generated CRD with the existing one using dev/tasks/diff-crds.
Modify apis/bigquery/v1beta1/datasetaccess_types.go until the CRD matches the existing one at config/crds/resources/apiextensions.k8s.io_v1_customresourcedefinition_bigquerydatasetaccesss.bigquery.cnrm.cloud.google.com.yaml.
Acceptance Criteria:
- Running
dev/tasks/diff-crds should not show differences (or minimal acceptable ones like descriptions).
- Ensure that running the check_crd_equivalence MCP on the CRD should return EQUIVALENT.
- Changes to the schema (fields added/removed) are NOT acceptable.
-
Copyright Headers:
Ensure that new files have the correct copyright header:
// Copyright 2026 Google LLC
Please do not change the copyright on existing files.
-
Labels:
Ensure the controller-runtime annotations match the existing CRD labels, including:
// +kubebuilder:metadata:labels="cnrm.cloud.google.com/managed-by-kcc=true"
// +kubebuilder:metadata:labels="cnrm.cloud.google.com/system=true"
// +kubebuilder:metadata:labels="cnrm.cloud.google.com/stability-level=stable"
// +kubebuilder:metadata:labels="cnrm.cloud.google.com/tf2crd=true"
The goal is to maintain these annotations, not add an annotation if it is missing.
-
Status:
status.observedGeneration should be an *int64.
-
Generate Mappers:
- Running
dev/tasks/generate-types-and-mappers will generate the mapper code once the apis/bigquery/v1beta1/datasetaccess_types.go file is generating an equivalent CRD.
- Run
make all-binary to ensure the generated mapper code compiles. Please fix any issue discovered by this compilation.
This issue is part of Epic #5954.
Using package google.cloud.bigquery.v2 for resource group BigQuery
As part of moving resources from Terraform controllers to direct controllers (Epic #5954), we need to create the Go types for
BigQueryDatasetAccess.Currently,
BigQueryDatasetAccessis managed by the Terraform controller (marked withtf2crd=true). The goal is to create the Go types inapis/bigquery/v1beta1/so that we can eventually migrate the controller implementation to the "direct" approach.Instructions
Create a generate.sh:
Create
apis/bigquery/v1beta1/generate.shwhich includesBigQueryDatasetAccess.It likely maps to something like
google.cloud.bigquery.v2.Example:
Set the write permission on the new
apis/bigquery/v1beta1/generate.shfile. You should do this by running bothchmod +x apis/bigquery/v1beta1/generate.shandgit add --chmod=+x apis/bigquery/v1beta1/generate.sh.Generate Scaffolding:
Run
apis/bigquery/v1beta1/generate.sh. This should createapis/bigquery/v1beta1/datasetaccess_types.go.Iterate on Types:
Compare the generated CRD with the existing one using
dev/tasks/diff-crds.Modify
apis/bigquery/v1beta1/datasetaccess_types.gountil the CRD matches the existing one atconfig/crds/resources/apiextensions.k8s.io_v1_customresourcedefinition_bigquerydatasetaccesss.bigquery.cnrm.cloud.google.com.yaml.Acceptance Criteria:
dev/tasks/diff-crdsshould not show differences (or minimal acceptable ones like descriptions).Copyright Headers:
Ensure that new files have the correct copyright header:
// Copyright 2026 Google LLCPlease do not change the copyright on existing files.
Labels:
Ensure the controller-runtime annotations match the existing CRD labels, including:
The goal is to maintain these annotations, not add an annotation if it is missing.
Status:
status.observedGenerationshould be an*int64.Generate Mappers:
dev/tasks/generate-types-and-mapperswill generate the mapper code once theapis/bigquery/v1beta1/datasetaccess_types.gofile is generating an equivalent CRD.make all-binaryto ensure the generated mapper code compiles. Please fix any issue discovered by this compilation.This issue is part of Epic #5954.