← Back to Pull requests

Greenfield: Implement direct KRM types, identity, and generate.sh for BackupDRBackup #13979

Open
unknown opened this pull request with 424 lines diff across 5 files
View on GitHub
unknown unknown commented on Oct 14, 2026 04:47 UTC
Author

This PR implements direct KRM types, identity, references, and generate.sh configuration for the greenfield resource BackupDRBackup (backupdr.cnrm.cloud.google.com/v1alpha1).

Key Changes


1. Types & CRD (apis/backupdr/v1alpha1/backupdrbackup_types.go):
- Added KRM types for BackupDRBackupSpec, BackupDRBackupStatus, and BackupDRBackupObservedState.
- Labeled with cnrm.cloud.google.com/stability-level=alpha.
- All scalar primitive fields across spec and status are pointers, including Location string.
- Parent and resource dependencies use KRM reference types: ProjectRef, BackupVaultRef (
backupdrv1beta1.BackupVaultRef), and DataSourceRef (DataSourceRef).
- Used
ObservedState structs for output-only properties (DiskBackupPropertiesObservedState, Backup_GcpBackupPlanInfoObservedState).
- Enforced acronym naming conventions in Scheduling (MinNodeCPUs, LocalSSDRecoveryTimeout).
2. Inline External Reference & Cycle Resolution (apis/backupdr/v1alpha1/backupdrbackup_reference.go):
- Defined external-only DataSourceRef and DataSourceIdentity inline in backupdrbackup_reference.go to avoid naming violations.
- Resolved circular import between v1alpha1 and v1beta1 by having BackupDRBackupPlanSpec and BackupDRBackupPlanAssociationSpec in v1beta1 use package v1beta1's own Parent struct.
3. Identity (apis/backupdr/v1alpha1/backupdrbackup_identity.go):
- Implemented BackupIdentity with format projects/{project}/locations/{location}/backupVaults/{backupvault}/dataSources/{datasource}/backups/{backup}.
- Implemented BackupRef delegating normalization strictly to refs.Normalize.
- Added unit tests in backupdrbackup_identity_test.go covering BackupIdentity, DataSourceIdentity, and getIdentityFromBackupSpec.
4. Mappers (pkg/controller/direct/backupdr/backup_mappers.go):
- Implemented complete, non-empty mappers including AccessConfig_v1alpha1_ToProto (mapping in.ExternalIP to NatIP, Type, NetworkTier, etc.), AttachedDiskObservedState_v1alpha1_ToProto, ComputeInstanceBackupPropertiesObservedState_v1alpha1_ToProto, DiskBackupPropertiesObservedState_v1alpha1_ToProto, GuestOSFeature_v1alpha1_ToProto, Metadata_v1alpha1_FromProto/ToProto, Scheduling_v1alpha1_FromProto/ToProto, and NetworkInterfaceObservedState_v1alpha1_FromProto/ToProto.

KCC Auto-Review Results


Trigger criteria matched: Yes
API Version Check: Pass - backupdr.cnrm.cloud.google.com/v1alpha1
Go Type Pointers: Pass - All scalar primitive types are pointers, including Location string
Completeness & Heuristics: Pass - 100% proto field coverage between google.cloud.backupdr.v1.Backup and KRM types
1:1 Kind to Proto Mapping: Pass - BackupDRBackup strictly maps 1:1 to google.cloud.backupdr.v1.Backup
References/Identity: Pass - ProjectRef, BackupVaultRef, and DataSourceRef properly referenced and canonical identity implemented
Exception Files: Pass - Only tests/apichecks/testdata/exceptions/alpha-missingfields.txt updated

``release-note
Implement direct KRM types, identity, and generate.sh for BackupDRBackup (v1alpha1)
``

Fixes #11717

***
This pull request was generated by an AI coding agent.

<!-- factory:task-output kind=Change task=recipe-fix-20261014-033415-739d -->

Diff: 424 lines (+318 / -106) across 5 files Reviewer: seans3 Review duration: 17723m
All Vouch review confidence checks passed
Residual risk 0.26 = Change Risk (0.45) × (1 − Review Confidence (0.43)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 424 lines diff across 5 files
0.45
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
0.02
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
42%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
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.362
Shallow Review Depth shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #13979"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 43.0% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 45.1% (MEDIUM) · Higher = larger blast radius
45.1%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 43.0% · Lower = rushed or shallow review
43.0%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 25.7% · Safe to merge
25.7%