Fix BigQueryDataTransferConfig resource duplication loop #7228
All Vouch review confidence checks passed
Residual risk 0.26 = Change Risk (0.66) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.66 · 378 lines diff across 4 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.355
Shallow Review Depth
shallow_review_depth
0.289
Sensitive Paths
sensitive_paths
0.066
Real PR Conversation Timeline
1 comments
"Review active on #7228"
general
weight: 0.35
himanigulati01
Ensures
externalRefis preserved inBigQueryDataTransferConfigstatus updates, preventing a "permanent amnesia" loop that leads to multiple duplicate scheduled queries in GCP.BRIEF Change description
This PR fixes a bug where
BigQueryDataTransferConfigreconciliation fails to persist the link to the underlying GCP resource, leading to the creation of multiple duplicate scheduled queries.The issue occurs because the
setStatushelper function unconditionally overwrites the newly generatedexternalRef(from a successfulCreatecall) with the potentially emptyexternalReffrom the old Kubernetes object status. SinceBigQueryDataTransferConfiguses service-generated IDs, the loss of this reference causes KCC to lose track of the resource, leading it to create a new instance on every subsequent reconciliation loop.Fixes # (Internal Bug b/493812753)
WHY do we need this change?
1. Identity Loss:
BigQueryDataTransferConfigrelies entirely onstatus.externalRefto identify the existing resource in GCP. If this field is lost, KCC'sFind()method returnsfalse, and the controller concludes the resource does not exist.2. Duplication Loop: When a resource is successfully created but the
externalRefis immediately wiped from the status, KCC enters a state of "permanent amnesia." On the next sync (which is triggered immediately by the status update), KCC callsCreate()again, resulting in an infinite loop of duplicate resources in GCP.3. Dependency Sensitivity: This behavior is particularly triggered when dependencies (like Service Accounts or Datasets) are temporarily unhealthy, as the error-reporting path for those failures initializes an empty status that then "infects" the successful creation path via unconditional inheritance.
4. Orphaned objects: On the parent CR deletion, the corresponding GCP objects won't be deleted due to the lost link between the CR and the GCP resource.
Special notes for your reviewer:
The fix is surgical and targeted at the
setStatusfunction in theBigQueryDataTransferConfigdirect reconciler.Does this PR add something which needs to be 'release noted'?
``
release-note
`Fixed a bug in BigQueryDataTransferConfig where the link to the GCP resource (externalRef) could be lost during status updates, causing KCC to create multiple duplicate scheduled queries in GCP.
docs
NONE
Intended Milestone
Tests you have done