kcc-direct-mockgcp-implementer

Implements and aligns MockGCP services for direct KCC resources against real GCP logs.

1.1k|377|Updated Apr 8, 2019
One-click install
npx skills add https://github.com/GoogleCloudPlatform/k8s-config-connector --skill kcc-direct-mockgcp-implementer
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: kcc-direct-mockgcp-implementer
Source: https://github.com/GoogleCloudPlatform/k8s-config-connector/tree/main/.gemini/skills/kcc-direct-mockgcp-implementer
Command: npx skills add https://github.com/GoogleCloudPlatform/k8s-config-connector --skill kcc-direct-mockgcp-implementer

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Developing a direct Config Connector resource requires verifying that its controller behaves correctly against GCP, but running every test against real GCP is slow and costly. This Skill guides you through Phase 3 of direct resource development: building or extending a MockGCP service and aligning its behavior with real GCP responses.

Core Features & Use Cases

  • Mock Service Implementation: Create or extend mock services under mockgcp/mock<service_name>/ with CRUD methods for your resource kind, including proto generation and service registration.
  • Log Alignment Workflow: Run hack/compare-mock to diff mock output against recorded real GCP logs, then fix gaps using populate<ResourceKind>Defaults functions and scoped normalize.go rules.
  • Ratcheting & Presubmit Compliance: Remove your resource from the re-reconciliation exclusion list in tests/e2e/ratcheting.go and run fixture presubmits before committing.
  • Use Case: You are adding a new VertexAIDataset direct resource and need the mock aiplatform service to produce HTTP logs identical to real GCP so e2e fixture tests pass in CI.

Quick Start

Implement MockGCP support and align the mock logs for the VertexAIDataset direct resource using the existing e2e fixtures.

Frequently Asked Questions about kcc-direct-mockgcp-implementer

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement a MockGCP service for a KCC resource?

Create a mock service under mockgcp/mock<service_name>/ following mockgcp/GEMINI.md, add the proto to the Makefile and run make gen-proto, then implement CRUD methods for your resource kind and register the service in mockgcp/register.go.

How do I align mock GCP logs with real GCP output?

Run hack/compare-mock with your fixture test name to diff mock output against recorded real GCP logs. Fix output-only fields with a populate<ResourceKind>Defaults function and handle volatile values like timestamps in normalize.go, scoped to your service URL.

When must I re-record real GCP logs for KCC fixtures?

Whenever you modify a test case configuration, manifest files like create.yaml or update.yaml, or the controller's runtime mapping, you must re-run the test against real GCP with hack/record-gcp or E2E_GCP_TARGET=real to regenerate the authentic _http.log baseline.

Why does my KCC fixture test skip the re-reconciliation step?

Your resource is likely still in the ratcheting exclusion list in tests/e2e/ratcheting.go. Remove the case block for your resource's GroupKind from the ShouldTestRereconiliation switch statement to enable the re-reconciliation test step.

What files must be committed for a MockGCP fixture change?

Commit both the _http.log recorded from real GCP and the _http_mock.log generated with WRITE_GOLDEN_OUTPUT=1 against mock GCP. Also run scripts/validate-prereqs.sh and the fixture presubmit before opening the pull request.