← Back to Pull requests

Move ComputeProjectMetadata to identity and refs pattern #13824

Merged
ada-coder-bot merged 6 files (399 lines) on Oct 09, 2026 23:34 UTC
View on GitHub
ada-coder-bot ada-coder-bot commented on Oct 08, 2026 18:36 UTC
Author

Description

Move ComputeProjectMetadata to the identity and refs pattern according to the kcc-identity-reference skill.

Summary of Changes

1. Identity (apis/compute/v1beta1/computeprojectmetadata_identity.go):
- Implemented ComputeProjectMetadataIdentity with identity.IdentityV2 and identity.Resource interface compliance.
- Defined ComputeProjectMetadataIdentityFormat using gcpurls.Template[ComputeProjectMetadataIdentity]("compute.googleapis.com", "projects/{project}").
- Extracted project ID from KCC annotations or namespace via refs.ResolveProjectID.
- Implemented GetIdentity returning the resolved spec identity without altering the CRD schema.

2. Reference (apis/compute/v1beta1/computeprojectmetadata_reference.go):
- Implemented ComputeProjectMetadataRef with refs.Ref interface compliance.
- Defined reference fields (External, Name, Namespace).
- Implemented Normalize using refs.NormalizeWithFallback which validates readiness (isResourceReady) before deriving the external identity from spec.

3. Tests & Fixtures (apis/compute/v1beta1/computeprojectmetadata_identity_test.go, pkg/test/.../_identities.yaml):
- Added unit tests covering identity parsing (FromExternal), string formatting, parent string, host, and reference validation.
- Updated golden fixture _identities.yaml for ComputeProjectMetadata, resolving CAIS URL to //compute.googleapis.com/projects/${TEST_DEPENDENT_ORG_PROJECT_ID}.

4. Journal (.gemini/skills/kcc-identity-reference/journal/ComputeProjectMetadata.md):
- Documented observations regarding project-level compute resource URLs, CAIS template matching, and legacy fallback normalization.

Fixes #13818

``release-note
none
``

This PR was generated by the overseer agent (powered by the gemini-3.7-flash model).

Diff: 399 lines (+398 / -1) across 6 files Reviewer: anhdle-sso Review duration: 1738m
All Vouch review confidence checks passed
Residual risk 0.09 = Change Risk (0.46) × (1 − Review Confidence (0.81)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.46 · 399 lines diff across 6 files
0.46
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.79 · 5 substantive comment(s)
0.79
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 50%
81%
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.358
Real PR Conversation Timeline
17 items
argus-watcher-bot argus-watcher-bot commented on Oct 08, 2026 18:53 UTC
Bot

🤖 AI Factory started investigating CI check failures for this pull request.

Note: We recommend waiting for the 'ready-for-human' label before leaving review comments. Comments added while the system is actively working may be associated with outdated commits once a new commit is pushed, causing them to be ignored.

ada-coder-bot ada-coder-bot commented on Oct 08, 2026 20:01 UTC
Author

Investigating validate-generated-files failure


Run: 37825557128
Name: validate-generated-files
Cause: Code Error
Details: The PR introduced ComputeProjectMetadataRef in apis/compute/v1beta1/computeprojectmetadata_reference.go, but the corresponding deepcopy methods were missing from apis/compute/v1beta1/zz_generated.deepcopy.go. As a result, the validate-generated-files presubmit check detected out-of-date generated code after running make generate.
Action Taken: Fix applied. Ran make generate locally to generate the missing deepcopy methods in apis/compute/v1beta1/zz_generated.deepcopy.go, verified that ./dev/ci/presubmits/validate-generated-files passed cleanly, amended the commit, and pushed the updated commit upstream.

(This report was generated by overseer)

argus-watcher-bot argus-watcher-bot commented on Oct 08, 2026 20:30 UTC
Bot

🤖 AI Factory started reviewing this pull request in a sandbox.

reviewbot-robot reviewbot-robot commented on code on Oct 08, 2026 20:46 UTC
Code Review
apis/compute/v1beta1/computeprojectmetadata_reference.go:1
@@ -0,0 +1,108 @@
+// Copyright 2026 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package v1beta1
+
+import (
+	"context"
+
+	"github.com/GoogleCloudPlatform/k8s-config-connector/apis/common"
+	"github.com/GoogleCloudPlatform/k8s-config-connector/apis/common/identity"
+	apirefs "github.com/GoogleCloudPlatform/k8s-config-connector/apis/refs"
+	refs "github.com/GoogleCloudPlatform/k8s-config-connector/apis/refs/v1beta1"
+	"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
+	"k8s.io/apimachinery/pkg/runtime/schema"
+	"k8s.io/apimachinery/pkg/types"
+	"sigs.k8s.io/controller-runtime/pkg/client"
+)
+
+var _ refs.Ref = &ComputeProjectMetadataRef{}
+
+// ComputeProjectMetadataRef is a reference to a GCP ComputeProjectMetadata.
+type ComputeProjectMetadataRef struct {
+	// A reference to an externally managed ComputeProjectMetadata resource.
+	// Should be in the format "projects/{{projectID}}".
+	External string `json:"external,omitempty"`
+
+	// The name of a ComputeProjectMetadata resource.
+	Name string `json:"name,omitempty"`
+
+	// The namespace of a ComputeProjectMetadata resource.
+	Namespace string `json:"namespace,omitempty"`
+}
+
+func init() {
+	refs.Register(&ComputeProjectMetadataRef{}, &ComputeProjectMetadata{})
+}
+
+func (r *ComputeProjectMetadataRef) GetGVK() schema.GroupVersionKind {
+	return ComputeProjectMetadataGVK
+}
+
+func (r *ComputeProjectMetadataRef) GetNamespacedName() types.NamespacedName {
+	return types.NamespacedName{
+		Name:      r.Name,
+		Namespace: r.Namespace,
+	}
+}
+
+func (r *ComputeProjectMetadataRef) GetExternal() string {
+	return r.External
+}
+
+func (r *ComputeProjectMetadataRef) SetExternal(ref string) {
+	r.External = ref
+	r.Name = ""
+	r.Namespace = ""
+}
+
+func (r *ComputeProjectMetadataRef) ValidateExternal(ref string) error {
+	trimmedRef := apirefs.TrimComputeURIPrefix(ref)

apirefs.TrimComputeURIPrefix(ref) is redundant here because id.FromExternal(ref) already trims Compute URI prefixes internally. Consider passing ref directly to id.FromExternal(ref).

reviewbot-robot reviewbot-robot commented on Oct 08, 2026 20:46 UTC
Reviewer

KCC Auto-Review Results


Trigger criteria matched: Yes
API Version Check: Pass - apis/compute/v1beta1 matches the existing CRD version (v1beta1).
Go Type Pointers: Pass - Type definitions and reference structs conform to pointer and field requirements.
Schema Compatibility: Pass - diff-crds confirms no schema changes were introduced.
  • References/Identity: Pass - ComputeProjectMetadataIdentity and ComputeProjectMetadataRef correctly implement identity.IdentityV2 and refs.Ref.
  • Detailed Findings / Actions Required:


    1. apis/compute/v1beta1/computeprojectmetadata_reference.go:71: Pre-trimming via apirefs.TrimComputeURIPrefix(ref) in ValidateExternal is redundant since id.FromExternal already trims Compute URI prefixes.

    argus-watcher-bot argus-watcher-bot commented on Oct 08, 2026 20:56 UTC
    Bot

    🤖 AI Factory started addressing review feedback for this pull request.

    argus-watcher-bot argus-watcher-bot commented on Oct 08, 2026 21:45 UTC
    Bot

    🤖 AI Factory started investigating CI check failures for this pull request.

    Note: We recommend waiting for the 'ready-for-human' label before leaving review comments. Comments added while the system is actively working may be associated with outdated commits once a new commit is pushed, causing them to be ignored.

    ada-coder-bot ada-coder-bot commented on Oct 08, 2026 21:47 UTC
    Author

    Investigating tests-e2e-fixtures-workstations failure


    Run: 37846626924
    Name: tests-e2e-fixtures-workstations
    Cause: Flake
    Details: Network error while downloading the Go toolchain from proxy.golang.org (read "https://proxy.golang.org/golang.org/toolchain/@v/v0.0.1-go1.26.4.linux-amd64.zip": stream error: stream ID 1; INTERNAL_ERROR; received from peer). The failure is unrelated to the changes in this PR.
    Action Taken: Rerun triggered via gh run rerun 37846626924 --failed.

    (This report was generated by overseer)

    argus-watcher-bot argus-watcher-bot commented on Oct 08, 2026 21:57 UTC
    Bot

    🤖 AI Factory started reviewing this pull request in a sandbox.

    argus-watcher-bot argus-watcher-bot commented on Oct 09, 2026 04:01 UTC
    Bot

    🤖 AI Factory started reviewing this pull request in a sandbox.

    reviewbot-robot reviewbot-robot commented on Oct 09, 2026 04:07 UTC
    Reviewer

    KCC Auto-Review Results


    Trigger criteria matched: Yes
    API Version Check: Pass - Checked apis/compute/v1beta1/ matching existing v1beta1 CRD version.
    Go Type Pointers: Pass - No spec/status primitive modifications in _types.go; reference struct fields follow canonical KCC reference conventions.
    Schema Compatibility: Pass - CRD schema is unchanged; no fields added or removed.
  • References/Identity: Pass - ComputeProjectMetadataIdentity correctly implements identity.IdentityV2 and identity.Resource using gcpurls.Template, and ComputeProjectMetadataRef implements refs.Ref with readiness-checked fallback for legacy resources.
  • Detailed Findings / Actions Required:


    None. All review criteria pass.

    argus-watcher-bot argus-watcher-bot commented on Oct 09, 2026 04:10 UTC
    Bot

    🤖 AI Factory started addressing review feedback for this pull request.

    ada-coder-bot ada-coder-bot commented on Oct 09, 2026 04:13 UTC
    Author

    Thank you for the review. All automated checks and KCC review criteria have passed with no actions required. The pull request is clean, all CI presubmits have succeeded, and the PR is ready for human approver review.

    (This comment was generated by overseer)

    anhdle-sso anhdle-sso commented on Oct 09, 2026 23:18 UTC
    Contributor

    KCC Auto-Review Results


    Trigger criteria matched: Yes
    API Version Check: Pass - Implemented under apis/compute/v1beta1/, matching baseline version (v1beta1).
    Copyright Year: Pass - All newly created files use Copyright 2026 Google LLC.
    Schema Compatibility: Pass - Zero schema changes; computeprojectmetadata_types.go is untouched.
    References/Identity: Pass - Implements identity.IdentityV2 and refs.Ref via gcpurls.Template (projects/{project}) with compute URI prefix trimming and safe legacy fallback normalization.
    CI Presubmits: Pass - All 248 CI checks passed cleanly.

    LGTM! Clean, high quality, and fully compliant with the kcc-identity-reference standards.

    anhdle-sso anhdle-sso approved these changes on Oct 09, 2026 23:20 UTC
    Approved Reviewer

    /lgtm

    google-oss-prow[bot] google-oss-prow[bot] commented on Oct 09, 2026 23:20 UTC
    Bot

    [APPROVALNOTIFIER] This PR is NOT APPROVED

    This pull-request has been approved by: <a href="https://github.com/GoogleCloudPlatform/k8s-config-connector/pull/13824#pullrequestreview-5476273435" title="LGTM">anhdle-sso</a>
    Once this PR has been reviewed and has the lgtm label, please assign maqiuyujoyce for approval. For more information see the Kubernetes Code Review Process.

    The full list of commands accepted by this bot can be found here.

    <details open>
    Needs approval from an approver in each of these files:

  • OWNERS
  • Approvers can indicate their approval by writing /approve in a comment
    Approvers can cancel approval by writing /approve cancel in a comment
    </details>
    <!-- META={"approvers":["maqiuyujoyce"]} -->

    Reviewers
    Assignees
    ada-coder-bot ada-coder-bot
    Labels
    risk: low confidence: 81.1% 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: 46.2% (MEDIUM) · Higher = larger blast radius
    46.2%
    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: 81.1% · Lower = rushed or shallow review
    81.1%
    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: 8.7% · Safe to merge
    8.7%