alirezarezvani/claude-skills / engineering/skills/kubernetes-operator
kubernetes-operator
VerifiedUse when building a Kubernetes operator or CRD (controller-runtime, kubebuilder, operator-sdk, KOPF), before writing the controller. Validates CRDs with crd_validator.py, lints reconcile loops with reconcile_lint.py and scores OperatorHub capability level.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 10.7 KB |
| assets/crd_template.yaml | config | 2.6 KB |
| assets/reconcile_skeleton.go | script | 4.0 KB |
| references/crd_design.md | markdown | 6.8 KB |
| references/operator_pattern.md | markdown | 7.0 KB |
| references/reconcile_loop.md | markdown | 7.1 KB |
| references/tooling_landscape.md | markdown | 7.5 KB |
| scripts/crd_validator.pyexecutable | script | 5.8 KB |
| scripts/operator_capability_audit.pyexecutable | script | 5.8 KB |
| scripts/reconcile_lint.pyexecutable | script | 6.3 KB |
scripts/operator_capability_audit.py
View on GitHub#!/usr/bin/env python3
"""Score an operator against OperatorHub Capability Levels (1-5).
Walks an operator repo and detects evidence for each level. Level achieved =
highest level for which all required signals are present. Reports next-level
gaps as concrete advancement steps.
Levels:
L1 Basic Install — CRD + controller + Deployment manifest
L2 Seamless Upgrades — version conversion + PDB + leader election
L3 Full Lifecycle — backup/restore + finalizers + status conditions
L4 Deep Insights — /metrics endpoint + Prometheus rules
L5 Auto Pilot — HPA / VPA / autotuning logic referenced
"""
import argparse
import json
import os
import re
import sys
SIGNALS = {
"L1": [
("crd_present", lambda files, contents: any("CustomResourceDefinition" in c for c in contents.values())),
("deployment_present", lambda files, contents: any(re.search(r"^kind:\s*Deployment", c, re.MULTILINE) for c in contents.values())),
("controller_code", lambda files, contents: any(p.endswith(".go") and "Reconcile" in c for p, c in contents.items())),
],
"L2": [
("conversion_webhook", lambda files, contents: any("conversion" in c.lower() and "webhook" in c.lower() for c in contents.values())),
("leader_election", lambda files, contents: any("LeaderElection" in c or "leader-elect" in c for c in contents.values())),
("pdb_present", lambda files, contents: any(re.search(r"kind:\s*PodDisruptionBudget", c) for c in contents.values())),
],
"L3": [
("finalizers", lambda files, contents: any("Finalizer" in c or "finalizers" in c for c in contents.values())),
("status_conditions", lambda files, contents: any("metav1.Condition" in c or "SetStatusCondition" in c for c in contents.values())),
("backup_restore_hint", lambda files, contents: any(re.search(r"\b(backup|restore|snapshot)\b", c, re.IGNORECASE) for c in contents.values())),
],
"L4": [
("metrics_endpoint", lambda files, contents: any(re.search(r"/metrics|prometheus", c) for c in contents.values())),
("prometheus_rules", lambda files, contents: any(re.search(r"PrometheusRule|alert:", c) for c in contents.values())),
],
"L5": [
("autoscaling_referenced", lambda files, contents: any(re.search(r"\bHorizontalPodAutoscaler|VerticalPodAutoscaler|autoscal", c) for c in contents.values())),
("autotune_logic", lambda files, contents: any(re.search(r"autotune|self-heal|anomaly", c, re.IGNORECASE) for c in contents.values())),
],
}
LEVEL_NAMES = {
"L1": "Basic Install",
"L2": "Seamless Upgrades",
"L3": "Full Lifecycle",
"L4": "Deep Insights",
"L5": "Auto Pilot",
}
SCAN_EXTS = {".go", ".yaml", ".yml", ".md"}
SKIP_DIRS = {".git", "node_modules", "vendor", "bin", "dist", "__pycache__"}
def _walk(root):
files = {}
for r, dirs, fnames in os.walk(root):
dirs[:] = [d for d in dirs if d not in SKIP_DIRS]
for f in fnames:
if os.path.splitext(f)[1] in SCAN_EXTS:
p = os.path.join(r, f)
try:
with open(p, "r", encoding="utf-8", errors="replace") as fh:
files[p] = fh.read()
except OSError:
continue
return files
def evaluate(operator_dir):
contents = _walk(operator_dir)
file_paths = list(contents.keys())
results = {}
achieved_max = None
for level in ["L1", "L2", "L3", "L4", "L5"]:
signals = SIGNALS[level]
passing = []
failing = []
for key, check in signals:
ok = check(file_paths, contents)
(passing if ok else failing).append(key)
all_pass = len(failing) == 0
results[level] = {
"name": LEVEL_NAMES[level],
"passing": passing,
"missing": failing,
"achieved": all_pass,
}
if all_pass:
achieved_max = level
else:
break
return {"current_level": achieved_max, "details": results}
def render_text(report, operator_dir):
print(f"Operator Capability Audit — {operator_dir}")
current = report["current_level"]
if current is None:
print("Current level: BELOW_L1 (no operator structure detected)")
else:
print(f"Current level: {current} — {LEVEL_NAMES[current]}")
print("")
for level in ["L1", "L2", "L3", "L4", "L5"]:
d = report["details"].get(level)
if d is None:
continue
marker = "✓" if d["achieved"] else "✗"
print(f" {marker} {level} {d['name']}: pass={len(d['passing'])} miss={len(d['missing'])}")
for k in d["missing"]:
print(f" - missing: {k}")
print("")
next_level = None
for lv in ["L1", "L2", "L3", "L4", "L5"]:
if lv == current:
continue
if not report["details"].get(lv, {}).get("achieved"):
next_level = lv
break
if next_level:
misses = report["details"][next_level]["missing"]
print(f"Next: advance to {next_level} ({LEVEL_NAMES[next_level]}) by addressing:")
for k in misses:
print(f" - {k}")
def main():
ap = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
ap.add_argument("--operator-dir", required=True, help="Path to operator repo root")
ap.add_argument("--format", choices=["text", "json"], default="text")
args = ap.parse_args()
if not os.path.isdir(args.operator_dir):
print(f"ERROR: not a directory: {args.operator_dir}", file=sys.stderr)
return 2
report = evaluate(args.operator_dir)
if args.format == "json":
print(json.dumps(report, indent=2))
else:
render_text(report, args.operator_dir)
return 0
if __name__ == "__main__":
sys.exit(main())
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deployment | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |