typekro 0.16.0 → 0.17.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/dist/.tsbuildinfo +1 -1
- package/dist/core/expressions/composition/composition-analyzer-helpers.d.ts.map +1 -1
- package/dist/core/expressions/composition/composition-analyzer-helpers.js +9 -7
- package/dist/core/expressions/composition/composition-analyzer-helpers.js.map +1 -1
- package/dist/core/serialization/schema.d.ts.map +1 -1
- package/dist/core/serialization/schema.js +36 -40
- package/dist/core/serialization/schema.js.map +1 -1
- package/dist/factories/caddy/compositions/caddy-ingress.d.ts +39 -7
- package/dist/factories/caddy/compositions/caddy-ingress.d.ts.map +1 -1
- package/dist/factories/caddy/compositions/caddy-ingress.js +67 -34
- package/dist/factories/caddy/compositions/caddy-ingress.js.map +1 -1
- package/dist/factories/caddy/compositions/index.d.ts +1 -1
- package/dist/factories/caddy/compositions/index.d.ts.map +1 -1
- package/dist/factories/caddy/compositions/index.js +1 -1
- package/dist/factories/caddy/compositions/index.js.map +1 -1
- package/dist/factories/caddy/index.d.ts +7 -4
- package/dist/factories/caddy/index.d.ts.map +1 -1
- package/dist/factories/caddy/index.js +7 -4
- package/dist/factories/caddy/index.js.map +1 -1
- package/dist/factories/caddy/types.d.ts +35 -14
- package/dist/factories/caddy/types.d.ts.map +1 -1
- package/dist/factories/caddy/types.js +22 -8
- package/dist/factories/caddy/types.js.map +1 -1
- package/package.json +1 -1
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
* Caddy Ingress Composition
|
|
3
3
|
*
|
|
4
4
|
* Runs the official `caddy` image as a config-driven reverse proxy: a ConfigMap holds the Caddyfile, a
|
|
5
|
-
* Deployment runs Caddy mounting it, a Service exposes it (ClusterIP by default), and a
|
|
6
|
-
*
|
|
5
|
+
* Deployment runs Caddy mounting it, a Service exposes it (ClusterIP by default), and a `/data` volume
|
|
6
|
+
* holds Caddy's `tls internal` CA root. By default `/data` is a PVC (CA survives restarts);
|
|
7
|
+
* `makeCaddyIngress({ ephemeral: true })` uses an `emptyDir` (CA regenerates per pod) so the plane
|
|
8
|
+
* tolerates node/AZ changes. No Helm, no etcd, no cert-manager.
|
|
7
9
|
*
|
|
8
10
|
* The Caddyfile arrives as a string on `spec.caddyfile` (build it with `renderCaddyfile()` from concrete
|
|
9
11
|
* routes) so the composition is a pure passthrough that works identically in direct and KRO modes.
|
|
@@ -14,7 +16,7 @@ import { namespace } from '../../kubernetes/core/namespace.js';
|
|
|
14
16
|
import { service } from '../../kubernetes/networking/service.js';
|
|
15
17
|
import { persistentVolumeClaim } from '../../kubernetes/storage/persistent-volume-claim.js';
|
|
16
18
|
import { deployment } from '../../kubernetes/workloads/deployment.js';
|
|
17
|
-
import { CaddyIngressConfigSchema, CaddyIngressStatusSchema } from '../types.js';
|
|
19
|
+
import { CaddyIngressConfigSchema, CaddyIngressEphemeralConfigSchema, CaddyIngressStatusSchema, } from '../types.js';
|
|
18
20
|
/** Current stable Caddy version (Docker Hub, 2026-03); the `app.kubernetes.io/version` label + status. */
|
|
19
21
|
export const DEFAULT_CADDY_VERSION = '2.11.2';
|
|
20
22
|
/**
|
|
@@ -27,12 +29,13 @@ export const DEFAULT_CADDY_NAMESPACE = 'caddy-system';
|
|
|
27
29
|
export const DEFAULT_CADDY_HTTP_PORT = 80;
|
|
28
30
|
export const DEFAULT_CADDY_HTTPS_PORT = 443;
|
|
29
31
|
export const DEFAULT_CADDY_PVC_SIZE = '1Gi';
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Build the Caddy resources (namespace, ConfigMap, the `/data` volume, Deployment, Service) and return
|
|
34
|
+
* the Deployment proxy + version for the status block. `ephemeral` is the build-time storage choice
|
|
35
|
+
* (emptyDir vs PVC). The STATUS object literal must stay inline in each composition (typekro's analyzer
|
|
36
|
+
* extracts the readiness CEL from the composition fn's `return`), so this helper stops short of it.
|
|
37
|
+
*/
|
|
38
|
+
const buildCaddyResources = (spec, ephemeral) => {
|
|
36
39
|
const name = spec.name;
|
|
37
40
|
const ns = spec.namespace ?? DEFAULT_CADDY_NAMESPACE;
|
|
38
41
|
const image = spec.image ?? DEFAULT_CADDY_IMAGE;
|
|
@@ -58,21 +61,31 @@ export const caddyIngress = kubernetesComposition({
|
|
|
58
61
|
data: { Caddyfile: spec.caddyfile },
|
|
59
62
|
id: 'caddyConfig',
|
|
60
63
|
});
|
|
61
|
-
//
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
64
|
+
// `/data` holds Caddy's `tls internal` CA root. Default: a PVC so the CA survives restarts. Ephemeral
|
|
65
|
+
// (build-time option): an emptyDir — the CA regenerates per pod, but the plane no longer depends on a
|
|
66
|
+
// single-AZ RWO volume that strands the pod on a node/AZ change. The choice is made HERE (real JS
|
|
67
|
+
// boolean), so only one resource set is registered — no KRO runtime conditional.
|
|
68
|
+
let dataVolume;
|
|
69
|
+
if (ephemeral) {
|
|
70
|
+
dataVolume = { name: 'data', emptyDir: {} };
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
persistentVolumeClaim({
|
|
74
|
+
metadata: { name: pvcName, namespace: ns, labels },
|
|
75
|
+
spec: {
|
|
76
|
+
accessModes: ['ReadWriteOnce'],
|
|
77
|
+
resources: { requests: { storage: pvcSize } },
|
|
78
|
+
...(spec.persistence?.storageClass
|
|
79
|
+
? { storageClassName: spec.persistence.storageClass }
|
|
80
|
+
: {}),
|
|
81
|
+
},
|
|
82
|
+
id: 'caddyData',
|
|
83
|
+
});
|
|
84
|
+
dataVolume = { name: 'data', persistentVolumeClaim: { claimName: pvcName } };
|
|
85
|
+
}
|
|
73
86
|
const volumes = [
|
|
74
87
|
{ name: 'caddyfile', configMap: { name: configMapName } },
|
|
75
|
-
|
|
88
|
+
dataVolume,
|
|
76
89
|
];
|
|
77
90
|
const caddyDeployment = deployment({
|
|
78
91
|
metadata: { name, namespace: ns, labels },
|
|
@@ -138,16 +151,36 @@ export const caddyIngress = kubernetesComposition({
|
|
|
138
151
|
},
|
|
139
152
|
id: 'caddyService',
|
|
140
153
|
});
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
154
|
+
return { caddyDeployment, version };
|
|
155
|
+
};
|
|
156
|
+
export function makeCaddyIngress(options = {}) {
|
|
157
|
+
if (options.ephemeral) {
|
|
158
|
+
return kubernetesComposition({
|
|
159
|
+
name: 'caddy-ingress',
|
|
160
|
+
kind: 'CaddyIngress',
|
|
161
|
+
spec: CaddyIngressEphemeralConfigSchema,
|
|
162
|
+
status: CaddyIngressStatusSchema,
|
|
163
|
+
}, (spec) => {
|
|
164
|
+
const { caddyDeployment, version } = buildCaddyResources(spec, true);
|
|
165
|
+
return {
|
|
166
|
+
ready: caddyDeployment.status.readyReplicas >= caddyDeployment.spec.replicas,
|
|
167
|
+
version,
|
|
168
|
+
};
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
return kubernetesComposition({
|
|
172
|
+
name: 'caddy-ingress',
|
|
173
|
+
kind: 'CaddyIngress',
|
|
174
|
+
spec: CaddyIngressConfigSchema,
|
|
175
|
+
status: CaddyIngressStatusSchema,
|
|
176
|
+
}, (spec) => {
|
|
177
|
+
const { caddyDeployment, version } = buildCaddyResources(spec, false);
|
|
178
|
+
return {
|
|
179
|
+
ready: caddyDeployment.status.readyReplicas >= caddyDeployment.spec.replicas,
|
|
180
|
+
version,
|
|
181
|
+
};
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
/** The default Caddy-ingress composition (PVC-backed `/data`). See {@link makeCaddyIngress} for options. */
|
|
185
|
+
export const caddyIngress = makeCaddyIngress();
|
|
153
186
|
//# sourceMappingURL=caddy-ingress.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"caddy-ingress.js","sourceRoot":"","sources":["../../../../src/factories/caddy/compositions/caddy-ingress.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"caddy-ingress.js","sourceRoot":"","sources":["../../../../src/factories/caddy/compositions/caddy-ingress.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,MAAM,uCAAuC,CAAC;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,wCAAwC,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,qDAAqD,CAAC;AAC5F,OAAO,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAEtE,OAAO,EAEL,wBAAwB,EAExB,iCAAiC,EAEjC,wBAAwB,GACzB,MAAM,aAAa,CAAC;AAErB,0GAA0G;AAC1G,MAAM,CAAC,MAAM,qBAAqB,GAAG,QAAQ,CAAC;AAC9C;;;;GAIG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,SAAS,qBAAqB,EAAE,CAAC;AACpE,MAAM,CAAC,MAAM,uBAAuB,GAAG,cAAc,CAAC;AACtD,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAC1C,MAAM,CAAC,MAAM,wBAAwB,GAAG,GAAG,CAAC;AAC5C,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,CAAC;AAiB5C;;;;;GAKG;AACH,MAAM,mBAAmB,GAAG,CAAC,IAAwB,EAAE,SAAkB,EAAE,EAAE;IACzE,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;IACvB,MAAM,EAAE,GAAG,IAAI,CAAC,SAAS,IAAI,uBAAuB,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';
|
|
1
|
+
export { caddyIngress, makeCaddyIngress, type CaddyIngressOptions, DEFAULT_CADDY_HTTP_PORT, DEFAULT_CADDY_HTTPS_PORT, DEFAULT_CADDY_IMAGE, DEFAULT_CADDY_NAMESPACE, DEFAULT_CADDY_PVC_SIZE, DEFAULT_CADDY_VERSION, } from './caddy-ingress.js';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/factories/caddy/compositions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,uBAAuB,EACvB,wBAAwB,EACxB,mBAAmB,EACnB,uBAAuB,EACvB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/factories/caddy/compositions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,gBAAgB,EAChB,KAAK,mBAAmB,EACxB,uBAAuB,EACvB,wBAAwB,EACxB,mBAAmB,EACnB,uBAAuB,EACvB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,oBAAoB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { caddyIngress, DEFAULT_CADDY_HTTP_PORT, DEFAULT_CADDY_HTTPS_PORT, DEFAULT_CADDY_IMAGE, DEFAULT_CADDY_NAMESPACE, DEFAULT_CADDY_PVC_SIZE, DEFAULT_CADDY_VERSION, } from './caddy-ingress.js';
|
|
1
|
+
export { caddyIngress, makeCaddyIngress, DEFAULT_CADDY_HTTP_PORT, DEFAULT_CADDY_HTTPS_PORT, DEFAULT_CADDY_IMAGE, DEFAULT_CADDY_NAMESPACE, DEFAULT_CADDY_PVC_SIZE, DEFAULT_CADDY_VERSION, } from './caddy-ingress.js';
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/factories/caddy/compositions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,uBAAuB,EACvB,wBAAwB,EACxB,mBAAmB,EACnB,uBAAuB,EACvB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/factories/caddy/compositions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,gBAAgB,EAEhB,uBAAuB,EACvB,wBAAwB,EACxB,mBAAmB,EACnB,uBAAuB,EACvB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,oBAAoB,CAAC"}
|
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
* Caddy Integration for TypeKro.
|
|
3
3
|
*
|
|
4
4
|
* A CONFIG-DRIVEN Caddy reverse proxy (official `caddy` image + a supplied Caddyfile) — not the Caddy
|
|
5
|
-
* ingress-controller and not a Helm bootstrap. Emits ConfigMap (Caddyfile) + Deployment + Service +
|
|
6
|
-
* Caddy's `tls internal` issues certs from a built-in local CA (no cert-manager)
|
|
7
|
-
* so the CA root is stable
|
|
5
|
+
* ingress-controller and not a Helm bootstrap. Emits ConfigMap (Caddyfile) + Deployment + Service + a
|
|
6
|
+
* `/data` volume. Caddy's `tls internal` issues certs from a built-in local CA (no cert-manager). By
|
|
7
|
+
* default `/data` is a PVC so the CA root is stable across restarts; `makeCaddyIngress({ ephemeral: true })`
|
|
8
|
+
* uses an `emptyDir` instead (CA regenerates per pod) so the plane tolerates node/AZ changes.
|
|
8
9
|
*
|
|
9
10
|
* ## Compositions
|
|
10
|
-
* - `caddyIngress` — runs Caddy with a supplied Caddyfile (kro + direct modes)
|
|
11
|
+
* - `caddyIngress` — runs Caddy with a supplied Caddyfile (kro + direct modes); PVC-backed `/data`.
|
|
12
|
+
* - `makeCaddyIngress(options)` — the constructor behind `caddyIngress`; pass `{ ephemeral: true }` for an
|
|
13
|
+
* `emptyDir`-backed `/data` (no PVC; takes no `persistence` config).
|
|
11
14
|
*
|
|
12
15
|
* ## Helpers
|
|
13
16
|
* - `renderCaddyfile(routes, opts)` — build the Caddyfile string from concrete host→upstream routes.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/factories/caddy/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/factories/caddy/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,cAAc,yBAAyB,CAAC;AACxC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}
|
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
* Caddy Integration for TypeKro.
|
|
3
3
|
*
|
|
4
4
|
* A CONFIG-DRIVEN Caddy reverse proxy (official `caddy` image + a supplied Caddyfile) — not the Caddy
|
|
5
|
-
* ingress-controller and not a Helm bootstrap. Emits ConfigMap (Caddyfile) + Deployment + Service +
|
|
6
|
-
* Caddy's `tls internal` issues certs from a built-in local CA (no cert-manager)
|
|
7
|
-
* so the CA root is stable
|
|
5
|
+
* ingress-controller and not a Helm bootstrap. Emits ConfigMap (Caddyfile) + Deployment + Service + a
|
|
6
|
+
* `/data` volume. Caddy's `tls internal` issues certs from a built-in local CA (no cert-manager). By
|
|
7
|
+
* default `/data` is a PVC so the CA root is stable across restarts; `makeCaddyIngress({ ephemeral: true })`
|
|
8
|
+
* uses an `emptyDir` instead (CA regenerates per pod) so the plane tolerates node/AZ changes.
|
|
8
9
|
*
|
|
9
10
|
* ## Compositions
|
|
10
|
-
* - `caddyIngress` — runs Caddy with a supplied Caddyfile (kro + direct modes)
|
|
11
|
+
* - `caddyIngress` — runs Caddy with a supplied Caddyfile (kro + direct modes); PVC-backed `/data`.
|
|
12
|
+
* - `makeCaddyIngress(options)` — the constructor behind `caddyIngress`; pass `{ ephemeral: true }` for an
|
|
13
|
+
* `emptyDir`-backed `/data` (no PVC; takes no `persistence` config).
|
|
11
14
|
*
|
|
12
15
|
* ## Helpers
|
|
13
16
|
* - `renderCaddyfile(routes, opts)` — build the Caddyfile string from concrete host→upstream routes.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/factories/caddy/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/factories/caddy/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,cAAc,yBAAyB,CAAC;AACxC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}
|
|
@@ -3,35 +3,30 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Caddy here is a CONFIG-DRIVEN reverse proxy (not the Caddy ingress-controller, and not a Helm
|
|
5
5
|
* bootstrap): the composition runs the official `caddy` image with a Caddyfile we supply, and emits a
|
|
6
|
-
* ConfigMap (Caddyfile) + Deployment + Service +
|
|
7
|
-
* local CA (no cert-manager)
|
|
6
|
+
* ConfigMap (Caddyfile) + Deployment + Service + a `/data` volume. Caddy's built-in `tls internal` issues
|
|
7
|
+
* certs from a local CA (no cert-manager). By default `/data` is a PVC so the CA root persists across
|
|
8
|
+
* restarts; `makeCaddyIngress({ ephemeral: true })` uses an `emptyDir` instead (CA regenerates per pod),
|
|
9
|
+
* and that variant takes no `persistence` config (see `CaddyIngressEphemeralConfigSchema`).
|
|
8
10
|
*
|
|
9
11
|
* KRO-safety note: the Caddyfile is supplied as a STRING (`caddyfile`), not derived from a structured
|
|
10
12
|
* `routes` array inside the composition. A `routes` array would be a graph proxy in KRO mode and cannot be
|
|
11
13
|
* `.map()`-ed into a string (see integration-skill rules 32/48). Use the exported `renderCaddyfile()`
|
|
12
14
|
* helper to build the string from routes in concrete (consumer/direct) contexts, then pass it here.
|
|
13
15
|
*/
|
|
14
|
-
/**
|
|
15
|
-
* Caddy ingress config. `caddyfile` is the raw Caddyfile content (the routing + TLS config), supplied as
|
|
16
|
-
* a string so it passes through unchanged in both direct and KRO modes.
|
|
17
|
-
*
|
|
18
|
-
* Undeclared keys are REJECTED (`'+': 'reject'`) so misconfig fails loudly rather than being silently
|
|
19
|
-
* dropped — notably `replicaCount`: this composition is single-replica by design (the `tls internal` CA
|
|
20
|
-
* lives in a RWO PVC one pod owns), so a replica knob would invite a broken multi-pod-shares-RWO setup.
|
|
21
|
-
*/
|
|
16
|
+
/** The default (PVC-backed) Caddy-ingress config. `persistence` sizes the `/data` PVC. */
|
|
22
17
|
export declare const CaddyIngressConfigSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
23
18
|
name: string;
|
|
24
19
|
caddyfile: string;
|
|
20
|
+
persistence?: {
|
|
21
|
+
size?: string;
|
|
22
|
+
storageClass?: string;
|
|
23
|
+
};
|
|
25
24
|
namespace?: string;
|
|
26
25
|
image?: string;
|
|
27
26
|
version?: string;
|
|
28
27
|
httpPort?: number;
|
|
29
28
|
httpsPort?: number;
|
|
30
29
|
serviceType?: "ClusterIP" | "NodePort" | "LoadBalancer";
|
|
31
|
-
persistence?: {
|
|
32
|
-
size?: string;
|
|
33
|
-
storageClass?: string;
|
|
34
|
-
};
|
|
35
30
|
resources?: {
|
|
36
31
|
requests?: {
|
|
37
32
|
cpu?: string;
|
|
@@ -44,6 +39,32 @@ export declare const CaddyIngressConfigSchema: import("arktype/internal/variants
|
|
|
44
39
|
};
|
|
45
40
|
}, {}>;
|
|
46
41
|
export type CaddyIngressConfig = typeof CaddyIngressConfigSchema.infer;
|
|
42
|
+
/**
|
|
43
|
+
* The ephemeral (emptyDir) Caddy-ingress config — used by `makeCaddyIngress({ ephemeral: true })`. It has
|
|
44
|
+
* NO `persistence` field: there is no PVC to size, so a `persistence` value would be silently ignored.
|
|
45
|
+
* The inherited `'+': 'reject'` makes passing `persistence` (or any unknown key) fail loudly instead.
|
|
46
|
+
*/
|
|
47
|
+
export declare const CaddyIngressEphemeralConfigSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
48
|
+
name: string;
|
|
49
|
+
caddyfile: string;
|
|
50
|
+
namespace?: string;
|
|
51
|
+
image?: string;
|
|
52
|
+
version?: string;
|
|
53
|
+
httpPort?: number;
|
|
54
|
+
httpsPort?: number;
|
|
55
|
+
serviceType?: "ClusterIP" | "NodePort" | "LoadBalancer";
|
|
56
|
+
resources?: {
|
|
57
|
+
requests?: {
|
|
58
|
+
cpu?: string;
|
|
59
|
+
memory?: string;
|
|
60
|
+
};
|
|
61
|
+
limits?: {
|
|
62
|
+
cpu?: string;
|
|
63
|
+
memory?: string;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
}, {}>;
|
|
67
|
+
export type CaddyIngressEphemeralConfig = typeof CaddyIngressEphemeralConfigSchema.infer;
|
|
47
68
|
/**
|
|
48
69
|
* Caddy ingress status. `ready` is a direct Deployment-proxy comparison (multi-resource non-Helm
|
|
49
70
|
* composition → no `Cel.expr`/conditions array): `status.readyReplicas >= spec.replicas`. The Deployment
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/factories/caddy/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/factories/caddy/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAoDH,0FAA0F;AAC1F,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;MAInC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,wBAAwB,CAAC,KAAK,CAAC;AAEvE;;;;GAIG;AACH,eAAO,MAAM,iCAAiC;;;;;;;;;;;;;;;;;;;MAAqC,CAAC;AACpF,MAAM,MAAM,2BAA2B,GAAG,OAAO,iCAAiC,CAAC,KAAK,CAAC;AAEzF;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB;;;MAGnC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,wBAAwB,CAAC,KAAK,CAAC;AAEvE,uGAAuG;AACvG,MAAM,WAAW,UAAU;IACzB,mEAAmE;IACnE,IAAI,EAAE,MAAM,CAAC;IACb,qGAAqG;IACrG,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,uCAAuC;AACvC,MAAM,WAAW,sBAAsB;IACrC,8FAA8F;IAC9F,GAAG,CAAC,EAAE,UAAU,GAAG,KAAK,CAAC;CAC1B"}
|
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Caddy here is a CONFIG-DRIVEN reverse proxy (not the Caddy ingress-controller, and not a Helm
|
|
5
5
|
* bootstrap): the composition runs the official `caddy` image with a Caddyfile we supply, and emits a
|
|
6
|
-
* ConfigMap (Caddyfile) + Deployment + Service +
|
|
7
|
-
* local CA (no cert-manager)
|
|
6
|
+
* ConfigMap (Caddyfile) + Deployment + Service + a `/data` volume. Caddy's built-in `tls internal` issues
|
|
7
|
+
* certs from a local CA (no cert-manager). By default `/data` is a PVC so the CA root persists across
|
|
8
|
+
* restarts; `makeCaddyIngress({ ephemeral: true })` uses an `emptyDir` instead (CA regenerates per pod),
|
|
9
|
+
* and that variant takes no `persistence` config (see `CaddyIngressEphemeralConfigSchema`).
|
|
8
10
|
*
|
|
9
11
|
* KRO-safety note: the Caddyfile is supplied as a STRING (`caddyfile`), not derived from a structured
|
|
10
12
|
* `routes` array inside the composition. A `routes` array would be a graph proxy in KRO mode and cannot be
|
|
@@ -18,9 +20,11 @@ const resourceRequirementsSchemaShape = {
|
|
|
18
20
|
'limits?': { 'cpu?': 'string', 'memory?': 'string' },
|
|
19
21
|
};
|
|
20
22
|
/**
|
|
21
|
-
* Sizing for the PVC backing Caddy's `/data` (the `tls internal` CA root + issued certs)
|
|
22
|
-
*
|
|
23
|
-
*
|
|
23
|
+
* Sizing for the PVC backing Caddy's `/data` (the `tls internal` CA root + issued certs), persisting the
|
|
24
|
+
* CA across restarts. An `emptyDir` alternative IS available, but as a BUILD-TIME option on the
|
|
25
|
+
* composition (`makeCaddyIngress({ ephemeral: true })`), not a spec field — the storage choice is made
|
|
26
|
+
* when the composition is constructed, so it selects the resource set statically and never needs a KRO
|
|
27
|
+
* runtime conditional. (A spec-field toggle would require an unsafe compound `includeWhen`.)
|
|
24
28
|
*/
|
|
25
29
|
const persistenceSchemaShape = {
|
|
26
30
|
'size?': 'string',
|
|
@@ -34,7 +38,7 @@ const persistenceSchemaShape = {
|
|
|
34
38
|
* dropped — notably `replicaCount`: this composition is single-replica by design (the `tls internal` CA
|
|
35
39
|
* lives in a RWO PVC one pod owns), so a replica knob would invite a broken multi-pod-shares-RWO setup.
|
|
36
40
|
*/
|
|
37
|
-
|
|
41
|
+
const baseCaddyIngressShape = {
|
|
38
42
|
'+': 'reject',
|
|
39
43
|
name: 'string',
|
|
40
44
|
'namespace?': 'string',
|
|
@@ -53,10 +57,20 @@ export const CaddyIngressConfigSchema = type({
|
|
|
53
57
|
'httpsPort?': 'number',
|
|
54
58
|
/** Service type (default ClusterIP — reached via the access tunnel; no public LB). */
|
|
55
59
|
'serviceType?': '"ClusterIP" | "NodePort" | "LoadBalancer"',
|
|
56
|
-
/** Sizing for the always-created `/data` PVC that holds the `tls internal` CA root (default 1Gi). */
|
|
57
|
-
'persistence?': persistenceSchemaShape,
|
|
58
60
|
'resources?': resourceRequirementsSchemaShape,
|
|
61
|
+
};
|
|
62
|
+
/** The default (PVC-backed) Caddy-ingress config. `persistence` sizes the `/data` PVC. */
|
|
63
|
+
export const CaddyIngressConfigSchema = type({
|
|
64
|
+
...baseCaddyIngressShape,
|
|
65
|
+
/** Sizing for the `/data` PVC that holds the `tls internal` CA root (default 1Gi). PVC mode only. */
|
|
66
|
+
'persistence?': persistenceSchemaShape,
|
|
59
67
|
});
|
|
68
|
+
/**
|
|
69
|
+
* The ephemeral (emptyDir) Caddy-ingress config — used by `makeCaddyIngress({ ephemeral: true })`. It has
|
|
70
|
+
* NO `persistence` field: there is no PVC to size, so a `persistence` value would be silently ignored.
|
|
71
|
+
* The inherited `'+': 'reject'` makes passing `persistence` (or any unknown key) fail loudly instead.
|
|
72
|
+
*/
|
|
73
|
+
export const CaddyIngressEphemeralConfigSchema = type({ ...baseCaddyIngressShape });
|
|
60
74
|
/**
|
|
61
75
|
* Caddy ingress status. `ready` is a direct Deployment-proxy comparison (multi-resource non-Helm
|
|
62
76
|
* composition → no `Cel.expr`/conditions array): `status.readyReplicas >= spec.replicas`. The Deployment
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/factories/caddy/types.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/factories/caddy/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,yDAAyD;AACzD,MAAM,+BAA+B,GAAG;IACtC,WAAW,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE;IACtD,SAAS,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE;CAC5C,CAAC;AAEX;;;;;;GAMG;AACH,MAAM,sBAAsB,GAAG;IAC7B,OAAO,EAAE,QAAQ;IACjB,eAAe,EAAE,QAAQ;CACjB,CAAC;AAEX;;;;;;;GAOG;AACH,MAAM,qBAAqB,GAAG;IAC5B,GAAG,EAAE,QAAQ;IACb,IAAI,EAAE,QAAQ;IACd,YAAY,EAAE,QAAQ;IACtB,0GAA0G;IAC1G,SAAS,EAAE,QAAQ;IACnB,2EAA2E;IAC3E,QAAQ,EAAE,QAAQ;IAClB;;;OAGG;IACH,UAAU,EAAE,QAAQ;IACpB,kEAAkE;IAClE,WAAW,EAAE,QAAQ;IACrB,oEAAo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