@intentius/behold 0.4.1 → 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/README.md +4 -0
- package/demos.json +39 -0
- package/dist/cli.js +147 -40
- 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/example-k8s/README.md +120 -0
- package/example-k8s/chant.config.ts +21 -0
- package/example-k8s/ops/k3d-apply.op.ts +18 -0
- package/example-k8s/package-lock.json +2071 -0
- package/example-k8s/package.json +14 -0
- package/example-k8s/scripts/local/local-down.sh +23 -0
- package/example-k8s/scripts/local/local-up.sh +46 -0
- package/example-k8s/src/config.ts +5 -0
- package/example-k8s/src/web.ts +29 -0
- package/example-k8s/tsconfig.json +1 -0
- package/package.json +4 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ChantConfig } from "@intentius/chant";
|
|
2
|
+
import type { K8sChantConfig } from "@intentius/chant-lexicon-k8s";
|
|
3
|
+
|
|
4
|
+
// The estate's control plane: it declares the Flux machinery (GitRepository +
|
|
5
|
+
// one Kustomization per app), and the reconcilers deploy the app projects —
|
|
6
|
+
// this project never applies a workload itself. Bound to the demo's own
|
|
7
|
+
// cluster (scripts/estate-up.sh creates it) so a live read can never observe
|
|
8
|
+
// whatever kubectl context happens to be ambient (chant#1100).
|
|
9
|
+
export default {
|
|
10
|
+
lexicons: ["k8s"],
|
|
11
|
+
sourceDir: "src",
|
|
12
|
+
environments: ["local"],
|
|
13
|
+
ownership: { stack: "flux-control-plane", env: "local" },
|
|
14
|
+
k8s: {
|
|
15
|
+
profiles: {
|
|
16
|
+
local: { context: "k3d-behold-flux-demo" },
|
|
17
|
+
},
|
|
18
|
+
} satisfies K8sChantConfig,
|
|
19
|
+
} satisfies ChantConfig;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "behold-example-flux-control-plane",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "The estate's control plane: the Flux CRs (GitRepository + Kustomizations) that deploy the app projects.",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"build": "chant build src -o dist/control-plane.yaml --format yaml"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@intentius/chant": "^0.41.20",
|
|
11
|
+
"@intentius/chant-lexicon-k8s": "^0.41.20"
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// The control plane, GitOps-style: Flux reconcilers deploy the app projects
|
|
2
|
+
// FROM THIS REPO. The GitRepository points at behold's own public repo; each
|
|
3
|
+
// Kustomization applies one app project's committed manifests into that app's
|
|
4
|
+
// namespace via targetNamespace — which is why app-b's objects declare no
|
|
5
|
+
// metadata.namespace (see ../../app-b/src/app.ts): Flux stamps it at apply
|
|
6
|
+
// time. That is the normal Flux estate shape, and exactly the shape behold's
|
|
7
|
+
// namespace-mismatch note (behold#192) exists to explain.
|
|
8
|
+
//
|
|
9
|
+
// scripts/estate-up.sh applies the BUILT form of this project (chant build →
|
|
10
|
+
// dist/control-plane.yaml) once, after installing Flux; from then on the
|
|
11
|
+
// reconcilers own the apps.
|
|
12
|
+
import { Namespace, GitRepository, Kustomization } from "@intentius/chant-lexicon-k8s";
|
|
13
|
+
|
|
14
|
+
// The app namespaces are control-plane concerns: a Kustomization's
|
|
15
|
+
// targetNamespace must already exist — Flux does not create it.
|
|
16
|
+
export const nsAppA = new Namespace({ metadata: { name: "app-a" } });
|
|
17
|
+
export const nsAppB = new Namespace({ metadata: { name: "app-b" } });
|
|
18
|
+
|
|
19
|
+
export const source = new GitRepository({
|
|
20
|
+
metadata: { name: "behold", namespace: "flux-system" },
|
|
21
|
+
spec: {
|
|
22
|
+
interval: "1m",
|
|
23
|
+
url: "https://github.com/INTENTIUS/behold",
|
|
24
|
+
// main is where the committed manifests live once merged. Verifying a
|
|
25
|
+
// not-yet-merged branch: estate-up.sh patches the LIVE object's ref when
|
|
26
|
+
// BEHOLD_FLUX_REF is set — the declared source stays main.
|
|
27
|
+
ref: { branch: "main" },
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
export const appA = new Kustomization({
|
|
32
|
+
metadata: { name: "app-a", namespace: "flux-system" },
|
|
33
|
+
spec: {
|
|
34
|
+
interval: "1m",
|
|
35
|
+
prune: true,
|
|
36
|
+
targetNamespace: "app-a",
|
|
37
|
+
sourceRef: { kind: "GitRepository", name: "behold" },
|
|
38
|
+
path: "./example-flux-estate/app-a/manifests",
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
export const appB = new Kustomization({
|
|
43
|
+
metadata: { name: "app-b", namespace: "flux-system" },
|
|
44
|
+
spec: {
|
|
45
|
+
interval: "1m",
|
|
46
|
+
prune: true,
|
|
47
|
+
targetNamespace: "app-b",
|
|
48
|
+
sourceRef: { kind: "GitRepository", name: "behold" },
|
|
49
|
+
path: "./example-flux-estate/app-b/manifests",
|
|
50
|
+
},
|
|
51
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{ "compilerOptions": { "target": "ES2022", "module": "ESNext", "moduleResolution": "Bundler", "strict": true, "skipLibCheck": true, "noEmit": true }, "include": ["src/**/*", "ops/**/*", "chant.config.ts"] }
|