@intentius/behold 0.5.0 → 0.6.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.
- package/demos.json +9 -0
- package/dist/cli.js +5 -2
- package/example-flux-estate/README.md +41 -0
- package/example-flux-estate/app-a/chant.config.ts +18 -0
- package/example-flux-estate/app-a/manifests/app.yaml +56 -0
- package/example-flux-estate/app-a/package.json +13 -0
- package/example-flux-estate/app-a/src/app.ts +35 -0
- package/example-flux-estate/app-a/tsconfig.json +1 -0
- package/example-flux-estate/app-b/chant.config.ts +20 -0
- package/example-flux-estate/app-b/manifests/app.yaml +54 -0
- package/example-flux-estate/app-b/package.json +13 -0
- package/example-flux-estate/app-b/src/app.ts +37 -0
- package/example-flux-estate/app-b/tsconfig.json +1 -0
- package/example-flux-estate/control-plane/chant.config.ts +19 -0
- package/example-flux-estate/control-plane/package.json +13 -0
- package/example-flux-estate/control-plane/src/flux.ts +51 -0
- package/example-flux-estate/control-plane/tsconfig.json +1 -0
- package/example-flux-estate/package-lock.json +1949 -0
- package/example-flux-estate/package.json +10 -0
- package/example-flux-estate/scripts/estate-down.sh +19 -0
- package/example-flux-estate/scripts/estate-up.sh +61 -0
- package/package.json +2 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Tear the flux-estate demo down: delete the uniquely-named cluster and
|
|
3
|
+
# restore whatever kubectl context was current before estate-up.sh switched it.
|
|
4
|
+
set -euo pipefail
|
|
5
|
+
cd "$(dirname "$0")/.."
|
|
6
|
+
|
|
7
|
+
CLUSTER=behold-flux-demo
|
|
8
|
+
STATE="scripts/.prev-context"
|
|
9
|
+
|
|
10
|
+
k3d cluster delete "$CLUSTER" 2>/dev/null || echo "flux-estate demo: no ${CLUSTER} cluster to remove."
|
|
11
|
+
if [ -f "$STATE" ]; then
|
|
12
|
+
prev="$(cat "$STATE")"
|
|
13
|
+
if [ -n "$prev" ] && kubectl config get-contexts -o name 2>/dev/null | grep -qx "$prev"; then
|
|
14
|
+
kubectl config use-context "$prev" >/dev/null
|
|
15
|
+
echo "flux-estate demo: restored kubectl context \"$prev\"."
|
|
16
|
+
fi
|
|
17
|
+
rm -f "$STATE"
|
|
18
|
+
fi
|
|
19
|
+
echo "flux-estate demo: cluster removed."
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# Stand up the flux-estate demo (#211): a throwaway single-node k3d cluster,
|
|
3
|
+
# Flux's controllers (applied straight from the pinned release manifest — no
|
|
4
|
+
# flux CLI needed), and the control plane's CRs. From there the reconcilers
|
|
5
|
+
# deploy the app projects out of behold's public repo.
|
|
6
|
+
#
|
|
7
|
+
# Safety, same contract as example-k8s: never touches any OTHER kubeconfig
|
|
8
|
+
# context. Whatever context is current is saved to .prev-context and restored
|
|
9
|
+
# by estate-down.sh; the cluster and its context are uniquely named
|
|
10
|
+
# (behold-flux-demo / k3d-behold-flux-demo).
|
|
11
|
+
#
|
|
12
|
+
# BEHOLD_FLUX_REF (optional): patch the LIVE GitRepository to sync a branch
|
|
13
|
+
# other than main — how a not-yet-merged manifests change is verified. The
|
|
14
|
+
# declared source always says main.
|
|
15
|
+
set -euo pipefail
|
|
16
|
+
cd "$(dirname "$0")/.."
|
|
17
|
+
|
|
18
|
+
CLUSTER=behold-flux-demo
|
|
19
|
+
CONTEXT="k3d-${CLUSTER}"
|
|
20
|
+
STATE="scripts/.prev-context"
|
|
21
|
+
FLUX_MANIFEST="https://github.com/fluxcd/flux2/releases/download/v2.4.0/install.yaml"
|
|
22
|
+
|
|
23
|
+
if ! docker info >/dev/null 2>&1; then
|
|
24
|
+
echo "flux-estate demo: Docker is not running — start Docker and re-run." >&2
|
|
25
|
+
exit 1
|
|
26
|
+
fi
|
|
27
|
+
for bin in k3d kubectl; do
|
|
28
|
+
if ! command -v "$bin" >/dev/null 2>&1; then
|
|
29
|
+
echo "flux-estate demo: $bin is not installed." >&2
|
|
30
|
+
exit 1
|
|
31
|
+
fi
|
|
32
|
+
done
|
|
33
|
+
|
|
34
|
+
if ! k3d cluster list 2>/dev/null | grep -q "^${CLUSTER} "; then
|
|
35
|
+
kubectl config current-context > "$STATE" 2>/dev/null || true
|
|
36
|
+
k3d cluster create "$CLUSTER" --wait
|
|
37
|
+
else
|
|
38
|
+
echo "flux-estate demo: cluster ${CLUSTER} already up — reusing."
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
echo "flux-estate demo: installing Flux controllers (${FLUX_MANIFEST##*/download/})…"
|
|
42
|
+
kubectl --context "$CONTEXT" apply -f "$FLUX_MANIFEST" > /dev/null
|
|
43
|
+
kubectl --context "$CONTEXT" -n flux-system rollout status deploy/source-controller --timeout=180s
|
|
44
|
+
kubectl --context "$CONTEXT" -n flux-system rollout status deploy/kustomize-controller --timeout=180s
|
|
45
|
+
|
|
46
|
+
echo "flux-estate demo: building + applying the control plane's CRs…"
|
|
47
|
+
(cd control-plane && npx chant build src -o dist/control-plane.yaml --format yaml)
|
|
48
|
+
kubectl --context "$CONTEXT" apply -f control-plane/dist/control-plane.yaml
|
|
49
|
+
|
|
50
|
+
if [ -n "${BEHOLD_FLUX_REF:-}" ]; then
|
|
51
|
+
echo "flux-estate demo: syncing branch ${BEHOLD_FLUX_REF} instead of main (BEHOLD_FLUX_REF)"
|
|
52
|
+
kubectl --context "$CONTEXT" -n flux-system patch gitrepository behold --type merge \
|
|
53
|
+
-p "{\"spec\":{\"ref\":{\"branch\":\"${BEHOLD_FLUX_REF}\"}}}"
|
|
54
|
+
fi
|
|
55
|
+
|
|
56
|
+
echo "flux-estate demo: waiting for the reconcilers to deploy the apps…"
|
|
57
|
+
kubectl --context "$CONTEXT" -n flux-system wait --for=condition=Ready --timeout=180s gitrepository/behold
|
|
58
|
+
kubectl --context "$CONTEXT" -n flux-system wait --for=condition=Ready --timeout=180s kustomization/app-a kustomization/app-b
|
|
59
|
+
kubectl --context "$CONTEXT" -n app-a rollout status deploy/app-a --timeout=180s
|
|
60
|
+
kubectl --context "$CONTEXT" -n app-b rollout status deploy/app-b --timeout=180s
|
|
61
|
+
echo "flux-estate demo: up — Flux deployed both apps from the repo."
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intentius/behold",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "behold — a live control plane on chant. See your whole estate (every substrate in one graph), coloured by drift; act through delegated, gated Ops.",
|
|
6
6
|
"bin": {
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"web",
|
|
13
13
|
"example-writes",
|
|
14
14
|
"example-k8s",
|
|
15
|
+
"example-flux-estate",
|
|
15
16
|
"demos.json",
|
|
16
17
|
"AGENTS.md"
|
|
17
18
|
],
|