typekro 0.25.0 → 0.27.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/alchemy/kro-delete.d.ts +8 -0
- package/dist/alchemy/kro-delete.d.ts.map +1 -1
- package/dist/alchemy/kro-delete.js +34 -35
- package/dist/alchemy/kro-delete.js.map +1 -1
- package/dist/alchemy/resource-registration.d.ts +60 -0
- package/dist/alchemy/resource-registration.d.ts.map +1 -1
- package/dist/alchemy/resource-registration.js +290 -11
- package/dist/alchemy/resource-registration.js.map +1 -1
- package/dist/alchemy/types.d.ts +44 -0
- package/dist/alchemy/types.d.ts.map +1 -1
- package/dist/core/deployment/direct-factory.d.ts +8 -1
- package/dist/core/deployment/direct-factory.d.ts.map +1 -1
- package/dist/core/deployment/direct-factory.js +80 -61
- package/dist/core/deployment/direct-factory.js.map +1 -1
- package/dist/core/deployment/engine.d.ts +2 -0
- package/dist/core/deployment/engine.d.ts.map +1 -1
- package/dist/core/deployment/engine.js +22 -1
- package/dist/core/deployment/engine.js.map +1 -1
- package/dist/core/deployment/k8s-helpers.d.ts +12 -0
- package/dist/core/deployment/k8s-helpers.d.ts.map +1 -1
- package/dist/core/deployment/k8s-helpers.js +26 -1
- package/dist/core/deployment/k8s-helpers.js.map +1 -1
- package/dist/core/deployment/kro-factory.d.ts +248 -1
- package/dist/core/deployment/kro-factory.d.ts.map +1 -1
- package/dist/core/deployment/kro-factory.js +1060 -180
- package/dist/core/deployment/kro-factory.js.map +1 -1
- package/dist/core/deployment/kro-instance-safety.d.ts +209 -0
- package/dist/core/deployment/kro-instance-safety.d.ts.map +1 -1
- package/dist/core/deployment/kro-instance-safety.js +506 -24
- package/dist/core/deployment/kro-instance-safety.js.map +1 -1
- package/dist/core/deployment/kro-namespace-teardown.d.ts +248 -0
- package/dist/core/deployment/kro-namespace-teardown.d.ts.map +1 -0
- package/dist/core/deployment/kro-namespace-teardown.js +459 -0
- package/dist/core/deployment/kro-namespace-teardown.js.map +1 -0
- package/dist/core/deployment/readiness-waiter.d.ts.map +1 -1
- package/dist/core/deployment/readiness-waiter.js +6 -2
- package/dist/core/deployment/readiness-waiter.js.map +1 -1
- package/dist/core/deployment/rollback-manager.d.ts +33 -1
- package/dist/core/deployment/rollback-manager.d.ts.map +1 -1
- package/dist/core/deployment/rollback-manager.js +85 -30
- package/dist/core/deployment/rollback-manager.js.map +1 -1
- package/dist/core/serialization/core.d.ts.map +1 -1
- package/dist/core/serialization/core.js +82 -8
- package/dist/core/serialization/core.js.map +1 -1
- package/dist/core/types/deployment.d.ts +20 -0
- package/dist/core/types/deployment.d.ts.map +1 -1
- package/dist/factories/index.d.ts +1 -0
- package/dist/factories/index.d.ts.map +1 -1
- package/dist/factories/index.js +4 -0
- package/dist/factories/index.js.map +1 -1
- package/dist/factories/nats/compositions/index.d.ts +2 -0
- package/dist/factories/nats/compositions/index.d.ts.map +1 -0
- package/dist/factories/nats/compositions/index.js +2 -0
- package/dist/factories/nats/compositions/index.js.map +1 -0
- package/dist/factories/nats/compositions/nats-bootstrap.d.ts +49 -0
- package/dist/factories/nats/compositions/nats-bootstrap.d.ts.map +1 -0
- package/dist/factories/nats/compositions/nats-bootstrap.js +135 -0
- package/dist/factories/nats/compositions/nats-bootstrap.js.map +1 -0
- package/dist/factories/nats/index.d.ts +5 -0
- package/dist/factories/nats/index.d.ts.map +1 -0
- package/dist/factories/nats/index.js +5 -0
- package/dist/factories/nats/index.js.map +1 -0
- package/dist/factories/nats/resources/helm.d.ts +28 -0
- package/dist/factories/nats/resources/helm.d.ts.map +1 -0
- package/dist/factories/nats/resources/helm.js +39 -0
- package/dist/factories/nats/resources/helm.js.map +1 -0
- package/dist/factories/nats/resources/index.d.ts +3 -0
- package/dist/factories/nats/resources/index.d.ts.map +1 -0
- package/dist/factories/nats/resources/index.js +3 -0
- package/dist/factories/nats/resources/index.js.map +1 -0
- package/dist/factories/nats/resources/jetstream.d.ts +13 -0
- package/dist/factories/nats/resources/jetstream.d.ts.map +1 -0
- package/dist/factories/nats/resources/jetstream.js +105 -0
- package/dist/factories/nats/resources/jetstream.js.map +1 -0
- package/dist/factories/nats/types.d.ts +91 -0
- package/dist/factories/nats/types.d.ts.map +1 -0
- package/dist/factories/nats/types.js +72 -0
- package/dist/factories/nats/types.js.map +1 -0
- package/dist/factories/rook/types.d.ts +1 -1
- package/dist/utils/string.d.ts +14 -0
- package/dist/utils/string.d.ts.map +1 -1
- package/dist/utils/string.js +22 -0
- package/dist/utils/string.js.map +1 -1
- package/package.json +5 -1
|
@@ -89,6 +89,80 @@ export declare class KroResourceFactoryImpl<TSpec extends KroCompatibleType, TSt
|
|
|
89
89
|
private getSchemaVersion;
|
|
90
90
|
private getSchemaGroup;
|
|
91
91
|
private getInstanceApiVersion;
|
|
92
|
+
/**
|
|
93
|
+
* Resolve the namespace the KRO instance CR lives in for this call.
|
|
94
|
+
*
|
|
95
|
+
* The default CR placement is the FACTORY namespace (`this.namespace`), exactly
|
|
96
|
+
* as v0.26.0 always did — the maintainer's explicit decision (finding #2). This
|
|
97
|
+
* fixes the silent-relocation regression: an upgrade never moves an existing CR
|
|
98
|
+
* versus the released v0.26.0, and NO per-call `spec.namespace` is consulted for
|
|
99
|
+
* CR placement. An explicit `instanceNamespace` factory option still wins as an
|
|
100
|
+
* override (the only way to place the CR elsewhere).
|
|
101
|
+
*
|
|
102
|
+
* Identity distinctness within a single alchemy stack comes from the instance
|
|
103
|
+
* NAME: the top-level alchemy id is the legacy namespace-agnostic kind+name (see
|
|
104
|
+
* {@link instanceAlchemyId}, finding #1). NOTE: a different k8s factory namespace
|
|
105
|
+
* does NOT by itself create a different alchemy scope — two factories with the same
|
|
106
|
+
* instance name but different namespaces expose the SAME alchemy id and, if
|
|
107
|
+
* materialized in the SAME alchemy stack, collide (last write wins). Isolating
|
|
108
|
+
* same-named instances (e.g. `analytics` in dev vs prod) is the CALLER's
|
|
109
|
+
* responsibility: put them in SEPARATE alchemy stacks/scopes. `spec.namespace` is
|
|
110
|
+
* never consulted for CR placement or identity.
|
|
111
|
+
*
|
|
112
|
+
* The `spec` parameter is accepted only for call-site symmetry with the other
|
|
113
|
+
* resolvers and is deliberately unused (CR placement must not vary per spec, or
|
|
114
|
+
* `getInstances`/`deleteInstance` — which have no spec — could target a different
|
|
115
|
+
* namespace than `deploy` and orphan the CR, finding #3).
|
|
116
|
+
*
|
|
117
|
+
* Finalizer-stranding safety comes from HOISTING the composition's own workload
|
|
118
|
+
* Namespace OUT of the RGD graph (see {@link hoistedNamespaceNames}), not from
|
|
119
|
+
* where the instance CR lives.
|
|
120
|
+
*/
|
|
121
|
+
private resolveInstanceNamespace;
|
|
122
|
+
/**
|
|
123
|
+
* Every Namespace HOISTED out of the RGD graph, mapped to its RAW `metadata.name`
|
|
124
|
+
* value — the UNCONDITIONAL model (typekro NEVER emits a Namespace into RGD YAML).
|
|
125
|
+
* Selection is trivially `kind === 'Namespace'` (excluding `__externalRef`
|
|
126
|
+
* observed namespaces); see {@link selectHoistedNamespaces}.
|
|
127
|
+
*
|
|
128
|
+
* This is a STABLE STRUCTURAL property of the RGD, computed WITHOUT any concrete
|
|
129
|
+
* spec: the set of hoisted ids is IDENTICAL for every instance of this factory, so
|
|
130
|
+
* the shared RGD never changes shape per-instance (deploying instance 2 can't
|
|
131
|
+
* mutate the graph instance 1 depends on). The name VALUES feed the reference
|
|
132
|
+
* rewriter so a reference to a hoisted Namespace's `metadata.name` becomes that
|
|
133
|
+
* Namespace's own concrete name expression.
|
|
134
|
+
*/
|
|
135
|
+
private hoistedNamespaceRefs;
|
|
136
|
+
/**
|
|
137
|
+
* The CONCRETE Namespace resources to emit as SIBLINGS (deps-first, outside the
|
|
138
|
+
* graph) for this spec, keyed by namespace NAME.
|
|
139
|
+
*
|
|
140
|
+
* The set of hoisted IDS is STRUCTURAL (spec-independent); resolving those ids to
|
|
141
|
+
* concrete resources needs the spec. Re-executing the composition against the
|
|
142
|
+
* concrete spec yields the FULL concrete Namespace metadata (name + all labels,
|
|
143
|
+
* incl. Pod Security, + all annotations), which the emission paths PRESERVE and
|
|
144
|
+
* merge retention onto (finding #5) — never a bare synthesized Namespace. A hoisted
|
|
145
|
+
* id that is inactive under THIS spec (e.g. `includeWhen: false`) or whose name
|
|
146
|
+
* can't be resolved is skipped, so emission stays per-spec and order-independent.
|
|
147
|
+
* The map value is the ORIGINAL concrete Namespace resource (keyed by resolved
|
|
148
|
+
* name).
|
|
149
|
+
*/
|
|
150
|
+
private concreteHoistedNamespaces;
|
|
151
|
+
/**
|
|
152
|
+
* The concrete NAMES of the namespaces hoisted out of the graph for this spec —
|
|
153
|
+
* used to tell the ownership guard which owned namespace is now safe (no longer a
|
|
154
|
+
* graph child), and as the singleton keys for sibling emission.
|
|
155
|
+
*/
|
|
156
|
+
private hoistedNamespaceNames;
|
|
157
|
+
/**
|
|
158
|
+
* The resource map serialized into the RGD: `resources` minus EVERY hoisted
|
|
159
|
+
* Namespace, with every remaining reference to a hoisted Namespace's
|
|
160
|
+
* `metadata.name` rewritten to that Namespace's own concrete name expression
|
|
161
|
+
* (finding #3) so the emitted RGD carries no dangling reference to a removed
|
|
162
|
+
* resource. The hoist decision is STRUCTURAL (spec-independent), so the RGD shape
|
|
163
|
+
* is stable across every instance of this factory (finding #4).
|
|
164
|
+
*/
|
|
165
|
+
private resourcesForRgd;
|
|
92
166
|
/**
|
|
93
167
|
* Idempotently create the factory's target namespace if it doesn't
|
|
94
168
|
* exist. KRO does not auto-create the CR's containing namespace, and
|
|
@@ -111,6 +185,16 @@ export declare class KroResourceFactoryImpl<TSpec extends KroCompatibleType, TSt
|
|
|
111
185
|
* step hasn't populated {@link discoveredPlural}.
|
|
112
186
|
*/
|
|
113
187
|
private lookupCRDPlural;
|
|
188
|
+
/**
|
|
189
|
+
* STRICT plural discovery (finding #3, fail-closed). Distinguishes a definitive
|
|
190
|
+
* "CRD absent" (a successful CRD list with no matching definition → fresh cluster)
|
|
191
|
+
* from a discovery FAILURE (RBAC/connectivity/list error) — the latter is NOT proof
|
|
192
|
+
* of absence, so it THROWS rather than being swallowed into `undefined` the way
|
|
193
|
+
* {@link lookupCRDPlural} does. Callers that must fail closed (the pre-hoist safety
|
|
194
|
+
* guard) use this; callers that may fall back to a heuristic keep using
|
|
195
|
+
* {@link lookupCRDPlural}.
|
|
196
|
+
*/
|
|
197
|
+
private discoverGeneratedCrdPlural;
|
|
114
198
|
private requireCRDPluralForCleanup;
|
|
115
199
|
private createKubernetesObjectApi;
|
|
116
200
|
/**
|
|
@@ -160,6 +244,62 @@ export declare class KroResourceFactoryImpl<TSpec extends KroCompatibleType, TSt
|
|
|
160
244
|
* Deploy directly to Kubernetes using DirectDeploymentEngine
|
|
161
245
|
*/
|
|
162
246
|
private deployDirect;
|
|
247
|
+
/**
|
|
248
|
+
* Apply a hoisted workload Namespace as a RETAINED resource OUTSIDE the KRO
|
|
249
|
+
* graph, with its COMPLETE preserved configuration — all labels (incl. Pod
|
|
250
|
+
* Security + schema-derived), all annotations, AND spec — plus retention markers
|
|
251
|
+
* (finding #8), using typekro's own field manager (not KRO's). Server-side apply
|
|
252
|
+
* is idempotent and does not conflict with KRO because KRO no longer considers
|
|
253
|
+
* the Namespace desired.
|
|
254
|
+
*
|
|
255
|
+
* If the full Namespace cannot be applied, this FAILS (finding #8) rather than
|
|
256
|
+
* silently degrading to a bare `ensureTargetNamespace` that would drop Pod
|
|
257
|
+
* Security + other declared configuration.
|
|
258
|
+
*/
|
|
259
|
+
private applyRetainedHoistedNamespace;
|
|
260
|
+
/**
|
|
261
|
+
* FINDING #2 — fail-closed PRE-HOIST detection (detection only; no migration).
|
|
262
|
+
*
|
|
263
|
+
* On deploy, BEFORE the RGD is (re)applied, check every namespace this factory would
|
|
264
|
+
* hoist. If a live namespace is currently a KRO ApplySet member — it carries
|
|
265
|
+
* `applyset.kubernetes.io/part-of` and/or any `kro.run/*` ownership label from a
|
|
266
|
+
* PRE-HOIST RGD (which owned the namespace as a graph child) — then rolling the new,
|
|
267
|
+
* hoisted RGD (which no longer lists the namespace) over the old one makes KRO's
|
|
268
|
+
* ApplySet prune enumerate and DELETE the live namespace, taking the workload with
|
|
269
|
+
* it. We THROW a clear, actionable error instead. This does NOT re-introduce the
|
|
270
|
+
* removed automatic migration/drain/strip machinery — it only refuses to proceed.
|
|
271
|
+
*
|
|
272
|
+
* typekro's own v2 sibling namespaces carry `typekro.io/kro-instance-namespace=true`
|
|
273
|
+
* but NEITHER an ApplySet `part-of` NOR any `kro.run/*` label (KRO never owns them),
|
|
274
|
+
* so steady-state re-deploys never trip this. A 404 (fresh) is not a pre-hoist signal.
|
|
275
|
+
*
|
|
276
|
+
* FINDING #7 (hardened): the check covers not only the namespaces resolved from the
|
|
277
|
+
* INCOMING spec but EVERY existing instance of this shared RGD (their hoisted
|
|
278
|
+
* namespaces too) — an upgrade prunes the ApplySet for ALL of them at once, so
|
|
279
|
+
* missing another instance's namespace would let KRO delete it. And reads FAIL
|
|
280
|
+
* CLOSED: a non-404 read error is NOT proof of safety, so it ABORTS the deploy
|
|
281
|
+
* rather than being skipped.
|
|
282
|
+
*/
|
|
283
|
+
private assertNoPreHoistNamespaceConflict;
|
|
284
|
+
/**
|
|
285
|
+
* The hoisted-namespace names of EVERY existing instance of this shared RGD (finding
|
|
286
|
+
* #7), resolved EXACTLY and PER INSTANCE from that instance's OWN durable record
|
|
287
|
+
* (finding #1, v7) — never approximated, and never from an RGD-wide aggregate.
|
|
288
|
+
*
|
|
289
|
+
* Each instance's namespaces come from its OWN CR `typekro.io/hoisted-namespaces`
|
|
290
|
+
* annotation — the only PER-INSTANCE proof. An instance that lacks its own record (a
|
|
291
|
+
* genuinely-legacy deployment) FAILS CLOSED (throws): the RGD-wide set of Namespaces
|
|
292
|
+
* carrying `typekro.io/created-by-rgd == this.rgdName` is NOT per-instance proof — a
|
|
293
|
+
* DIFFERENT (modern) instance could have stamped it, so a non-empty RGD-wide set would
|
|
294
|
+
* otherwise MASK a legacy instance whose own — possibly different — namespace is invisible
|
|
295
|
+
* and would be pruned. We also never approximate from metadata.namespace / spec.namespace.
|
|
296
|
+
*
|
|
297
|
+
* The RGD-wide `created-by-rgd` set IS still unioned into the returned protected set (it
|
|
298
|
+
* is a superset that catches namespaces leaked by an interrupted teardown) — it just never
|
|
299
|
+
* SATISFIES the per-instance check. FRESH clusters (no CRD / no instances yet) yield an
|
|
300
|
+
* empty set; any list error FAILS CLOSED so the guard is never silently bypassed.
|
|
301
|
+
*/
|
|
302
|
+
private existingInstancesHoistedNamespaceNames;
|
|
163
303
|
/**
|
|
164
304
|
* Get all deployed instances
|
|
165
305
|
*/
|
|
@@ -173,6 +313,13 @@ export declare class KroResourceFactoryImpl<TSpec extends KroCompatibleType, TSt
|
|
|
173
313
|
scopes?: string[];
|
|
174
314
|
includeUnscopedResources?: boolean;
|
|
175
315
|
}): Promise<void>;
|
|
316
|
+
/**
|
|
317
|
+
* BEST-EFFORT deletion of this factory's generated CRD, the LAST teardown step (after
|
|
318
|
+
* the owned namespace is gone). Never throws: a slow/stuck apiextensions cleanup
|
|
319
|
+
* finalizer (upstream kro #1171) must not fail an otherwise-complete teardown, and by
|
|
320
|
+
* this point nothing depends on the CRD being gone. Logs the outcome.
|
|
321
|
+
*/
|
|
322
|
+
private deleteGeneratedCrdBestEffort;
|
|
176
323
|
/**
|
|
177
324
|
* Emit this factory's KRO deployment as declarative alchemy **v2** resources — the v2
|
|
178
325
|
* analog of the removed imperative `deployWithAlchemy(scope)`. Returns, in dependency order, a
|
|
@@ -197,6 +344,24 @@ export declare class KroResourceFactoryImpl<TSpec extends KroCompatibleType, TSt
|
|
|
197
344
|
instanceNameOverride?: string;
|
|
198
345
|
singletonSpecFingerprint?: string;
|
|
199
346
|
}): Promise<AlchemyResourceDeclaration[]>;
|
|
347
|
+
/**
|
|
348
|
+
* The alchemy resource id for a KRO instance CR — the LEGACY, namespace-agnostic
|
|
349
|
+
* kind+name id (finding #1).
|
|
350
|
+
*
|
|
351
|
+
* This deliberately does NOT fold the namespace into the id. An earlier revision
|
|
352
|
+
* appended a namespace hash to distinguish same-named instances placed in
|
|
353
|
+
* different namespaces, but that changed every existing instance's id versus the
|
|
354
|
+
* released v0.26.0, so alchemy would see remove+replace and could tear down
|
|
355
|
+
* (delete) the live CR on upgrade. Reverting to the legacy id keeps existing
|
|
356
|
+
* alchemy state identity stable.
|
|
357
|
+
*
|
|
358
|
+
* Consequence to be honest about: within ONE alchemy stack, two instances collide
|
|
359
|
+
* iff they share this kind+name id — regardless of their k8s namespace. A
|
|
360
|
+
* different factory namespace does NOT automatically yield a different alchemy
|
|
361
|
+
* scope. To keep same-named instances (e.g. `analytics` in dev vs prod) separate,
|
|
362
|
+
* the CALLER must materialize them in SEPARATE alchemy stacks/scopes.
|
|
363
|
+
*/
|
|
364
|
+
private instanceAlchemyId;
|
|
200
365
|
/** Serialize the factory's cluster connection so an alchemy resource can reconnect after rehydration. */
|
|
201
366
|
private extractKubeConfigOptionsForAlchemy;
|
|
202
367
|
/** Build the finalizer-safe, shared-RGD-aware deletion metadata for this factory's instances. */
|
|
@@ -228,8 +393,21 @@ export declare class KroResourceFactoryImpl<TSpec extends KroCompatibleType, TSt
|
|
|
228
393
|
* step — it's applied inline during ref-to-CEL conversion via
|
|
229
394
|
* `SerializationContext.omitFields`, which `serializeResourceGraphToYaml`
|
|
230
395
|
* populates from `kroSchema.__omitFields` automatically.
|
|
396
|
+
*
|
|
397
|
+
* The hoist decision is SPEC-INDEPENDENT (finding #4): the RGD is shared by every
|
|
398
|
+
* instance of this factory, so its shape must be a stable structural property and
|
|
399
|
+
* must NOT vary with a per-call spec. `spec` is accepted only for signature
|
|
400
|
+
* symmetry with the callers and is deliberately NOT used to decide hoisting — see
|
|
401
|
+
* {@link hoistedNamespaceRefs} / {@link resourcesForRgd}.
|
|
231
402
|
*/
|
|
232
403
|
private buildRgdYaml;
|
|
404
|
+
/**
|
|
405
|
+
* Assert the emitted RGD carries NO leftover reference to a hoisted (removed)
|
|
406
|
+
* resource id — neither a CEL interpolation `${<id>.…}` nor a raw
|
|
407
|
+
* `__KUBERNETES_REF_<id>_…` marker (finding #6). A negative lookbehind avoids
|
|
408
|
+
* matching an id that is only a suffix of a longer identifier.
|
|
409
|
+
*/
|
|
410
|
+
private assertNoDanglingHoistedReferences;
|
|
233
411
|
/**
|
|
234
412
|
* Strict CEL diagnostics: verify that every dynamic status CEL expression
|
|
235
413
|
* references only resources that exist in this graph.
|
|
@@ -251,7 +429,10 @@ export declare class KroResourceFactoryImpl<TSpec extends KroCompatibleType, TSt
|
|
|
251
429
|
*/
|
|
252
430
|
private addRgdSchemaStatusPruneMarkers;
|
|
253
431
|
/**
|
|
254
|
-
* Ensure the ResourceGraphDefinition is deployed using DirectDeploymentEngine
|
|
432
|
+
* Ensure the ResourceGraphDefinition is deployed using DirectDeploymentEngine.
|
|
433
|
+
*
|
|
434
|
+
* The `spec` (when the caller has one) lets the RGD hoist the composition's own
|
|
435
|
+
* workload Namespace out of the graph with its schema-driven name resolved.
|
|
255
436
|
*/
|
|
256
437
|
private ensureRGDDeployed;
|
|
257
438
|
private applyKroPrerequisites;
|
|
@@ -321,6 +502,72 @@ export declare class KroResourceFactoryImpl<TSpec extends KroCompatibleType, TSt
|
|
|
321
502
|
* Create custom resource instance
|
|
322
503
|
*/
|
|
323
504
|
private createCustomResourceInstance;
|
|
505
|
+
/**
|
|
506
|
+
* Labels/annotations marking a hoisted workload Namespace as SHARED, RETAINED
|
|
507
|
+
* infrastructure that must survive any single consumer's teardown/prune.
|
|
508
|
+
*
|
|
509
|
+
* Retention is declared for BOTH major GitOps reconcilers, not just Flux, so a
|
|
510
|
+
* prune (or an Application deletion) by whichever tool manages a consuming app
|
|
511
|
+
* can never delete this shared namespace (and with it every OTHER stack's
|
|
512
|
+
* resources living inside it):
|
|
513
|
+
* - `kustomize.toolkit.fluxcd.io/prune: disabled` — Flux Kustomize.
|
|
514
|
+
* - `argocd.argoproj.io/sync-options: Prune=false,Delete=false` — Argo CD.
|
|
515
|
+
* `Delete=false` is what survives an Argo Application DELETION, not merely a
|
|
516
|
+
* sync-prune (`Prune=false` alone does NOT).
|
|
517
|
+
* The alchemy path pairs these with a `retain` prop (see
|
|
518
|
+
* {@link hoistedNamespaceAlchemyDeclaration}) that skips delete. For any other
|
|
519
|
+
* GitOps tool, pre-create the workload namespace out-of-band.
|
|
520
|
+
*/
|
|
521
|
+
private static readonly INSTANCE_NAMESPACE_METADATA;
|
|
522
|
+
/**
|
|
523
|
+
* The collision-free singleton id for a hoisted workload Namespace, deduped by
|
|
524
|
+
* the namespace NAME (finding #7). {@link toCamelCase} alone destroys separators
|
|
525
|
+
* (`foo-bar` and `foo--bar` both camel-case to `fooBar`), so two DISTINCT
|
|
526
|
+
* namespaces would collapse to one id — silently deduping unrelated namespaces
|
|
527
|
+
* into a single retained resource. Appending a stable hash of the RAW name keeps
|
|
528
|
+
* distinct names distinct while staying deterministic (same name → same id, so
|
|
529
|
+
* the intended cross-factory dedup still holds).
|
|
530
|
+
*/
|
|
531
|
+
private static hoistedNamespaceId;
|
|
532
|
+
/**
|
|
533
|
+
* Resolve a single Namespace metadata VALUE (a label/annotation value) against
|
|
534
|
+
* the concrete spec to its final string form (finding #8). Handles:
|
|
535
|
+
* - plain strings (kept verbatim),
|
|
536
|
+
* - numbers / booleans (stringified — a "non-string" declared value),
|
|
537
|
+
* - schema-derived CEL expressions / KubernetesRefs (resolved to the concrete
|
|
538
|
+
* value; re-execution already collapsed the schema ref, but this evaluates
|
|
539
|
+
* it against the spec for robustness).
|
|
540
|
+
* Returns `undefined` for a value that cannot be resolved to a string, so the
|
|
541
|
+
* caller drops only genuinely-unresolvable entries rather than the whole class of
|
|
542
|
+
* non-string / schema-derived metadata (the old string-only filter dropped them).
|
|
543
|
+
*/
|
|
544
|
+
private static resolveMetadataStringValue;
|
|
545
|
+
/**
|
|
546
|
+
* Merge the SHARED/RETAINED marker labels + annotations onto an ORIGINAL,
|
|
547
|
+
* fully-concrete Namespace resource, PRESERVING the COMPLETE declared config
|
|
548
|
+
* (findings #6 + #8): ALL labels — including Pod Security (`pod-security.kubernetes.io/*`)
|
|
549
|
+
* AND non-string / schema-derived labels resolved against the spec — ALL
|
|
550
|
+
* annotations, the remaining declarative ObjectMeta (`finalizers`,
|
|
551
|
+
* `ownerReferences`), AND the Namespace `spec` (e.g. `spec.finalizers`). The
|
|
552
|
+
* retention markers are added on top.
|
|
553
|
+
*/
|
|
554
|
+
private static mergedHoistedNamespaceMetadata;
|
|
555
|
+
/**
|
|
556
|
+
* A workload Namespace this composition owns, HOISTED out of the RGD graph and
|
|
557
|
+
* emitted as a retained resource instead. It is created OUTSIDE the KRO graph —
|
|
558
|
+
* deps-first in GitOps/alchemy, and applied directly in the imperative path — so
|
|
559
|
+
* KRO never garbage-collects it and the instance's finalizer can never be
|
|
560
|
+
* stranded by its own namespace terminating.
|
|
561
|
+
*
|
|
562
|
+
* The COMPLETE original Namespace configuration is preserved (finding #5) — see
|
|
563
|
+
* {@link mergedHoistedNamespaceMetadata}. It is a SHARED SINGLETON deduped by the
|
|
564
|
+
* namespace NAME (collision-free id, see {@link hoistedNamespaceId}), so every
|
|
565
|
+
* consumer/stack targeting the SAME workload namespace emits the SAME declaration
|
|
566
|
+
* — alchemy dedupes them to one retained owner rather than N fighting copies.
|
|
567
|
+
*/
|
|
568
|
+
private buildHoistedNamespaceResource;
|
|
569
|
+
private hoistedNamespaceAlchemyDeclaration;
|
|
570
|
+
private hoistedNamespaceYaml;
|
|
324
571
|
private assertInstanceNamespaceOwnershipSafe;
|
|
325
572
|
private assertSingletonOwnersNamespaceOwnershipSafe;
|
|
326
573
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kro-factory.d.ts","sourceRoot":"","sources":["../../../src/core/deployment/kro-factory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,OAAO,KAAK,EACV,0BAA0B,EAE3B,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"kro-factory.d.ts","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