sdtk-ops-kit 0.3.3 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +2 -1
  2. package/assets/manifest/toolkit-bundle.manifest.json +144 -19
  3. package/assets/manifest/toolkit-bundle.sha256.txt +35 -10
  4. package/assets/toolkit/toolkit/AGENTS.md +2 -1
  5. package/assets/toolkit/toolkit/SDTKOPS_TOOLKIT.md +4 -2
  6. package/assets/toolkit/toolkit/scripts/install-claude-skills.ps1 +4 -4
  7. package/assets/toolkit/toolkit/scripts/install-codex-skills.ps1 +4 -4
  8. package/assets/toolkit/toolkit/scripts/uninstall-claude-skills.ps1 +2 -2
  9. package/assets/toolkit/toolkit/scripts/uninstall-codex-skills.ps1 +2 -2
  10. package/assets/toolkit/toolkit/skills/ops-discover/SKILL.md +2 -0
  11. package/assets/toolkit/toolkit/skills/ops-framer-deploy/SKILL.md +15 -1
  12. package/assets/toolkit/toolkit/skills/ops-framer-deploy/package.json +10 -0
  13. package/assets/toolkit/toolkit/skills/ops-framer-deploy/scripts/framer-install.mjs +5 -1
  14. package/assets/toolkit/toolkit/skills/ops-framer-deploy/scripts/lib/config.mjs +6 -0
  15. package/assets/toolkit/toolkit/skills/ops-local-env/SKILL.md +172 -0
  16. package/assets/toolkit/toolkit/skills/ops-local-env/references/CLUSTER_CA.md +83 -0
  17. package/assets/toolkit/toolkit/skills/ops-local-env/references/GOTCHAS.md +17 -0
  18. package/assets/toolkit/toolkit/skills/ops-local-env/references/K3D_CILIUM_BOOTSTRAP.md +39 -0
  19. package/assets/toolkit/toolkit/skills/ops-local-env/references/PROFILE.md +44 -0
  20. package/assets/toolkit/toolkit/skills/ops-local-env/references/bootstrap/cilium-values.yaml +37 -0
  21. package/assets/toolkit/toolkit/skills/ops-local-env/references/bootstrap/k3d-cluster.yaml +37 -0
  22. package/assets/toolkit/toolkit/skills/ops-local-env/references/profile.example.json +80 -0
  23. package/assets/toolkit/toolkit/skills/ops-local-env/scripts/admin_creds.py +212 -0
  24. package/assets/toolkit/toolkit/skills/ops-local-env/scripts/cilium_heal.py +136 -0
  25. package/assets/toolkit/toolkit/skills/ops-local-env/scripts/ensure_repos.py +69 -0
  26. package/assets/toolkit/toolkit/skills/ops-local-env/scripts/envprofile.py +139 -0
  27. package/assets/toolkit/toolkit/skills/ops-local-env/scripts/explain_config.py +116 -0
  28. package/assets/toolkit/toolkit/skills/ops-local-env/scripts/health.py +109 -0
  29. package/assets/toolkit/toolkit/skills/ops-local-env/scripts/hosts_entry.py +158 -0
  30. package/assets/toolkit/toolkit/skills/ops-local-env/scripts/init_profile.py +217 -0
  31. package/assets/toolkit/toolkit/skills/ops-local-env/scripts/k3d_images.py +70 -0
  32. package/assets/toolkit/toolkit/skills/ops-local-env/scripts/preflight.py +96 -0
  33. package/assets/toolkit/toolkit/skills/ops-local-env/scripts/registry_secret.py +64 -0
  34. package/assets/toolkit/toolkit/skills/ops-local-env/scripts/shared_config.py +178 -0
  35. package/assets/toolkit/toolkit/skills/ops-local-env/scripts/stack_plan.py +94 -0
  36. package/assets/toolkit/toolkit/skills/ops-local-env/scripts/teardown.py +86 -0
  37. package/assets/toolkit/toolkit/skills/ops-local-env/scripts/test_local_env.py +307 -0
  38. package/assets/toolkit/toolkit/skills/ops-local-env/scripts/trust_ca.py +153 -0
  39. package/package.json +1 -1
  40. package/src/lib/scope.js +1 -0
@@ -0,0 +1,64 @@
1
+ #!/usr/bin/env python3
2
+ """registry_secret.py - create or update the image pull secret of the profile's `registry`
3
+ (`pull_secret`, default `registry-pull`) in a namespace of the current kube context, from the token in
4
+ `registry.token_env`. The token never reaches stdout, a file or a command line: the Secret is built in
5
+ memory and piped to `kubectl apply -f -`.
6
+
7
+ The username is `registry.username`, or -- for a GitHub token (`kind: github-classic-pat`) -- the
8
+ token's own GitHub login.
9
+
10
+ registry_secret.py NAMESPACE [--profile FILE] [--root DIR]
11
+ """
12
+
13
+ from __future__ import annotations
14
+
15
+ import argparse
16
+ import base64
17
+ import json
18
+ import os
19
+ import subprocess
20
+ import sys
21
+ import urllib.request
22
+
23
+ from envprofile import Stack, add_common_args, fail
24
+
25
+
26
+ def main() -> int:
27
+ parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
28
+ add_common_args(parser)
29
+ parser.add_argument("namespace")
30
+ args = parser.parse_args()
31
+ reg = Stack(args.profile, args.root).get("registry") or {}
32
+ env, host = reg.get("token_env"), reg.get("host")
33
+ if not env or not host:
34
+ return fail("error: the profile's registry needs host and token_env")
35
+ token = os.environ.get(env)
36
+ if not token:
37
+ return fail(f"error: {env} is not set; run preflight.py")
38
+ if subprocess.run(["kubectl", "get", "namespace", args.namespace], capture_output=True, check=False).returncode:
39
+ return fail(f"error: namespace {args.namespace} not found in the current context")
40
+ user = reg.get("username")
41
+ if not user and reg.get("kind") == "github-classic-pat":
42
+ req = urllib.request.Request("https://api.github.com/user", headers={"Authorization": f"token {token}"})
43
+ try:
44
+ with urllib.request.urlopen(req, timeout=20) as resp:
45
+ user = json.loads(resp.read())["login"]
46
+ except OSError:
47
+ return fail(f"error: GitHub refused {env}; run preflight.py")
48
+ if not user:
49
+ return fail("error: set registry.username in the profile")
50
+ b64 = lambda s: base64.b64encode(s.encode()).decode()
51
+ config = json.dumps({"auths": {host: {"username": user, "auth": b64(f"{user}:{token}")}}})
52
+ name = reg.get("pull_secret") or "registry-pull"
53
+ secret = {"apiVersion": "v1", "kind": "Secret", "type": "kubernetes.io/dockerconfigjson",
54
+ "metadata": {"name": name, "namespace": args.namespace}, "data": {".dockerconfigjson": b64(config)}}
55
+ run = subprocess.run(["kubectl", "apply", "--server-side", "--force-conflicts", "-f", "-"],
56
+ input=json.dumps(secret), text=True, capture_output=True, check=False)
57
+ if run.returncode:
58
+ return fail(run.stderr)
59
+ print(f"{name} in {args.namespace}: {host}, user {user}")
60
+ return 0
61
+
62
+
63
+ if __name__ == "__main__":
64
+ sys.exit(main())
@@ -0,0 +1,178 @@
1
+ #!/usr/bin/env python3
2
+ """shared_config.py - show and set the values every config file of the stack must agree on.
3
+
4
+ Each repository keeps its own config file, but the profile's `shared_keys` have the same meaning
5
+ and must hold the same value everywhere (namespaces, base domain, TLS subject, database name, ...):
6
+ they drive certificate SANs, Ingress hosts and secret names.
7
+
8
+ shared_config.py --show # table per key and config, MISMATCH flagged (exit 1)
9
+ shared_config.py --set KEY=VALUE [...] # dry run: diff of the lines that would change
10
+ shared_config.py --set KEY=VALUE [...] --apply
11
+
12
+ Profile keys used (references/PROFILE.md): `configs`, `primary_config`, `shared_keys`,
13
+ `base_domain_key` (default base_domain), `aliases` (a shared key stored under another name, or not
14
+ at all, in one config), `indented_followers` (indented lines, e.g. `namespace:` in a list, that hold
15
+ a shared key's value and follow it), `validators` (extra regexes).
16
+
17
+ Every other `*_domain` key is one label under the base domain -- the certificate covers base and
18
+ *.base only. --set <base_domain>=NEW moves each of them, in every config, to <first label>.NEW;
19
+ --show flags one that is not. --set edits only the value on the existing `key: "value" # comment`
20
+ line (comments and alignment kept), reads it back, and never rewrites a file with a YAML dumper.
21
+ """
22
+
23
+ from __future__ import annotations
24
+
25
+ import argparse
26
+ import difflib
27
+ import re
28
+ import sys
29
+
30
+ from envprofile import FQDN_RX, NAMESPACE_RX, Stack, add_common_args, fail, load_flat, set_line, under
31
+
32
+ DOMAIN_LINE = re.compile(r'^([a-z0-9_]+_domain):[ \t]*"?([A-Za-z0-9.-]*)"?', re.M)
33
+
34
+
35
+ class Shared:
36
+ def __init__(self, stack: Stack):
37
+ self.stack = stack
38
+ self.keys: list[str] = list(stack.get("shared_keys") or [])
39
+ self.base_key = stack.get("base_domain_key") or "base_domain"
40
+ self.aliases = {(a["config"], a["key"]): a.get("file_key") for a in stack.get("aliases") or []}
41
+ for (_, key) in list(self.aliases):
42
+ if key not in self.keys:
43
+ self.keys.append(key)
44
+ self.followers = stack.get("indented_followers") or []
45
+ self.validators = dict(stack.get("validators") or {})
46
+
47
+ def file_key(self, config: str, key: str) -> str | None:
48
+ return self.aliases.get((config, key), key)
49
+
50
+ def validator(self, key: str) -> str | None:
51
+ if key in self.validators:
52
+ return self.validators[key]
53
+ if key.endswith("_namespace") or key.endswith("_name") or key == "apps_namespace":
54
+ return NAMESPACE_RX
55
+ if key.endswith("_domain"):
56
+ return FQDN_RX
57
+ if key == "ssl_country":
58
+ return r"^[A-Z]{2}$"
59
+ return None
60
+
61
+
62
+ def domain_keys(text: str, base_key: str) -> dict[str, str]:
63
+ return {k: v for k, v in DOMAIN_LINE.findall(text) if k != base_key}
64
+
65
+
66
+ def follower_values(text: str, line_key: str) -> list[str]:
67
+ return re.findall(rf'^\s+-?\s*{re.escape(line_key)}:\s*"?([^"#\s]+)"?', text, re.M)
68
+
69
+
70
+ def show(sh: Shared) -> int:
71
+ st = sh.stack
72
+ present = [c for c, p in st.configs.items() if p.is_file()]
73
+ data = {c: load_flat(st.configs[c]) for c in present}
74
+ print(f"{'key':24} " + " ".join(f"{c:22}" for c in present))
75
+ bad = False
76
+ for key in sh.keys:
77
+ vals = {}
78
+ for c in present:
79
+ fk = sh.file_key(c, key)
80
+ if fk and data[c].get(fk) is not None:
81
+ vals[c] = str(data[c][fk])
82
+ if not vals:
83
+ continue
84
+ mismatch = len(set(vals.values())) > 1
85
+ bad |= mismatch
86
+ print(f"{key:24} " + " ".join(f"{vals.get(c, '-'):22}" for c in present) + (" MISMATCH" if mismatch else ""))
87
+ base = st.primary_value(sh.base_key) or ""
88
+ for c in present:
89
+ for key, value in domain_keys(st.configs[c].read_text(encoding="utf-8"), sh.base_key).items():
90
+ if value and not under(value, base):
91
+ bad = True
92
+ print(f"{c} {key}: {value} is not one label under {sh.base_key} {base} MISMATCH")
93
+ for f in sh.followers:
94
+ if f["config"] not in present:
95
+ continue
96
+ want = st.primary_value(f["follows"])
97
+ for v in follower_values(st.configs[f["config"]].read_text(encoding="utf-8"), f["line_key"]):
98
+ if v != want:
99
+ bad = True
100
+ print(f"{f['config']} indented {f['line_key']}: {v}, {f['follows']} is {want} MISMATCH")
101
+ for c, p in st.configs.items():
102
+ if not p.is_file():
103
+ print(f"(no config file for {c}: {p})")
104
+ return 1 if bad else 0
105
+
106
+
107
+ def set_values(sh: Shared, pairs: list[str], apply: bool) -> int:
108
+ st = sh.stack
109
+ updates: dict[str, str] = {}
110
+ for pair in pairs:
111
+ key, sep, value = pair.partition("=")
112
+ if not sep or key not in sh.keys:
113
+ return fail(f"error: {pair!r}: expected KEY=VALUE with KEY one of {', '.join(sh.keys)}")
114
+ rx = sh.validator(key)
115
+ if rx and not re.match(rx, value):
116
+ return fail(f"error: {key}={value!r} does not match {rx}")
117
+ updates[key] = value
118
+ base = updates.get(sh.base_key) or st.primary_value(sh.base_key) or ""
119
+ for key, value in updates.items():
120
+ if key.endswith("_domain") and key != sh.base_key and not under(value, base):
121
+ return fail(f"error: {key}={value!r} must be one label under {sh.base_key} {base!r}")
122
+ old_values = {k: st.primary_value(k) for k in updates}
123
+ changed = False
124
+ for config, path in st.configs.items():
125
+ if not path.is_file():
126
+ continue
127
+ old = path.read_text(encoding="utf-8")
128
+ new = old
129
+ cfg_updates = dict(updates)
130
+ if sh.base_key in updates:
131
+ for key, value in domain_keys(old, sh.base_key).items():
132
+ if key not in updates and value:
133
+ cfg_updates[key] = f"{value.split('.')[0]}.{updates[sh.base_key]}"
134
+ for key, value in cfg_updates.items():
135
+ fk = sh.file_key(config, key)
136
+ if fk:
137
+ new = set_line(new, fk, value)
138
+ for f in sh.followers:
139
+ if f["config"] == config and f["follows"] in updates and old_values.get(f["follows"]):
140
+ new = re.sub(rf'^(\s+-?\s*{re.escape(f["line_key"])}:\s*)"?{re.escape(old_values[f["follows"]])}"?(\s*(?:#.*)?)$',
141
+ lambda m: f'{m.group(1)}"{updates[f["follows"]]}"{m.group(2)}', new, flags=re.M)
142
+ if new == old:
143
+ continue
144
+ changed = True
145
+ sys.stdout.writelines(difflib.unified_diff(old.splitlines(True), new.splitlines(True),
146
+ f"{config}", f"{config}", n=0))
147
+ if apply:
148
+ path.write_text(new, encoding="utf-8")
149
+ back = load_flat(path)
150
+ for key, value in cfg_updates.items():
151
+ fk = sh.file_key(config, key)
152
+ if fk and fk in back and str(back[fk]) != value:
153
+ return fail(f"error: {path}: {fk} reads back as {back[fk]!r}, expected {value!r}")
154
+ if not changed:
155
+ print("nothing to change")
156
+ elif not apply:
157
+ print("\n(dry run; add --apply to write)")
158
+ return 0
159
+
160
+
161
+ def main() -> int:
162
+ parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
163
+ add_common_args(parser)
164
+ parser.add_argument("--show", action="store_true")
165
+ parser.add_argument("--set", nargs="+", metavar="KEY=VALUE")
166
+ parser.add_argument("--apply", action="store_true")
167
+ args = parser.parse_args()
168
+ sh = Shared(Stack(args.profile, args.root))
169
+ print(f"workspace: {sh.stack.root}")
170
+ if args.set:
171
+ return set_values(sh, args.set, args.apply)
172
+ if args.show:
173
+ return show(sh)
174
+ parser.error("pass --show or --set KEY=VALUE ...")
175
+
176
+
177
+ if __name__ == "__main__":
178
+ sys.exit(main())
@@ -0,0 +1,94 @@
1
+ #!/usr/bin/env python3
2
+ """stack_plan.py - check the profile and print the install plan: every component in order, the
3
+ repository it lives in, how it is installed (its own skill or a command), its config files, its gate
4
+ and its health checks.
5
+
6
+ stack_plan.py # the plan as a Markdown table, then the health checks
7
+ stack_plan.py --check # profile problems only (exit 1 when any)
8
+
9
+ Checks: required profile keys, configs and repos that are referenced but not declared, duplicate
10
+ component ids, `after` naming an unknown component or a later one, a component without a way to
11
+ install it, and config files missing in the workspace (a warning: a repository not cloned yet).
12
+ """
13
+
14
+ from __future__ import annotations
15
+
16
+ import argparse
17
+ import sys
18
+
19
+ from envprofile import Stack, add_common_args
20
+
21
+ REQUIRED = ("name", "repos", "configs", "components")
22
+
23
+
24
+ def problems(stack: Stack) -> tuple[list[str], list[str]]:
25
+ errors, warnings = [], []
26
+ for key in REQUIRED:
27
+ if not stack.get(key):
28
+ errors.append(f"missing `{key}`")
29
+ repos = {r.get("dir") for r in stack.get("repos") or []}
30
+ for name, path in stack.configs.items():
31
+ rel = path.relative_to(stack.root).parts[0]
32
+ if rel not in repos:
33
+ errors.append(f"config {name}: {path.relative_to(stack.root)} is in no declared repo")
34
+ elif not path.is_file():
35
+ warnings.append(f"config {name}: {path} not found (repository not cloned yet?)")
36
+ if stack.primary and stack.primary not in stack.configs:
37
+ errors.append(f"primary_config {stack.primary} is not in configs")
38
+ for item in stack.get("_todo") or []:
39
+ warnings.append(f"to review (_todo): {item}")
40
+ seen: list[str] = []
41
+ for comp in stack.get("components") or []:
42
+ cid = comp.get("id")
43
+ if not cid:
44
+ errors.append(f"component without id: {comp}")
45
+ continue
46
+ if cid in seen:
47
+ errors.append(f"component {cid}: duplicate id")
48
+ if comp.get("repo") and comp["repo"] not in repos:
49
+ errors.append(f"component {cid}: repo {comp['repo']} is not declared")
50
+ if not (comp.get("skill") or comp.get("run") or comp.get("steps")):
51
+ errors.append(f"component {cid}: needs `skill`, `run` or `steps`")
52
+ for dep in comp.get("after") or []:
53
+ if dep not in seen:
54
+ errors.append(f"component {cid}: after {dep}, which is not an earlier component")
55
+ for c in comp.get("configs") or []:
56
+ if c not in stack.configs:
57
+ errors.append(f"component {cid}: config {c} is not declared")
58
+ seen.append(cid)
59
+ return errors, warnings
60
+
61
+
62
+ def main() -> int:
63
+ parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
64
+ add_common_args(parser)
65
+ parser.add_argument("--check", action="store_true")
66
+ args = parser.parse_args()
67
+ stack = Stack(args.profile, args.root)
68
+ errors, warnings = problems(stack)
69
+ print(f"stack: {stack.name} profile: {stack.profile_path} workspace: {stack.root}")
70
+ for w in warnings:
71
+ print(f"WARNING: {w}")
72
+ for e in errors:
73
+ print(f"ERROR: {e}")
74
+ if args.check or errors:
75
+ return 1 if errors else 0
76
+ print("\n| # | component | repo | how | gate | configs |\n|---|---|---|---|---|---|")
77
+ for i, comp in enumerate(stack.get("components") or [], 1):
78
+ how = f"skill `{comp['skill']}`" if comp.get("skill") else (f"`{stack.expand(comp['run'])}`" if comp.get("run") else "steps (see profile)")
79
+ print(f"| {i} | {comp['id']} | {comp.get('repo', '-')} | {how} | {comp.get('gate', '-')} | "
80
+ f"{', '.join(comp.get('configs') or []) or '-'} |")
81
+ notes = [(c["id"], n) for c in stack.get("components") or [] for n in c.get("notes") or []]
82
+ if notes:
83
+ print("\nStack rules:")
84
+ for cid, note in notes:
85
+ print(f"- {cid}: {stack.expand(note)}")
86
+ print("\nHealthy when:")
87
+ for comp in stack.get("components") or []:
88
+ for check in comp.get("health") or []:
89
+ print(f"- {comp['id']}: `{check}`")
90
+ return 0
91
+
92
+
93
+ if __name__ == "__main__":
94
+ sys.exit(main())
@@ -0,0 +1,86 @@
1
+ #!/usr/bin/env python3
2
+ """teardown.py - delete the stack's local k3d cluster, and nothing else.
3
+
4
+ teardown.py # plan only: what would be deleted, what stays
5
+ teardown.py --apply --confirm <name> # delete it (the name typed again, exactly)
6
+
7
+ The cluster is the one the profile names (`cluster.name_key` in the primary config, e.g. the apps
8
+ namespace). It must be a local k3d cluster listed by `k3d cluster list`; any other kind of cluster or
9
+ context is refused. Everything in it goes (databases, buckets, queues, volumes): run it only after the
10
+ person has said so for this cluster.
11
+
12
+ Never touched: the repositories, config and secrets files, the local CA (ca.key stays per machine),
13
+ other k3d clusters and other kube contexts. Left for the person (printed): the hosts-file block
14
+ (`hosts_entry.py --remove`, elevated) and the CA in the system trust store.
15
+ """
16
+
17
+ from __future__ import annotations
18
+
19
+ import argparse
20
+ import json
21
+ import platform
22
+ import shutil
23
+ import subprocess
24
+ import sys
25
+
26
+ from envprofile import Stack, add_common_args
27
+
28
+
29
+ def k3d_clusters() -> list[dict]:
30
+ res = subprocess.run(["k3d", "cluster", "list", "-o", "json"], capture_output=True, text=True, check=False)
31
+ if res.returncode:
32
+ raise SystemExit(f"error: k3d cluster list failed: {res.stderr.strip()}")
33
+ return json.loads(res.stdout or "[]")
34
+
35
+
36
+ def main() -> int:
37
+ parser = argparse.ArgumentParser(description=__doc__, formatter_class=argparse.RawDescriptionHelpFormatter)
38
+ add_common_args(parser)
39
+ parser.add_argument("--apply", action="store_true")
40
+ parser.add_argument("--confirm", metavar="NAME", help="the cluster name again, required with --apply")
41
+ args = parser.parse_args()
42
+ stack = Stack(args.profile, args.root)
43
+ conf = stack.get("cluster") or {}
44
+ if conf.get("kind", "k3d") != "k3d":
45
+ print(f"error: cluster kind {conf.get('kind')!r}: this script only deletes local k3d clusters", file=sys.stderr)
46
+ return 1
47
+ name = stack.primary_value(conf.get("name_key", "apps_namespace"))
48
+ if not name:
49
+ print("error: the profile does not name the cluster (cluster.name_key in the primary config)", file=sys.stderr)
50
+ return 1
51
+ if not shutil.which("k3d"):
52
+ print("error: k3d is not on PATH", file=sys.stderr)
53
+ return 1
54
+ clusters = {c.get("name"): c for c in k3d_clusters()}
55
+ print(f"stack: {stack.name} cluster: {name} context: k3d-{name}")
56
+ if name not in clusters:
57
+ print(f"nothing to delete: no k3d cluster {name!r} (k3d clusters here: {', '.join(clusters) or 'none'})")
58
+ return 0
59
+ nodes = [n.get("name") for n in clusters[name].get("nodes") or []]
60
+ print(f"would delete: k3d cluster {name} ({len(nodes)} nodes: {', '.join(nodes)}) and everything in it")
61
+ others = sorted(set(clusters) - {name})
62
+ print(f"stays: repositories, config / secrets files, the local CA, "
63
+ f"other k3d clusters ({', '.join(others) or 'none'}), other kube contexts")
64
+ if not args.apply:
65
+ print(f"\nplan only. To delete, after the person agreed: teardown.py --apply --confirm {name}")
66
+ return 0
67
+ if args.confirm != name:
68
+ print(f"error: --confirm must be exactly {name!r}", file=sys.stderr)
69
+ return 1
70
+ res = subprocess.run(["k3d", "cluster", "delete", name], capture_output=True, text=True, check=False)
71
+ if res.returncode:
72
+ print(f"error: k3d cluster delete failed: {res.stderr.strip()}", file=sys.stderr)
73
+ return 1
74
+ if name in {c.get("name") for c in k3d_clusters()}:
75
+ print(f"error: {name} is still listed after the delete", file=sys.stderr)
76
+ return 1
77
+ print(f"deleted: k3d cluster {name}")
78
+ elevated = "elevated PowerShell: python" if platform.system() == "Windows" else "sudo python3"
79
+ print("left for the person (elevated):\n"
80
+ f" hosts block: {elevated} hosts_entry.py --profile \"{stack.profile_path}\" --remove\n"
81
+ " CA trust: remove it only if no other cluster of this stack is used (trust_ca.py --show names it)")
82
+ return 0
83
+
84
+
85
+ if __name__ == "__main__":
86
+ sys.exit(main())