typekro 0.15.5 → 0.16.1
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/composition/context.d.ts +19 -2
- package/dist/core/composition/context.d.ts.map +1 -1
- package/dist/core/composition/context.js +12 -0
- package/dist/core/composition/context.js.map +1 -1
- package/dist/core/composition/imperative.d.ts.map +1 -1
- package/dist/core/composition/imperative.js +32 -14
- package/dist/core/composition/imperative.js.map +1 -1
- package/dist/core/deployment/strategies/direct-strategy.d.ts.map +1 -1
- package/dist/core/deployment/strategies/direct-strategy.js +18 -11
- package/dist/core/deployment/strategies/direct-strategy.js.map +1 -1
- package/dist/core/proxy/create-resource.d.ts.map +1 -1
- package/dist/core/proxy/create-resource.js +20 -8
- package/dist/core/proxy/create-resource.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 +50 -0
- package/dist/factories/caddy/compositions/caddy-ingress.d.ts.map +1 -0
- package/dist/factories/caddy/compositions/caddy-ingress.js +153 -0
- package/dist/factories/caddy/compositions/caddy-ingress.js.map +1 -0
- package/dist/factories/caddy/compositions/index.d.ts +2 -0
- package/dist/factories/caddy/compositions/index.d.ts.map +1 -0
- package/dist/factories/caddy/compositions/index.js +2 -0
- package/dist/factories/caddy/compositions/index.js.map +1 -0
- package/dist/factories/caddy/index.d.ts +32 -0
- package/dist/factories/caddy/index.d.ts.map +1 -0
- package/dist/factories/caddy/index.js +32 -0
- package/dist/factories/caddy/index.js.map +1 -0
- package/dist/factories/caddy/types.d.ts +74 -0
- package/dist/factories/caddy/types.d.ts.map +1 -0
- package/dist/factories/caddy/types.js +74 -0
- package/dist/factories/caddy/types.js.map +1 -0
- package/dist/factories/caddy/utils/caddyfile.d.ts +20 -0
- package/dist/factories/caddy/utils/caddyfile.d.ts.map +1 -0
- package/dist/factories/caddy/utils/caddyfile.js +31 -0
- package/dist/factories/caddy/utils/caddyfile.js.map +1 -0
- package/dist/factories/caddy/utils/index.d.ts +2 -0
- package/dist/factories/caddy/utils/index.d.ts.map +1 -0
- package/dist/factories/caddy/utils/index.js +2 -0
- package/dist/factories/caddy/utils/index.js.map +1 -0
- package/package.json +5 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"caddy-ingress.js","sourceRoot":"","sources":["../../../../src/factories/caddy/compositions/caddy-ingress.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;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;AACtE,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AAEjF,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;AAE5C,MAAM,CAAC,MAAM,YAAY,GAAG,qBAAqB,CAC/C;IACE,IAAI,EAAE,eAAe;IACrB,IAAI,EAAE,cAAc;IACpB,IAAI,EAAE,wBAAwB;IAC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7C,OAAO;QACL,KAAK,EAAE,eAAe,CAAC,MAAM,CAAC,aAAa,IAAI,eAAe,CAAC,IAAI,CAAC,QAAQ;QAC5E,OAAO;KACR,CAAC;AACJ,CAAC,CACF,CAAC"}
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Caddy Integration for TypeKro.
|
|
3
|
+
*
|
|
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 + PVC.
|
|
6
|
+
* Caddy's `tls internal` issues certs from a built-in local CA (no cert-manager); the PVC persists `/data`
|
|
7
|
+
* so the CA root is stable.
|
|
8
|
+
*
|
|
9
|
+
* ## Compositions
|
|
10
|
+
* - `caddyIngress` — runs Caddy with a supplied Caddyfile (kro + direct modes).
|
|
11
|
+
*
|
|
12
|
+
* ## Helpers
|
|
13
|
+
* - `renderCaddyfile(routes, opts)` — build the Caddyfile string from concrete host→upstream routes.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import { caddyIngress, renderCaddyfile } from 'typekro/caddy';
|
|
18
|
+
*
|
|
19
|
+
* const caddyfile = renderCaddyfile([
|
|
20
|
+
* { host: 'dagster-dev.acme.internal', upstream: 'dagster.dagster-platform-dev.svc:80' },
|
|
21
|
+
* ]);
|
|
22
|
+
* const factory = caddyIngress.factory('direct', { namespace: 'caddy-system' });
|
|
23
|
+
* await factory.deploy({ name: 'caddy', caddyfile });
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @see https://caddyserver.com/docs/caddyfile/directives/tls
|
|
27
|
+
* @module
|
|
28
|
+
*/
|
|
29
|
+
export * from './compositions/index.js';
|
|
30
|
+
export * from './types.js';
|
|
31
|
+
export * from './utils/index.js';
|
|
32
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/factories/caddy/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,cAAc,yBAAyB,CAAC;AACxC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Caddy Integration for TypeKro.
|
|
3
|
+
*
|
|
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 + PVC.
|
|
6
|
+
* Caddy's `tls internal` issues certs from a built-in local CA (no cert-manager); the PVC persists `/data`
|
|
7
|
+
* so the CA root is stable.
|
|
8
|
+
*
|
|
9
|
+
* ## Compositions
|
|
10
|
+
* - `caddyIngress` — runs Caddy with a supplied Caddyfile (kro + direct modes).
|
|
11
|
+
*
|
|
12
|
+
* ## Helpers
|
|
13
|
+
* - `renderCaddyfile(routes, opts)` — build the Caddyfile string from concrete host→upstream routes.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* import { caddyIngress, renderCaddyfile } from 'typekro/caddy';
|
|
18
|
+
*
|
|
19
|
+
* const caddyfile = renderCaddyfile([
|
|
20
|
+
* { host: 'dagster-dev.acme.internal', upstream: 'dagster.dagster-platform-dev.svc:80' },
|
|
21
|
+
* ]);
|
|
22
|
+
* const factory = caddyIngress.factory('direct', { namespace: 'caddy-system' });
|
|
23
|
+
* await factory.deploy({ name: 'caddy', caddyfile });
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* @see https://caddyserver.com/docs/caddyfile/directives/tls
|
|
27
|
+
* @module
|
|
28
|
+
*/
|
|
29
|
+
export * from './compositions/index.js';
|
|
30
|
+
export * from './types.js';
|
|
31
|
+
export * from './utils/index.js';
|
|
32
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/factories/caddy/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,cAAc,yBAAyB,CAAC;AACxC,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Caddy Ingress Types
|
|
3
|
+
*
|
|
4
|
+
* Caddy here is a CONFIG-DRIVEN reverse proxy (not the Caddy ingress-controller, and not a Helm
|
|
5
|
+
* bootstrap): the composition runs the official `caddy` image with a Caddyfile we supply, and emits a
|
|
6
|
+
* ConfigMap (Caddyfile) + Deployment + Service + PVC. Caddy's built-in `tls internal` issues certs from a
|
|
7
|
+
* local CA (no cert-manager), so the PVC persists `/data` (the CA root) across restarts.
|
|
8
|
+
*
|
|
9
|
+
* KRO-safety note: the Caddyfile is supplied as a STRING (`caddyfile`), not derived from a structured
|
|
10
|
+
* `routes` array inside the composition. A `routes` array would be a graph proxy in KRO mode and cannot be
|
|
11
|
+
* `.map()`-ed into a string (see integration-skill rules 32/48). Use the exported `renderCaddyfile()`
|
|
12
|
+
* helper to build the string from routes in concrete (consumer/direct) contexts, then pass it here.
|
|
13
|
+
*/
|
|
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
|
+
*/
|
|
22
|
+
export declare const CaddyIngressConfigSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
23
|
+
name: string;
|
|
24
|
+
caddyfile: string;
|
|
25
|
+
namespace?: string;
|
|
26
|
+
image?: string;
|
|
27
|
+
version?: string;
|
|
28
|
+
httpPort?: number;
|
|
29
|
+
httpsPort?: number;
|
|
30
|
+
serviceType?: "ClusterIP" | "NodePort" | "LoadBalancer";
|
|
31
|
+
persistence?: {
|
|
32
|
+
size?: string;
|
|
33
|
+
storageClass?: string;
|
|
34
|
+
};
|
|
35
|
+
resources?: {
|
|
36
|
+
requests?: {
|
|
37
|
+
cpu?: string;
|
|
38
|
+
memory?: string;
|
|
39
|
+
};
|
|
40
|
+
limits?: {
|
|
41
|
+
cpu?: string;
|
|
42
|
+
memory?: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
}, {}>;
|
|
46
|
+
export type CaddyIngressConfig = typeof CaddyIngressConfigSchema.infer;
|
|
47
|
+
/**
|
|
48
|
+
* Caddy ingress status. `ready` is a direct Deployment-proxy comparison (multi-resource non-Helm
|
|
49
|
+
* composition → no `Cel.expr`/conditions array): `status.readyReplicas >= spec.replicas`. The Deployment
|
|
50
|
+
* is pinned to a single replica (see the composition), so this reads as "the one desired pod is ready" —
|
|
51
|
+
* it cannot report ready before that pod exists. It resolves in BOTH kro CEL and direct-mode hydration
|
|
52
|
+
* (spec refs hydrate via the LIVE_SPEC_KEY core change). `version` is the deploy-time version label
|
|
53
|
+
* (static). No `phase` field: a `ready ? 'Ready' : 'Installing'` ternary referencing a resource ref
|
|
54
|
+
* currently serializes to a malformed CEL (`caddyDeployment.schema.spec.replicas`) — a typekro analyzer
|
|
55
|
+
* bug to fix separately; `ready` carries the signal anyway.
|
|
56
|
+
*/
|
|
57
|
+
export declare const CaddyIngressStatusSchema: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
58
|
+
ready: boolean;
|
|
59
|
+
version?: string;
|
|
60
|
+
}, {}>;
|
|
61
|
+
export type CaddyIngressStatus = typeof CaddyIngressStatusSchema.infer;
|
|
62
|
+
/** A single host→upstream route, for the `renderCaddyfile()` helper (NOT a composition spec field). */
|
|
63
|
+
export interface CaddyRoute {
|
|
64
|
+
/** The hostname Caddy serves, e.g. `dagster-dev.acme.internal`. */
|
|
65
|
+
host: string;
|
|
66
|
+
/** The upstream `host:port` Caddy reverse-proxies to, e.g. `dagster.dagster-platform-dev.svc:80`. */
|
|
67
|
+
upstream: string;
|
|
68
|
+
}
|
|
69
|
+
/** Options for `renderCaddyfile()`. */
|
|
70
|
+
export interface RenderCaddyfileOptions {
|
|
71
|
+
/** TLS mode per site. `internal` (default) uses Caddy's local CA; `off` serves plain HTTP. */
|
|
72
|
+
tls?: 'internal' | 'off';
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/factories/caddy/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAoBH;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;MAsBnC,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,OAAO,wBAAwB,CAAC,KAAK,CAAC;AAEvE;;;;;;;;;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"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Caddy Ingress Types
|
|
3
|
+
*
|
|
4
|
+
* Caddy here is a CONFIG-DRIVEN reverse proxy (not the Caddy ingress-controller, and not a Helm
|
|
5
|
+
* bootstrap): the composition runs the official `caddy` image with a Caddyfile we supply, and emits a
|
|
6
|
+
* ConfigMap (Caddyfile) + Deployment + Service + PVC. Caddy's built-in `tls internal` issues certs from a
|
|
7
|
+
* local CA (no cert-manager), so the PVC persists `/data` (the CA root) across restarts.
|
|
8
|
+
*
|
|
9
|
+
* KRO-safety note: the Caddyfile is supplied as a STRING (`caddyfile`), not derived from a structured
|
|
10
|
+
* `routes` array inside the composition. A `routes` array would be a graph proxy in KRO mode and cannot be
|
|
11
|
+
* `.map()`-ed into a string (see integration-skill rules 32/48). Use the exported `renderCaddyfile()`
|
|
12
|
+
* helper to build the string from routes in concrete (consumer/direct) contexts, then pass it here.
|
|
13
|
+
*/
|
|
14
|
+
import { type } from 'arktype';
|
|
15
|
+
/** Container resource requests/limits — shared shape. */
|
|
16
|
+
const resourceRequirementsSchemaShape = {
|
|
17
|
+
'requests?': { 'cpu?': 'string', 'memory?': 'string' },
|
|
18
|
+
'limits?': { 'cpu?': 'string', 'memory?': 'string' },
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Sizing for the PVC backing Caddy's `/data` (the `tls internal` CA root + issued certs). The PVC is
|
|
22
|
+
* always created — persisting the CA root is required so it's stable across restarts; an ephemeral/emptyDir
|
|
23
|
+
* mode isn't offered because a conditional volume can't be expressed safely in KRO (compound includeWhen).
|
|
24
|
+
*/
|
|
25
|
+
const persistenceSchemaShape = {
|
|
26
|
+
'size?': 'string',
|
|
27
|
+
'storageClass?': 'string',
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Caddy ingress config. `caddyfile` is the raw Caddyfile content (the routing + TLS config), supplied as
|
|
31
|
+
* a string so it passes through unchanged in both direct and KRO modes.
|
|
32
|
+
*
|
|
33
|
+
* Undeclared keys are REJECTED (`'+': 'reject'`) so misconfig fails loudly rather than being silently
|
|
34
|
+
* dropped — notably `replicaCount`: this composition is single-replica by design (the `tls internal` CA
|
|
35
|
+
* lives in a RWO PVC one pod owns), so a replica knob would invite a broken multi-pod-shares-RWO setup.
|
|
36
|
+
*/
|
|
37
|
+
export const CaddyIngressConfigSchema = type({
|
|
38
|
+
'+': 'reject',
|
|
39
|
+
name: 'string',
|
|
40
|
+
'namespace?': 'string',
|
|
41
|
+
/** Full Caddyfile content. Build it from routes via `renderCaddyfile()` when you have concrete routes. */
|
|
42
|
+
caddyfile: 'string',
|
|
43
|
+
/** Full container image ref INCLUDING the tag (default `caddy:2.11.2`). */
|
|
44
|
+
'image?': 'string',
|
|
45
|
+
/**
|
|
46
|
+
* Version label/status hint — surfaced as `app.kubernetes.io/version` + `status.version` (default
|
|
47
|
+
* `2.11.2`). Cosmetic only; the running tag comes from `image`. Set it to match your `image` tag.
|
|
48
|
+
*/
|
|
49
|
+
'version?': 'string',
|
|
50
|
+
/** HTTP listener port on the Service + container (default 80). */
|
|
51
|
+
'httpPort?': 'number',
|
|
52
|
+
/** HTTPS listener port on the Service + container (default 443). */
|
|
53
|
+
'httpsPort?': 'number',
|
|
54
|
+
/** Service type (default ClusterIP — reached via the access tunnel; no public LB). */
|
|
55
|
+
'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
|
+
'resources?': resourceRequirementsSchemaShape,
|
|
59
|
+
});
|
|
60
|
+
/**
|
|
61
|
+
* Caddy ingress status. `ready` is a direct Deployment-proxy comparison (multi-resource non-Helm
|
|
62
|
+
* composition → no `Cel.expr`/conditions array): `status.readyReplicas >= spec.replicas`. The Deployment
|
|
63
|
+
* is pinned to a single replica (see the composition), so this reads as "the one desired pod is ready" —
|
|
64
|
+
* it cannot report ready before that pod exists. It resolves in BOTH kro CEL and direct-mode hydration
|
|
65
|
+
* (spec refs hydrate via the LIVE_SPEC_KEY core change). `version` is the deploy-time version label
|
|
66
|
+
* (static). No `phase` field: a `ready ? 'Ready' : 'Installing'` ternary referencing a resource ref
|
|
67
|
+
* currently serializes to a malformed CEL (`caddyDeployment.schema.spec.replicas`) — a typekro analyzer
|
|
68
|
+
* bug to fix separately; `ready` carries the signal anyway.
|
|
69
|
+
*/
|
|
70
|
+
export const CaddyIngressStatusSchema = type({
|
|
71
|
+
ready: 'boolean',
|
|
72
|
+
'version?': 'string',
|
|
73
|
+
});
|
|
74
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/factories/caddy/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;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;;;;GAIG;AACH,MAAM,sBAAsB,GAAG;IAC7B,OAAO,EAAE,QAAQ;IACjB,eAAe,EAAE,QAAQ;CACjB,CAAC;AAEX;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,CAAC;IAC3C,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,oEAAoE;IACpE,YAAY,EAAE,QAAQ;IACtB,sFAAsF;IACtF,cAAc,EAAE,2CAA2C;IAC3D,qGAAqG;IACrG,cAAc,EAAE,sBAAsB;IACtC,YAAY,EAAE,+BAA+B;CAC9C,CAAC,CAAC;AAGH;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,CAAC;IAC3C,KAAK,EAAE,SAAS;IAChB,UAAU,EAAE,QAAQ;CACrB,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Caddyfile rendering helper.
|
|
3
|
+
*
|
|
4
|
+
* Pure function: given concrete routes, produce a Caddyfile string. Kept OUT of the composition so the
|
|
5
|
+
* composition stays a string passthrough (KRO-safe). Consumers with a concrete route list (e.g. a
|
|
6
|
+
* generator that knows its services) call this, then pass the result as `caddyfile`.
|
|
7
|
+
*/
|
|
8
|
+
import type { CaddyRoute, RenderCaddyfileOptions } from '../types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Render a Caddyfile from host→upstream routes.
|
|
11
|
+
*
|
|
12
|
+
* - `tls: 'internal'` (default): each site uses Caddy's built-in local CA (`tls internal`) — valid certs
|
|
13
|
+
* for any name (incl. private TLDs like `.internal`), no ACME/cert-manager. Trust the root once.
|
|
14
|
+
* - `tls: 'off'`: sites are addressed as `http://<host>` so Caddy serves plain HTTP (no auto-HTTPS).
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* renderCaddyfile([{ host: 'dagster-dev.acme.internal', upstream: 'dagster.dagster-platform-dev.svc:80' }])
|
|
18
|
+
*/
|
|
19
|
+
export declare function renderCaddyfile(routes: readonly CaddyRoute[], options?: RenderCaddyfileOptions): string;
|
|
20
|
+
//# sourceMappingURL=caddyfile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"caddyfile.d.ts","sourceRoot":"","sources":["../../../../src/factories/caddy/utils/caddyfile.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAEtE;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,SAAS,UAAU,EAAE,EAC7B,OAAO,GAAE,sBAA2B,GACnC,MAAM,CAWR"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Caddyfile rendering helper.
|
|
3
|
+
*
|
|
4
|
+
* Pure function: given concrete routes, produce a Caddyfile string. Kept OUT of the composition so the
|
|
5
|
+
* composition stays a string passthrough (KRO-safe). Consumers with a concrete route list (e.g. a
|
|
6
|
+
* generator that knows its services) call this, then pass the result as `caddyfile`.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Render a Caddyfile from host→upstream routes.
|
|
10
|
+
*
|
|
11
|
+
* - `tls: 'internal'` (default): each site uses Caddy's built-in local CA (`tls internal`) — valid certs
|
|
12
|
+
* for any name (incl. private TLDs like `.internal`), no ACME/cert-manager. Trust the root once.
|
|
13
|
+
* - `tls: 'off'`: sites are addressed as `http://<host>` so Caddy serves plain HTTP (no auto-HTTPS).
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* renderCaddyfile([{ host: 'dagster-dev.acme.internal', upstream: 'dagster.dagster-platform-dev.svc:80' }])
|
|
17
|
+
*/
|
|
18
|
+
export function renderCaddyfile(routes, options = {}) {
|
|
19
|
+
const tls = options.tls ?? 'internal';
|
|
20
|
+
const blocks = routes.map((route) => {
|
|
21
|
+
const address = tls === 'off' ? `http://${route.host}` : route.host;
|
|
22
|
+
const lines = [`${address} {`];
|
|
23
|
+
if (tls === 'internal')
|
|
24
|
+
lines.push('\ttls internal');
|
|
25
|
+
lines.push(`\treverse_proxy ${route.upstream}`, '}');
|
|
26
|
+
return lines.join('\n');
|
|
27
|
+
});
|
|
28
|
+
// Trailing newline keeps the file POSIX-clean and diff-friendly.
|
|
29
|
+
return `${blocks.join('\n\n')}\n`;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=caddyfile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"caddyfile.js","sourceRoot":"","sources":["../../../../src/factories/caddy/utils/caddyfile.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAC7B,MAA6B,EAC7B,UAAkC,EAAE;IAEpC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,UAAU,CAAC;IACtC,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QAClC,MAAM,OAAO,GAAG,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,UAAU,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC;QACpE,MAAM,KAAK,GAAG,CAAC,GAAG,OAAO,IAAI,CAAC,CAAC;QAC/B,IAAI,GAAG,KAAK,UAAU;YAAE,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;QACrD,KAAK,CAAC,IAAI,CAAC,mBAAmB,KAAK,CAAC,QAAQ,EAAE,EAAE,GAAG,CAAC,CAAC;QACrD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1B,CAAC,CAAC,CAAC;IACH,iEAAiE;IACjE,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/factories/caddy/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/factories/caddy/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "typekro",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.16.1",
|
|
4
4
|
"description": "A control plane aware framework for orchestrating kubernetes resources like a programmer.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -66,6 +66,10 @@
|
|
|
66
66
|
"import": "./dist/factories/dagster/index.js",
|
|
67
67
|
"types": "./dist/factories/dagster/index.d.ts"
|
|
68
68
|
},
|
|
69
|
+
"./caddy": {
|
|
70
|
+
"import": "./dist/factories/caddy/index.js",
|
|
71
|
+
"types": "./dist/factories/caddy/index.d.ts"
|
|
72
|
+
},
|
|
69
73
|
"./pebble": {
|
|
70
74
|
"import": "./dist/factories/pebble/index.js",
|
|
71
75
|
"types": "./dist/factories/pebble/index.d.ts"
|