Skip to content

Add Go types for DataflowJob to direct controller #6803

@justinsb

Description

@justinsb

As part of moving resources from terraform controllers to direct controllers (Epic #5954), we need to create the Go types for DataflowJob.

Currently, DataflowJob is managed by the Terraform controller (marked with tf2crd=true). The goal is to create the Go types in apis/dataflow/v1beta1/ so that we can eventually migrate the controller implementation to the "direct" approach.

Instructions

  1. Add to generate.sh:
    Modify apis/dataflow/v1beta1/generate.sh to include DataflowJob.
    It likely maps to google.dataflow.v1beta3.Job.
    Example:

    go run . generate-types \
      --service google.dataflow.v1beta3 \
      --api-version dataflow.cnrm.cloud.google.com/v1beta1 \
      --resource DataflowFlexTemplateJob:FlexTemplateRuntimeEnvironment \
      --resource DataflowJob:Job
  2. Generate Scaffolding:
    Run apis/dataflow/v1beta1/generate.sh. This should create apis/dataflow/v1beta1/dataflowjob_types.go.

  3. Iterate on Types:
    Compare the generated CRD with the existing one using dev/tasks/diff-crds.
    Modify apis/dataflow/v1beta1/dataflowjob_types.go until the CRD matches the existing one at config/crds/resources/apiextensions.k8s.io_v1_customresourcedefinition_dataflowjobs.dataflow.cnrm.cloud.google.com.yaml.

    Acceptance Criteria:

    • Running dev/tasks/diff-crds should not show differences (or minimal acceptable ones like descriptions).
    • Changes to the schema (fields added/removed) are NOT acceptable.
  4. Copyright Headers:
    Ensure the new file has the correct copyright header:

    // Copyright 2026 Google LLC
  5. 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"
  6. Status:
    status.observedGeneration should be an int64.

This issue is part of Epic #5954.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions