Files
simple-private-codecollection/codebundles/gcp-bucket-crossplane-health/.runwhen/generation-rules/gcp-bucket-crossplane-health.yaml
T
stewartshea fe0946a146 Fix Crossplane Bucket generation rule to use plural resource name
Revert the earlier typo that changed the resourceTypes entry from
`buckets.storage.gcp.upbound.io` to `bucket.storage.gcp.upbound.io`
under the mistaken rationale of "consistency with preferred API
version". Kubernetes resource type specs in generation rules use the
API plural name (as reported by `kubectl api-resources`), which for
this CRD is `buckets`.

Confirmed against the live cluster:
    kubectl api-resources --api-group=storage.gcp.upbound.io
        NAME=buckets  NAMESPACED=false  KIND=Bucket

Symptom of the typo (from workspace-builder logs, image
`806-merge-343c86e3`):
    Trying custom resource bucket.storage.gcp.upbound.io
    Error scanning for custom resource instances; error: (403)

The 403 was misleading — it isn't an RBAC problem (the ClusterRole
correctly grants get/list/watch on `buckets`); it's the API server
rejecting a call for a resource type that doesn't exist. The
scope-aware discovery from runwhen-local PR #806 is working; it
just had the wrong plural to look up.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-30 22:53:57 -04:00

38 lines
1.6 KiB
YAML

apiVersion: runwhen.com/v1
kind: GenerationRules
spec:
platform: kubernetes
generationRules:
# Discover every Crossplane GCP Bucket in the cluster.
# Resource type syntax: plural.group[/version]
# plural = buckets (from `kubectl api-resources | grep storage.gcp.upbound.io`)
# group = storage.gcp.upbound.io
# version = omitted (use the API server's preferred version — currently v1beta2)
#
# Pin an explicit version like `buckets.storage.gcp.upbound.io/v1beta1`
# if you need schema stability across CRD upgrades.
- resourceTypes:
- buckets.storage.gcp.upbound.io
matchRules:
# Match every Bucket by name. Swap this regex to scope by naming
# convention (for example `^prod-.*` to only cover prod buckets) or
# use `type: exists` on a label like `metadata/labels/env`.
- type: pattern
pattern: ".+"
properties: [name]
mode: substring
slxs:
# Crossplane Buckets are cluster-scoped, so we qualify by `resource`
# (the bucket name) and `cluster` only — there is no namespace.
- baseName: xp-bkt-hlth
qualifiers: ["resource", "cluster"]
baseTemplateName: gcp-bucket-crossplane-health
levelOfDetail: detailed
outputItems:
- type: slx
- type: sli
- type: runbook
# Runbook uses the *-taskset.yaml template convention because
# RunWhen historically calls a Runbook a "TaskSet" in the UI.
templateName: gcp-bucket-crossplane-health-taskset.yaml