gcp-config-connector
Authors Config Connector (KCC) manifests for Google Cloud resource changes and hands them to submit-suggestion as a pull request under the GitOps repository's clusters/<cluster>/provisioning/ path. Use when a request creates or changes a GKE cluster or node pool (create, grow, autoscale, adopt), a Cloud SQL instance (add a read replica, resize), or a VPC firewall rule on an install whose GitOps repository holds Config Connector YAML. Decides create versus acquire read-only, validates every field with kubectl explain against the customer's CRDs, and never applies. Don't use for Kubernetes workload manifests (use gke-manifest-generation) or Terraform HCL (use gcp-terraform).
- License 许可
- Apache-2.0
- 最近更新
- 2026-11-14
- Stars
- ★ 126
- Forks
- 44
01 前言 Front Matter
- name
- gcp-config-connector
- description
- Authors Config Connector (KCC) manifests for Google Cloud resource changes and hands them to submit-suggestion as a pull request under the GitOps repository's clusters/<cluster>/provisioning/ path. Use when a request creates or changes a GKE cluster or node pool (create, grow, autoscale, adopt), a Cloud SQL instance (add a read replica, resize), or a VPC firewall rule on an install whose GitOps repository holds Config Connector YAML. Decides create versus acquire read-only, validates every field with kubectl explain against the customer's CRDs, and never applies. Don't use for Kubernetes workload manifests (use gke-manifest-generation) or Terraform HCL (use gcp-terraform).
02 资源文件 4
- 参考文档references/acquisition.md9.0 KB
- 参考文档references/compute-firewall.md6.5 KB
- 参考文档references/container.md10.6 KB
- 参考文档references/sql.md5.3 KB
03 SKILL.md 正文
Config Connector (KCC) Authoring
On a repository that keeps its Google Cloud resources as Config Connector
YAML, a change leaves this agent as a manifest in the GitOps repository,
reviewed by a human and applied by the customer's reconciler (a repository
that keeps them as Terraform gets the gcp-terraform skill instead). This skill writes that manifest. It reads the cluster
and the cloud project to decide what to write, validates the result against
the CRDs the customer actually runs, and opens the pull request through
submit-suggestion. Nothing here mutates a cluster or a project, and the
command policy refuses the verbs that would.
When to Use
- A new GKE cluster or node pool, or a change to one — create a cluster
someone asked for, grow or shrink a pool, turn on autoscaling, change a
release channel or maintenance window, adopt a cluster the repo does not
yet describe. A new cluster is a create like any other: this skill, not a
gcloudorgkeMCP create, is how it reaches the project. - A Cloud SQL change — add a read replica, change a tier, enable backups or high availability.
- A VPC firewall rule — open or close a port, narrow a source range, disable a rule, turn on logging.
- Adopting a resource that exists in Google Cloud but has no manifest in the repository (acquisition).
When NOT to Use
- Kubernetes workloads (Deployments, Services, NetworkPolicies): the
gke-manifest-generationskill. - A repository whose
provisioning/holds Terraform HCL rather than KCC YAML: thegcp-terraformskill. This skill authors KRM only. - Kinds outside the families catalogued in
references/. Other Config Connector kinds follow the same annotations and workflow, but their immutable fields are not catalogued here; validate every field withkubectl explainand say in the PR body that the kind is outside the catalogued set. - Fixing a fleet-audit finding: the
fleet-auditskill opens that PR.
Prerequisites (the customer's, not yours)
Config Connector is a customer platform decision. Never propose installing or enabling it; state the missing piece and stop.
- The CRDs are installed on a cluster your kubeconfig reaches. The
check is
kubectl get crd <kind-plural>.<group>.cnrm.cloud.google.com(Step 1). No CRD means no schema to validate against and no controller to reconcile the manifest. Stop with: "Config Connector is not installed on<context>; this change needs a KCC-enabled cluster before I can author it." - The repository has a KCC path.
clusters/<cluster>/provisioning/in the reference layout, holding YAML withcnrm.cloud.google.comapiVersions. If the repo has no such directory and the user has not named one, ask rather than invent a layout. - A namespace bound to a project. The sibling manifests carry either a
cnrm.cloud.google.com/project-idannotation on each resource or on the namespace (ConfigConnectorContext). Copy what the siblings do. - Read access to the
cnrm.cloud.google.comAPI groups for the create-versus-acquire check. Which identity answers depends on where the KCC objects live: on the management cluster reached in-cluster, the read-only ClusterRole the operator ships grants none of those groups, sokubectl auth can-isaysno; on a separate hub reached throughget-credentials, the Google service account's IAM permission set decides, and the defaultread-onlyset's cluster-viewer role does read custom resources. Either way anois a fact to report, not an absence to infer from.
Workflow
Step 1: Check for Config Connector, then open the repository
The CRD check comes first because it needs no repository and is the stop you hit most often:
kubectl get crd containernodepools.container.cnrm.cloud.google.com
Not found is prerequisite 1 unmet: stop with the message there, before
anything is opened. With the CRD present, open the repository with
submit-suggestion prepare (its Step 1). It needs the branch name up
front, and the convention for this skill is platform-agent/kcc-<kind>-<name>,
the same branch Step 5 submits on. Then list what is already under
provisioning/:
python3 "$HERMES_HOME"/skills/submit-suggestion/scripts/submit_suggestion.py prepare \
--repo "<owner>/<repo>" --branch "platform-agent/kcc-<kind>-<name>"
What it prints is one JSON line, and its workspace is a real working copy of
the repository on this filesystem — so the reads are ls and cat, with no
second tool and no network:
ls <workspace>/clusters/<cluster>/provisioning
cat <workspace>/clusters/<cluster>/provisioning/<sibling>.yaml
From a sibling manifest take the metadata.namespace, how the project is bound,
the label conventions, and one file per resource or one per kind. A manifest
for the resource you were asked to change may already be there; then the
change is an edit to that file, and Step 2's answer is "edit".
Stopping before Step 5 leaves nothing to clean up. The copy is on this
filesystem, not on the credential broker, and nothing on the forge's side is
held open by having read it. Stop where you need to — a stop or a question
from Step 2's table, an immutable field in Step 3, a CRD Step 4 finds missing
— and when the user answers and the work resumes, run prepare again.
Terraform HCL under provisioning/ is not a stop here but gcp-terraform's:
switch to it. If it refuses because the copy holds revisions
that were never published, that is an earlier run's work: read the refusal
before reaching for --force.
Step 2: Decide create, acquire, or edit — read-only
Config Connector acquires an existing Google Cloud resource when a new
manifest's name (or spec.resourceID) matches it, and creates one when
nothing matches. A create manifest for a resource that exists silently adopts
it after merge; an acquisition manifest whose stated immutable fields differ
from the live resource fails in status.conditions with cannot make changes to immutable field(s). Decide before you write, and say which in the PR body.
Check permission before the object read, so a Forbidden is reported as
such rather than mistaken for "not there":
kubectl auth can-i get containernodepools.container.cnrm.cloud.google.com -n <namespace>
kubectl get containernodepool <name> -n <namespace> -o yaml
Then the live resource, with the reads the command policy allows:
gcloud container clusters describe <cluster> --location <location> --project <project> --format=json
gcloud container node-pools describe <pool> --cluster <cluster> --location <location> --project <project> --format=json
gcloud compute firewall-rules describe <rule> --project <project> --format=json
| Manifest in repo | KCC object in cluster | Resource in Google Cloud | Decision |
|---|---|---|---|
| yes | any | any | Edit that file. Touch only the fields the request needs. |
| no | yes | yes | Stop. Something outside the repo manages it; report the object. |
| no | yes | no | Stop. A failed or in-flight create; report its status.conditions. |
| no | no | yes | Acquire. references/acquisition.md. |
| no | no | no | Create. |
| no | forbidden / no KCC | unknown | Report what you could not read. Ask the user which it is; do not assume. |
gcloud sql has no entry on the read allowlist. For a SQLInstance the
in-cluster object is the only read you have; when that is forbidden or
absent, ask the user to confirm whether the instance exists rather than
guessing (references/sql.md).
Step 3: Author the manifest
- apiVersion
v1beta1of the kind's group; per-family details inreferences/. metadata.namespace: the siblings' namespace. Neverdefault, never a namespace you did not see in the repo.- Annotations on every manifest (
references/acquisition.mdexplains each):cnrm.cloud.google.com/deletion-policy: abandon— a pruned or deleted manifest detaches the resource instead of destroying it.cnrm.cloud.google.com/state-into-spec: absent— Config Connector leaves fields the manifest omits under external management instead of writing live state back intospec, which a pull reconciler would read as drift.cnrm.cloud.google.com/project-id: <project>when the siblings set it per resource; omit it when they rely on the namespace binding.
- Acquisition adds an explicit
spec.resourceIDequal to the Google Cloud resource name, and every immutable field it does state is copied from the live resource so the spec matches what exists. - Write the fields the request needs plus the required ones, nothing else. An omitted field stays externally managed; a copied default becomes a managed field the next reviewer has to reason about.
- Immutable fields are the line. If the request can only be met by changing one (a machine type, a region, a firewall's network), the answer is replacement, not an edit: say so, name the field, and stop for the user's decision. Never author a replacement unasked.
- Names: Kubernetes names in
metadata.name; a Google Cloud name that is not a valid Kubernetes name goes inspec.resourceID.
Step 4: Validate against the customer's CRDs
Server-side dry-run is a write from the API server's point of view: it needs
write RBAC the platform role lacks, and the command policy refuses apply,
create, and diff regardless. Validate with the schema instead:
kubectl explain containernodepool --api-version=container.cnrm.cloud.google.com/v1beta1
kubectl explain containernodepool.spec.autoscaling --api-version=container.cnrm.cloud.google.com/v1beta1
kubectl explain containernodepool.spec.autoscaling.totalMaxNodeCount --api-version=container.cnrm.cloud.google.com/v1beta1
- Run
explainon the kind and on everyspec.<path>you wrote. A path the CRD does not have is a field the customer's Config Connector version does not know; drop or rename it, do not ship it. - A description that begins
Immutable.marks an immutable field. That is the authority over the lists inreferences/, which were written against one version of the CRDs. explainreads discovery, which every authenticated user has, so it works even whereauth can-i getsaidno.- A missing CRD (
explainreports the resource is not found) is prerequisite 1 unmet: stop with the message there.
Step 5: Hand off as a pull request
Write the manifest into the workspace at
clusters/<cluster>/provisioning/<kind>-<name>.yaml
unless the siblings use another convention. A new ContainerCluster goes
where the repository already keeps ContainerCluster manifests; if it keeps
none, ask which path, rather than inventing one. Then submit it through
submit-suggestion with branch platform-agent/kcc-<kind>-<name>. Use
this shape for the --body-file document, after the skill's standard header,
and pass the --evidence-file its Step 3 requires:
### Config Connector change
- **Decision:** create | acquire | edit — and the reads that decided it
(object present/absent, the `describe` result, or "user confirmed").
- **Resource:** <kind> `<name>` in project `<project>`, location `<location>`.
- **Immutable fields touched:** none | <field> (this PR proposes replacement; see below).
- **Validated:** `kubectl explain` on <kind> and <n> spec paths against the CRDs on `<context>`.
- **Not run here:** `kubectl apply --dry-run=server`. The agent is read-only; run it on the
KCC cluster before merging, or let CI do it.
- **After merge:** the reconciler applies; KCC reports readiness in the object's `status.conditions`.
Record the PR URL for the user. Addressing review feedback follows submit-suggestion Step 5.
Red Lines
- No
kubectl apply,create,patch,edit,delete,diff, or any--dry-run=server; no mutatinggcloud. The command policy refuses them and a refusal is not a retry prompt. - Never set
deletion-policytononeor remove the annotation. Deleting a resource is a human's PR that flips it deliberately. - Never delete a manifest under
provisioning/to "recreate" a resource. - Never fill in a project, namespace, network, or location you did not read from the repository, the cluster, or the user.
- Never propose enabling Config Connector, granting its IAM, or creating a
ConfigConnectorContext.
References
- Acquisition and annotations: how Config Connector matches a manifest to an existing resource, what each annotation does, and the immutable-field failure modes.
- ContainerCluster and ContainerNodePool:
fields, immutables,
describe-to-spec mapping, create and acquire examples. - SQLInstance: read replicas, tier changes, the
missing
gcloud sqlread, create and acquire examples. - ComputeFirewall: rule shape,
immutables,
describe-to-spec mapping, create and acquire examples.
04 同仓库更多 Skills
gke-workload-troubleshooting
Diagnoses GKE workload failures (CrashLoopBackOff, OOMKilled, ImagePullBackOff, Pending, etc.) via logs and events. Use when pods fail to start or crash repeatedly. Don't use for GKE cluster infrastructure provisioning, node pool creation, or non-Kubernetes Google Cloud services.
gke-workload-security
Audits, configures, and hardens workload-level security controls for Google Kubernetes Engine (GKE) applications and namespaces. Covers running security audits (`audit_cluster.sh`), enforcing Network Policies (default-deny and Dataplane V2 logging), isolating high-risk pods inside GKE Sandbox (`gVisor`), enforcing Pod Security Standards (`restricted` labeling) and pod securityContext, and mounting Secret Manager secrets via CSI (`SecretProviderClass`). Use when auditing workload security posture, isolating namespaces, applying pod security standards, or configuring network policies and secret volume mounts. Don't use for Workload Identity (use gke-workload-identity), cluster-wide control plane security, RBAC hardening, Binary Authorization, Shielded Nodes, or enabling platform-level GKE add-ons (use gke-platform-security instead).
gke-workload-scaling
Manages scaling for GKE workloads using HPA and VPA. Use when configuring Horizontal Pod Autoscaler (HPA), configuring Vertical Pod Autoscaler (VPA), or applying best practices for GKE workload autoscaling. Do not use for cluster-level autoscaling (Cluster Autoscaler), static cluster sizing, or configuring node-level machine styles directly.
gke-workload-identity
Configures and diagnoses Workload Identity Federation for GKE authentication failures for Pods (403 "iam.serviceAccounts.getAccessToken" / permission denied, "could not find default credentials", or GKE metadata server unreachable) by verifying cluster and node-pool Workload Identity configuration, the Kubernetes ServiceAccount (KSA) to IAM binding (direct principal binding and legacy Google ServiceAccount impersonation), target-resource IAM roles, and gke-metadata-server health. Use when setting up KSA/GSA bindings (`roles/iam.workloadIdentityUser`, `iam.gke.io/gcp-service-account`) or when a Pod cannot authenticate to Google Cloud APIs. Don't use for in-cluster Kubernetes RBAC errors (API-server authorization), general workload crashes (use gke-workload-troubleshooting), or Pod Security Standards and NetworkPolicies (use gke-workload-security).
gke-upgrades
Plans, executes, and validates Google Kubernetes Engine (GKE) cluster upgrades and maintenance operations for both Standard and Autopilot clusters. Produces upgrade plans, pre/post-upgrade checklists, maintenance runbooks with gcloud commands, release channel strategy, and troubleshooting guides. Handles node pool upgrade strategies (surge, blue-green), version compatibility, PDB management, and workload-specific concerns (stateful, GPU, operators). Use this skill whenever the user mentions GKE upgrades, Kubernetes version bumps, node pool maintenance, GKE patching, cluster version management, release channel selection, maintenance windows, surge upgrades, stuck upgrades, or any GKE lifecycle management task — even casual mentions like "we need to upgrade our clusters" or "plan our next GKE maintenance" or "our upgrade is stuck." Don't use for GKE cluster creation, application onboarding, general networking/routing setup, or security policy configurations (use gke-basics or relevant GKE skills instead).
gke-tpu-metrics-monitoring
Monitors and troubleshoots GKE TPU workloads, nodes, and node pools using GKE system metrics and PromQL. Use when monitoring TensorCore duty cycle, TPU memory, node readiness, multi-host TPU node pool availability, host maintenance or preemption interruptions, and calculating MTTR or MTBI metrics for GKE TPUs. Don't use for general non-TPU GKE workload monitoring or non-metric TPU debugging.