Initial scaffold: generation-rule-only Crossplane Bucket example
Educational RunWhen CodeCollection that discovers Crossplane GCP Bucket CRDs (storage.gcp.upbound.io/v1beta1) and generates one SLX per bucket. Ships only generation rules and Jinja templates; the runtime lives in rw-generic-codecollection/k8s-kubectl-cmd (already loaded by the airgap runner). Includes: - codebundles/gcp-bucket-crossplane-health with generation rule + 3 templates - docs/01..07 numbered training chapters with screenshot placeholders - README, .gitignore Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+50
@@ -0,0 +1,50 @@
|
||||
apiVersion: runwhen.com/v1
|
||||
kind: ServiceLevelIndicator
|
||||
metadata:
|
||||
name: {{slx_name}}
|
||||
labels:
|
||||
{% include "common-labels.yaml" %}
|
||||
annotations:
|
||||
{% include "common-annotations.yaml" %}
|
||||
spec:
|
||||
displayUnitsLong: Percentage
|
||||
displayUnitsShort: '%'
|
||||
locations:
|
||||
- {{default_location}}
|
||||
description: >-
|
||||
Fraction of Crossplane .status.conditions[] that are True for
|
||||
GCP Bucket {{match_resource.resource.metadata.name}}. Healthy = 1.0.
|
||||
# NOTE: This SLI runs from a *different* codecollection than the one
|
||||
# that owns this generation rule. The generic runtime (`k8s-kubectl-cmd`)
|
||||
# lives in `rw-generic-codecollection` — it is already loaded by the
|
||||
# airgap runner. If you move this example to another environment,
|
||||
# change `repoUrl` to wherever `rw-generic-codecollection` is served
|
||||
# (public GitHub, an internal proxy, a Gitea mirror, etc.).
|
||||
codeBundle:
|
||||
repoUrl: http://rw-airgap-cc-catalog-svc.runwhen-env-airgap:8080/git/rw-generic-codecollection.git
|
||||
ref: main
|
||||
pathToRobot: codebundles/k8s-kubectl-cmd/sli.robot
|
||||
intervalStrategy: intermezzo
|
||||
intervalSeconds: 300
|
||||
configProvided:
|
||||
- name: TASK_TITLE
|
||||
value: 'Crossplane GCP Bucket {{match_resource.resource.metadata.name}} condition health'
|
||||
# jq computes truthyConditions / totalConditions. Returns 0 when the
|
||||
# resource has never reconciled (no conditions yet), which correctly
|
||||
# signals "unhealthy" to the SLO layer.
|
||||
- name: KUBECTL_COMMAND
|
||||
value: |
|
||||
kubectl get buckets.storage.gcp.upbound.io {{match_resource.resource.metadata.name}} -o json | jq -r '(.status.conditions // []) as $c | if ($c|length)==0 then 0 else ([$c[]|select(.status=="True")]|length)/($c|length) end'
|
||||
- name: TIMEOUT_SECONDS
|
||||
value: '120'
|
||||
secretsProvided:
|
||||
{% if wb_version %}
|
||||
{% include "kubernetes-auth.yaml" ignore missing %}
|
||||
{% else %}
|
||||
- name: kubeconfig
|
||||
workspaceKey: {{custom.kubeconfig_secret_name}}
|
||||
{% endif %}
|
||||
alertConfig:
|
||||
tasks:
|
||||
persona: eager-edgar
|
||||
sessionTTL: 10m
|
||||
Reference in New Issue
Block a user