@ankhorage/kubernetes 0.8.1 → 0.9.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 +1 -1
- package/dist/features/workload-reconciliation/adapters/createKubectlKubernetesApi.d.ts +2 -2
- package/dist/features/workload-reconciliation/adapters/createKubectlKubernetesApi.d.ts.map +1 -1
- package/dist/features/workload-reconciliation/adapters/createKubectlKubernetesApi.js +3 -3
- package/dist/features/workload-reconciliation/adapters/createKubectlKubernetesApi.js.map +1 -1
- package/dist/features/workload-reconciliation/adapters/createSubprocessKubernetesCommandRunner.d.ts +1 -1
- package/dist/features/workload-reconciliation/adapters/createSubprocessKubernetesCommandRunner.d.ts.map +1 -1
- package/dist/features/workload-reconciliation/adapters/createSubprocessKubernetesCommandRunner.js.map +1 -1
- package/dist/features/workload-reconciliation/adapters/kubectlResource.d.ts +1 -1
- package/dist/features/workload-reconciliation/adapters/kubectlResource.d.ts.map +1 -1
- package/dist/features/workload-reconciliation/adapters/kubectlResource.js.map +1 -1
- package/dist/features/workload-reconciliation/adapters/observeKubectlDeploymentPodFailureAsync.d.ts +2 -2
- package/dist/features/workload-reconciliation/adapters/observeKubectlDeploymentPodFailureAsync.d.ts.map +1 -1
- package/dist/features/workload-reconciliation/adapters/observeKubectlDeploymentPodFailureAsync.js.map +1 -1
- package/dist/features/workload-reconciliation/application/use-cases/createKubernetesController.d.ts +2 -2
- package/dist/features/workload-reconciliation/application/use-cases/createKubernetesController.d.ts.map +1 -1
- package/dist/features/workload-reconciliation/application/use-cases/createKubernetesController.js +15 -7
- package/dist/features/workload-reconciliation/application/use-cases/createKubernetesController.js.map +1 -1
- package/dist/features/workload-reconciliation/application/use-cases/createKubernetesExposure.d.ts +2 -2
- package/dist/features/workload-reconciliation/application/use-cases/createKubernetesExposure.d.ts.map +1 -1
- package/dist/features/workload-reconciliation/application/use-cases/createKubernetesExposure.js +11 -9
- package/dist/features/workload-reconciliation/application/use-cases/createKubernetesExposure.js.map +1 -1
- package/dist/features/workload-reconciliation/application/use-cases/createKubernetesPrerequisites.d.ts +2 -2
- package/dist/features/workload-reconciliation/application/use-cases/createKubernetesPrerequisites.d.ts.map +1 -1
- package/dist/features/workload-reconciliation/application/use-cases/createKubernetesPrerequisites.js +4 -4
- package/dist/features/workload-reconciliation/application/use-cases/createKubernetesPrerequisites.js.map +1 -1
- package/dist/features/workload-reconciliation/application/use-cases/getKubernetesOutputsAsync.d.ts +1 -1
- package/dist/features/workload-reconciliation/application/use-cases/getKubernetesOutputsAsync.d.ts.map +1 -1
- package/dist/features/workload-reconciliation/application/use-cases/getKubernetesOutputsAsync.js +3 -3
- package/dist/features/workload-reconciliation/application/use-cases/getKubernetesOutputsAsync.js.map +1 -1
- package/dist/features/workload-reconciliation/application/use-cases/getKubernetesStatusAsync.d.ts +1 -1
- package/dist/features/workload-reconciliation/application/use-cases/getKubernetesStatusAsync.d.ts.map +1 -1
- package/dist/features/workload-reconciliation/application/use-cases/getKubernetesStatusAsync.js +3 -3
- package/dist/features/workload-reconciliation/application/use-cases/getKubernetesStatusAsync.js.map +1 -1
- package/dist/features/workload-reconciliation/application/use-cases/materializeKubernetesSecretsAsync.d.ts +2 -2
- package/dist/features/workload-reconciliation/application/use-cases/materializeKubernetesSecretsAsync.d.ts.map +1 -1
- package/dist/features/workload-reconciliation/application/use-cases/materializeKubernetesSecretsAsync.js +1 -1
- package/dist/features/workload-reconciliation/application/use-cases/materializeKubernetesSecretsAsync.js.map +1 -1
- package/dist/features/workload-reconciliation/application/use-cases/planKubernetesResourcesAsync.d.ts +1 -1
- package/dist/features/workload-reconciliation/application/use-cases/planKubernetesResourcesAsync.d.ts.map +1 -1
- package/dist/features/workload-reconciliation/application/use-cases/planKubernetesResourcesAsync.js +1 -1
- package/dist/features/workload-reconciliation/application/use-cases/planKubernetesResourcesAsync.js.map +1 -1
- package/dist/features/workload-reconciliation/application/use-cases/prepareKubernetesChangesAsync.d.ts +2 -2
- package/dist/features/workload-reconciliation/application/use-cases/prepareKubernetesChangesAsync.d.ts.map +1 -1
- package/dist/features/workload-reconciliation/application/use-cases/prepareKubernetesChangesAsync.js +8 -8
- package/dist/features/workload-reconciliation/application/use-cases/prepareKubernetesChangesAsync.js.map +1 -1
- package/dist/features/workload-reconciliation/application/use-cases/projectKubernetesResourcesAsync.d.ts +2 -2
- package/dist/features/workload-reconciliation/application/use-cases/projectKubernetesResourcesAsync.d.ts.map +1 -1
- package/dist/features/workload-reconciliation/application/use-cases/projectKubernetesResourcesAsync.js +5 -5
- package/dist/features/workload-reconciliation/application/use-cases/projectKubernetesResourcesAsync.js.map +1 -1
- package/dist/features/workload-reconciliation/application/use-cases/projectKubernetesWorkload.d.ts +2 -2
- package/dist/features/workload-reconciliation/application/use-cases/projectKubernetesWorkload.d.ts.map +1 -1
- package/dist/features/workload-reconciliation/application/use-cases/projectKubernetesWorkload.js +8 -6
- package/dist/features/workload-reconciliation/application/use-cases/projectKubernetesWorkload.js.map +1 -1
- package/dist/features/workload-reconciliation/application/use-cases/reconcileKubernetesResourcesAsync.d.ts +1 -1
- package/dist/features/workload-reconciliation/application/use-cases/reconcileKubernetesResourcesAsync.d.ts.map +1 -1
- package/dist/features/workload-reconciliation/application/use-cases/reconcileKubernetesResourcesAsync.js +5 -5
- package/dist/features/workload-reconciliation/application/use-cases/reconcileKubernetesResourcesAsync.js.map +1 -1
- package/dist/features/workload-reconciliation/application/use-cases/removeKubernetesResourcesAsync.d.ts +1 -1
- package/dist/features/workload-reconciliation/application/use-cases/removeKubernetesResourcesAsync.d.ts.map +1 -1
- package/dist/features/workload-reconciliation/application/use-cases/removeKubernetesResourcesAsync.js +4 -4
- package/dist/features/workload-reconciliation/application/use-cases/removeKubernetesResourcesAsync.js.map +1 -1
- package/dist/features/workload-reconciliation/application/use-cases/resolveKubernetesWorkloadValues.d.ts +1 -1
- package/dist/features/workload-reconciliation/application/use-cases/resolveKubernetesWorkloadValues.d.ts.map +1 -1
- package/dist/features/workload-reconciliation/application/use-cases/resolveKubernetesWorkloadValues.js +5 -3
- package/dist/features/workload-reconciliation/application/use-cases/resolveKubernetesWorkloadValues.js.map +1 -1
- package/dist/features/workload-reconciliation/application/use-cases/validateKubernetesWorkloads.js +1 -1
- package/dist/features/workload-reconciliation/application/use-cases/validateKubernetesWorkloads.js.map +1 -1
- package/dist/features/workload-reconciliation/application/use-cases/waitForKubernetesReadinessAsync.d.ts +1 -1
- package/dist/features/workload-reconciliation/application/use-cases/waitForKubernetesReadinessAsync.d.ts.map +1 -1
- package/dist/features/workload-reconciliation/application/use-cases/waitForKubernetesReadinessAsync.js +3 -3
- package/dist/features/workload-reconciliation/application/use-cases/waitForKubernetesReadinessAsync.js.map +1 -1
- package/dist/features/workload-reconciliation/composition/createKubernetesDriver.d.ts +1 -1
- package/dist/features/workload-reconciliation/composition/createKubernetesDriver.d.ts.map +1 -1
- package/dist/features/workload-reconciliation/composition/createKubernetesDriver.js +7 -7
- package/dist/features/workload-reconciliation/composition/createKubernetesDriver.js.map +1 -1
- package/dist/features/workload-reconciliation/utils/areKubernetesResourcesEquivalent.d.ts +1 -1
- package/dist/features/workload-reconciliation/utils/areKubernetesResourcesEquivalent.d.ts.map +1 -1
- package/dist/features/workload-reconciliation/utils/areKubernetesResourcesEquivalent.js.map +1 -1
- package/dist/features/workload-reconciliation/utils/createKubernetesDesiredResource.d.ts +2 -2
- package/dist/features/workload-reconciliation/utils/createKubernetesDesiredResource.d.ts.map +1 -1
- package/dist/features/workload-reconciliation/utils/createKubernetesDesiredResource.js +4 -4
- package/dist/features/workload-reconciliation/utils/createKubernetesDesiredResource.js.map +1 -1
- package/dist/features/workload-reconciliation/utils/createKubernetesIdentity.d.ts +1 -1
- package/dist/features/workload-reconciliation/utils/createKubernetesIdentity.d.ts.map +1 -1
- package/dist/features/workload-reconciliation/utils/createKubernetesIdentity.js.map +1 -1
- package/dist/features/workload-reconciliation/utils/getKubernetesOwnershipQuery.d.ts +2 -2
- package/dist/features/workload-reconciliation/utils/getKubernetesOwnershipQuery.d.ts.map +1 -1
- package/dist/features/workload-reconciliation/utils/getKubernetesOwnershipQuery.js +2 -2
- package/dist/features/workload-reconciliation/utils/getKubernetesOwnershipQuery.js.map +1 -1
- package/dist/features/workload-reconciliation/utils/getKubernetesResourceKey.d.ts +1 -1
- package/dist/features/workload-reconciliation/utils/getKubernetesResourceKey.d.ts.map +1 -1
- package/dist/features/workload-reconciliation/utils/getKubernetesResourceKey.js.map +1 -1
- package/dist/features/workload-reconciliation/utils/getKubernetesResourceReference.d.ts +1 -1
- package/dist/features/workload-reconciliation/utils/getKubernetesResourceReference.d.ts.map +1 -1
- package/dist/features/workload-reconciliation/utils/getKubernetesResourceReference.js.map +1 -1
- package/dist/features/workload-reconciliation/utils/readKubernetesOwnedResource.d.ts +2 -2
- package/dist/features/workload-reconciliation/utils/readKubernetesOwnedResource.d.ts.map +1 -1
- package/dist/features/workload-reconciliation/utils/readKubernetesOwnedResource.js +3 -3
- package/dist/features/workload-reconciliation/utils/readKubernetesOwnedResource.js.map +1 -1
- package/dist/features/workload-reconciliation/utils/sortKubernetesResourcesForRemoval.d.ts +1 -1
- package/dist/features/workload-reconciliation/utils/sortKubernetesResourcesForRemoval.d.ts.map +1 -1
- package/dist/features/workload-reconciliation/utils/sortKubernetesResourcesForRemoval.js.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/types/kubectl.d.ts +1 -1
- package/dist/types/kubectl.d.ts.map +1 -1
- package/dist/types/kubectl.js.map +1 -1
- package/dist/types/kubernetesDriver.d.ts +1 -1
- package/dist/types/kubernetesDriver.d.ts.map +1 -1
- package/dist/types/kubernetesDriver.js.map +1 -1
- package/package.json +4 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reconcileKubernetesResourcesAsync.js","sourceRoot":"","sources":["../../../../../src/features/workload-reconciliation/application/use-cases/reconcileKubernetesResourcesAsync.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,OAAO;QACL,EAAE,EAAE,KAAK;QACT,WAAW,EAAE;YACX;gBACE,QAAQ,EAAE,OAAO;gBACjB,IAAI,EAAE,6BAA6B;gBACnC,OAAO,EAAE,sDAAsD;aAChE;SACF;KACF,CAAC;AACJ,CAAC","sourcesContent":["import type {\n InfraDiagnostic,\n InfraOwnedResource,\n InfraReconcileResult,\n InfraResult,\n} from '@ankhorage/contracts/infra';\n\nimport type {\n KubernetesDriverOptions,\n KubernetesDriverRequest,\n} from '../../../../types/kubernetesDriver';\nimport type {\n KubernetesDesiredResource,\n KubernetesPreparedChange,\n KubernetesResourceObservation,\n} from '../../../../types/kubernetesResources';\nimport {\n KUBERNETES_DEFAULT_READINESS_TIMEOUT_SECONDS,\n KUBERNETES_READINESS_KINDS,\n} from '../../constants';\nimport { getKubernetesResourceReference } from '../../utils/getKubernetesResourceReference';\nimport { readKubernetesOwnedResource } from '../../utils/readKubernetesOwnedResource';\nimport { getKubernetesOutputsAsync } from './getKubernetesOutputsAsync';\nimport { prepareKubernetesChangesAsync } from './prepareKubernetesChangesAsync';\n\n/*** Apply desired changes dependency-first and prune only obsolete, non-persistent Infra resources. */\nexport async function reconcileKubernetesResourcesAsync(\n options: KubernetesDriverOptions,\n request: KubernetesDriverRequest,\n): Promise<InfraResult<InfraReconcileResult>> {\n const prepared = await prepareKubernetesChangesAsync(options, request);\n if (!prepared.ok) return prepared;\n\n const desiredByResourceId = new Map(\n prepared.value.projection.resources.map((desired) => [\n desired.owner.identity.resourceId,\n desired,\n ]),\n );\n const timeoutSeconds =\n options.defaultReadinessTimeoutSeconds ?? KUBERNETES_DEFAULT_READINESS_TIMEOUT_SECONDS;\n const deadline = Date.now() + timeoutSeconds * 1_000;\n\n try {\n const reconciled = await applyKubernetesChangesAsync(\n options,\n request,\n prepared.value.changes,\n desiredByResourceId,\n deadline,\n );\n if (!reconciled.ok) return reconciled;\n const outputs = await getKubernetesOutputsAsync(options, request);\n if (!outputs.ok) return outputs;\n return {\n ok: true,\n value: {\n resources: [\n ...prepared.value.projection.resources.map(({ owner }) => owner),\n ...reconciled.value,\n ],\n outputs: outputs.value,\n },\n diagnostics: [],\n };\n } catch {\n return createReconcileFailure();\n }\n}\n\n/*** Apply prepared changes while enforcing readiness-relevant dependency gates. */\nasync function applyKubernetesChangesAsync(\n options: KubernetesDriverOptions,\n request: KubernetesDriverRequest,\n changes: readonly KubernetesPreparedChange[],\n desiredByResourceId: ReadonlyMap<string, KubernetesDesiredResource>,\n deadline: number,\n): Promise<InfraResult<readonly InfraOwnedResource[]>> {\n const retained: InfraOwnedResource[] = [];\n for (const change of changes) {\n if (\n (change.action.operation === 'create' || change.action.operation === 'update') &&\n change.desired !== undefined\n ) {\n const dependencyFailure = await waitForDependenciesAsync(\n options,\n request,\n change.desired,\n desiredByResourceId,\n deadline,\n );\n if (dependencyFailure !== undefined) {\n return { ok: false, diagnostics: [dependencyFailure] };\n }\n await options.api.applyAsync(change.desired.resource, request.context.signal);\n }\n if (change.action.operation === 'delete' && change.actual !== undefined) {\n await options.api.deleteAsync(\n getKubernetesResourceReference(change.actual),\n request.context.signal,\n );\n }\n if (change.action.operation === 'retain' && change.actual !== undefined) {\n const owner = readKubernetesOwnedResource(change.actual, request);\n if (owner !== undefined) retained.push(owner);\n }\n }\n return { ok: true, value: retained, diagnostics: [] };\n}\n\n/*** Wait for readiness-relevant dependencies before applying one desired Kubernetes resource. */\nasync function waitForDependenciesAsync(\n options: KubernetesDriverOptions,\n request: KubernetesDriverRequest,\n desired: KubernetesDesiredResource,\n desiredByResourceId: ReadonlyMap<string, KubernetesDesiredResource>,\n deadline: number,\n): Promise<InfraDiagnostic | undefined> {\n for (const dependencyOwner of desired.owner.dependsOn) {\n const dependency = desiredByResourceId.get(dependencyOwner.resourceId);\n if (dependency === undefined || !KUBERNETES_READINESS_KINDS.has(dependency.resource.kind)) {\n continue;\n }\n const observation = await waitForDependencyAsync(options, request, dependency, deadline);\n if (observation.state !== 'ready') {\n return createDependencyReadinessDiagnostic(dependency, observation);\n }\n }\n return undefined;\n}\n\n/*** Wait for one dependency within the reconciliation pass shared readiness deadline. */\nfunction waitForDependencyAsync(\n options: KubernetesDriverOptions,\n request: KubernetesDriverRequest,\n dependency: KubernetesDesiredResource,\n deadline: number,\n): Promise<KubernetesResourceObservation> {\n const remainingSeconds = Math.max(0, Math.ceil((deadline - Date.now()) / 1_000));\n if (remainingSeconds === 0) {\n return Promise.resolve({\n state: 'degraded',\n detail: 'The shared Kubernetes readiness deadline expired.',\n });\n }\n return options.api.waitUntilReadyAsync(getKubernetesResourceReference(dependency.resource), {\n timeoutSeconds: remainingSeconds,\n ...(request.context.signal === undefined ? {} : { signal: request.context.signal }),\n });\n}\n\n/*** Create an actionable diagnostic for a dependency that did not become ready. */\nfunction createDependencyReadinessDiagnostic(\n dependency: KubernetesDesiredResource,\n observation: KubernetesResourceObservation,\n): InfraDiagnostic {\n const detail = observation.detail === undefined ? '' : ` ${observation.detail}`;\n return {\n severity: 'error',\n code: 'kubernetes-dependency-readiness-failed',\n message: `Kubernetes dependency ${dependency.owner.identity.resourceId} is ${observation.state}.${detail}`,\n owner: dependency.owner.identity,\n };\n}\n\n/*** Create the generic failure returned when reconciliation throws unexpectedly. */\nfunction createReconcileFailure(): InfraResult<InfraReconcileResult> {\n return {\n ok: false,\n diagnostics: [\n {\n severity: 'error',\n code: 'kubernetes-reconcile-failed',\n message: 'Kubernetes resources could not be reconciled safely.',\n },\n ],\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"reconcileKubernetesResourcesAsync.js","sourceRoot":"","sources":["../../../../../src/features/workload-reconciliation/application/use-cases/reconcileKubernetesResourcesAsync.ts"],"names":[],"mappings":"AAgBA,OAAO,EACL,4CAA4C,EAC5C,0BAA0B,GAC3B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,8BAA8B,EAAE,MAAM,+CAA+C,CAAC;AAC/F,OAAO,EAAE,2BAA2B,EAAE,MAAM,4CAA4C,CAAC;AACzF,OAAO,EAAE,y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raReconcileResult,\n InfraResult,\n} from '@ankhorage/contracts/infra';\n\nimport type {\n KubernetesDriverOptions,\n KubernetesDriverRequest,\n} from '../../../../types/kubernetesDriver.js';\nimport type {\n KubernetesDesiredResource,\n KubernetesPreparedChange,\n KubernetesResourceObservation,\n} from '../../../../types/kubernetesResources.js';\nimport {\n KUBERNETES_DEFAULT_READINESS_TIMEOUT_SECONDS,\n KUBERNETES_READINESS_KINDS,\n} from '../../constants.js';\nimport { getKubernetesResourceReference } from '../../utils/getKubernetesResourceReference.js';\nimport { readKubernetesOwnedResource } from '../../utils/readKubernetesOwnedResource.js';\nimport { getKubernetesOutputsAsync } from './getKubernetesOutputsAsync.js';\nimport { prepareKubernetesChangesAsync } from './prepareKubernetesChangesAsync.js';\n\n/*** Apply desired changes dependency-first and prune only obsolete, non-persistent Infra resources. */\nexport async function reconcileKubernetesResourcesAsync(\n options: KubernetesDriverOptions,\n request: KubernetesDriverRequest,\n): Promise<InfraResult<InfraReconcileResult>> {\n const prepared = await prepareKubernetesChangesAsync(options, request);\n if (!prepared.ok) return prepared;\n\n const desiredByResourceId = new Map(\n prepared.value.projection.resources.map((desired) => [\n desired.owner.identity.resourceId,\n desired,\n ]),\n );\n const timeoutSeconds =\n options.defaultReadinessTimeoutSeconds ?? KUBERNETES_DEFAULT_READINESS_TIMEOUT_SECONDS;\n const deadline = Date.now() + timeoutSeconds * 1_000;\n\n try {\n const reconciled = await applyKubernetesChangesAsync(\n options,\n request,\n prepared.value.changes,\n desiredByResourceId,\n deadline,\n );\n if (!reconciled.ok) return reconciled;\n const outputs = await getKubernetesOutputsAsync(options, request);\n if (!outputs.ok) return outputs;\n return {\n ok: true,\n value: {\n resources: [\n ...prepared.value.projection.resources.map(({ owner }) => owner),\n ...reconciled.value,\n ],\n outputs: outputs.value,\n },\n diagnostics: [],\n };\n } catch {\n return createReconcileFailure();\n }\n}\n\n/*** Apply prepared changes while enforcing readiness-relevant dependency gates. */\nasync function applyKubernetesChangesAsync(\n options: KubernetesDriverOptions,\n request: KubernetesDriverRequest,\n changes: readonly KubernetesPreparedChange[],\n desiredByResourceId: ReadonlyMap<string, KubernetesDesiredResource>,\n deadline: number,\n): Promise<InfraResult<readonly InfraOwnedResource[]>> {\n const retained: InfraOwnedResource[] = [];\n for (const change of changes) {\n if (\n (change.action.operation === 'create' || change.action.operation === 'update') &&\n change.desired !== undefined\n ) {\n const dependencyFailure = await waitForDependenciesAsync(\n options,\n request,\n change.desired,\n desiredByResourceId,\n deadline,\n );\n if (dependencyFailure !== undefined) {\n return { ok: false, diagnostics: [dependencyFailure] };\n }\n await options.api.applyAsync(change.desired.resource, request.context.signal);\n }\n if (change.action.operation === 'delete' && change.actual !== undefined) {\n await options.api.deleteAsync(\n getKubernetesResourceReference(change.actual),\n request.context.signal,\n );\n }\n if (change.action.operation === 'retain' && change.actual !== undefined) {\n const owner = readKubernetesOwnedResource(change.actual, request);\n if (owner !== undefined) retained.push(owner);\n }\n }\n return { ok: true, value: retained, diagnostics: [] };\n}\n\n/*** Wait for readiness-relevant dependencies before applying one desired Kubernetes resource. */\nasync function waitForDependenciesAsync(\n options: KubernetesDriverOptions,\n request: KubernetesDriverRequest,\n desired: KubernetesDesiredResource,\n desiredByResourceId: ReadonlyMap<string, KubernetesDesiredResource>,\n deadline: number,\n): Promise<InfraDiagnostic | undefined> {\n for (const dependencyOwner of desired.owner.dependsOn) {\n const dependency = desiredByResourceId.get(dependencyOwner.resourceId);\n if (dependency === undefined || !KUBERNETES_READINESS_KINDS.has(dependency.resource.kind)) {\n continue;\n }\n const observation = await waitForDependencyAsync(options, request, dependency, deadline);\n if (observation.state !== 'ready') {\n return createDependencyReadinessDiagnostic(dependency, observation);\n }\n }\n return undefined;\n}\n\n/*** Wait for one dependency within the reconciliation pass shared readiness deadline. */\nfunction waitForDependencyAsync(\n options: KubernetesDriverOptions,\n request: KubernetesDriverRequest,\n dependency: KubernetesDesiredResource,\n deadline: number,\n): Promise<KubernetesResourceObservation> {\n const remainingSeconds = Math.max(0, Math.ceil((deadline - Date.now()) / 1_000));\n if (remainingSeconds === 0) {\n return Promise.resolve({\n state: 'degraded',\n detail: 'The shared Kubernetes readiness deadline expired.',\n });\n }\n return options.api.waitUntilReadyAsync(getKubernetesResourceReference(dependency.resource), {\n timeoutSeconds: remainingSeconds,\n ...(request.context.signal === undefined ? {} : { signal: request.context.signal }),\n });\n}\n\n/*** Create an actionable diagnostic for a dependency that did not become ready. */\nfunction createDependencyReadinessDiagnostic(\n dependency: KubernetesDesiredResource,\n observation: KubernetesResourceObservation,\n): InfraDiagnostic {\n const detail = observation.detail === undefined ? '' : ` ${observation.detail}`;\n return {\n severity: 'error',\n code: 'kubernetes-dependency-readiness-failed',\n message: `Kubernetes dependency ${dependency.owner.identity.resourceId} is ${observation.state}.${detail}`,\n owner: dependency.owner.identity,\n };\n}\n\n/*** Create the generic failure returned when reconciliation throws unexpectedly. */\nfunction createReconcileFailure(): InfraResult<InfraReconcileResult> {\n return {\n ok: false,\n diagnostics: [\n {\n severity: 'error',\n code: 'kubernetes-reconcile-failed',\n message: 'Kubernetes resources could not be reconciled safely.',\n },\n ],\n };\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { InfraDestroyRequest, InfraReconcileResult, InfraResult } from '@ankhorage/contracts/infra';
|
|
2
|
-
import type { KubernetesDriverOptions, KubernetesDriverRequest } from '../../../../types/kubernetesDriver';
|
|
2
|
+
import type { KubernetesDriverOptions, KubernetesDriverRequest } from '../../../../types/kubernetesDriver.js';
|
|
3
3
|
/*** Remove owned resources in reverse dependency order while enforcing persistence authorization. */
|
|
4
4
|
export declare function removeKubernetesResourcesAsync(options: KubernetesDriverOptions, request: KubernetesDriverRequest, destroy: InfraDestroyRequest): Promise<InfraResult<InfraReconcileResult>>;
|
|
5
5
|
//# sourceMappingURL=removeKubernetesResourcesAsync.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"removeKubernetesResourcesAsync.d.ts","sourceRoot":"","sources":["../../../../../src/features/workload-reconciliation/application/use-cases/removeKubernetesResourcesAsync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EAEnB,oBAAoB,EAEpB,WAAW,EACZ,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EACV,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,
|
|
1
|
+
{"version":3,"file":"removeKubernetesResourcesAsync.d.ts","sourceRoot":"","sources":["../../../../../src/features/workload-reconciliation/application/use-cases/removeKubernetesResourcesAsync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EAEnB,oBAAoB,EAEpB,WAAW,EACZ,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EACV,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,uCAAuC,CAAC;AAM/C,qGAAqG;AACrG,wBAAsB,8BAA8B,CAClD,OAAO,EAAE,uBAAuB,EAChC,OAAO,EAAE,uBAAuB,EAChC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC,CA6B5C"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { getKubernetesOwnershipQuery } from '../../utils/getKubernetesOwnershipQuery';
|
|
2
|
-
import { getKubernetesResourceReference } from '../../utils/getKubernetesResourceReference';
|
|
3
|
-
import { readKubernetesOwnedResource } from '../../utils/readKubernetesOwnedResource';
|
|
4
|
-
import { sortKubernetesResourcesForRemoval } from '../../utils/sortKubernetesResourcesForRemoval';
|
|
1
|
+
import { getKubernetesOwnershipQuery } from '../../utils/getKubernetesOwnershipQuery.js';
|
|
2
|
+
import { getKubernetesResourceReference } from '../../utils/getKubernetesResourceReference.js';
|
|
3
|
+
import { readKubernetesOwnedResource } from '../../utils/readKubernetesOwnedResource.js';
|
|
4
|
+
import { sortKubernetesResourcesForRemoval } from '../../utils/sortKubernetesResourcesForRemoval.js';
|
|
5
5
|
/*** Remove owned resources in reverse dependency order while enforcing persistence authorization. */
|
|
6
6
|
export async function removeKubernetesResourcesAsync(options, request, destroy) {
|
|
7
7
|
if (!isConfirmed(request, destroy)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"removeKubernetesResourcesAsync.js","sourceRoot":"","sources":["../../../../../src/features/workload-reconciliation/application/use-cases/removeKubernetesResourcesAsync.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,2BAA2B,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"removeKubernetesResourcesAsync.js","sourceRoot":"","sources":["../../../../../src/features/workload-reconciliation/application/use-cases/removeKubernetesResourcesAsync.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,2BAA2B,EAAE,MAAM,4CAA4C,CAAC;AACzF,OAAO,EAAE,8BAA8B,EAAE,MAAM,+CAA+C,CAAC;AAC/F,OAAO,EAAE,2BAA2B,EAAE,MAAM,4CAA4C,CAAC;AACzF,OAAO,EAAE,iCAAiC,EAAE,MAAM,kDAAkD,CAAC;AAErG,qGAAqG;AACrG,MAAM,CAAC,KAAK,UAAU,8BAA8B,CAClD,OAAgC,EAChC,OAAgC,EAChC,OAA4B;IAE5B,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC;QACnC,OAAO;YACL,EAAE,EAAE,KAAK;YACT,WAAW,EAAE;gBACX;oBACE,QAAQ,EAAE,OAAO;oBACjB,IAAI,EAAE,gCAAgC;oBACtC,OAAO,EACL,qFAAqF;iBACxF;aACF;SACF,CAAC;IACJ,CAAC;IAED,IAAI,CAAC;QACH,OAAO,MAAM,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAC9D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO;YACL,EAAE,EAAE,KAAK;YACT,WAAW,EAAE;gBACX;oBACE,QAAQ,EAAE,OAAO;oBACjB,IAAI,EAAE,0BAA0B;oBAChC,OAAO,EAAE,mDAAmD;iBAC7D;aACF;SACF,CAA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EAAE,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;AACpF,CAAC;AAED,4DAA4D;AAC5D,SAAS,WAAW,CAAC,OAAgC,EAAE,OAA4B;IACjF,OAAO,CACL,OAAO,CAAC,SAAS,KAAK,OAAO,CAAC,OAAO,CAAC,SAAS;QAC/C,OAAO,CAAC,WAAW,KAAK,OAAO,CAAC,OAAO,CAAC,WAAW;QACnD,OAAO,CAAC,YAAY,CAAC,SAAS,KAAK,OAAO,CAAC,OAAO,CAAC,SAAS;QAC5D,OAAO,CAAC,YAAY,CAAC,WAAW,KAAK,OAAO,CAAC,OAAO,CAAC,WAAW,CACjE,CAAC;AACJ,CAAC;AAED,gGAAgG;AAChG,SAAS,SAAS,CAAC,KAAyB,EAAE,OAA4B;IACxE,IAAI,CAAC,KAAK,CAAC,UAAU;QAAE,OAAO,IAAI,CAAC;IACnC,OAAO,CACL,OAAO,CAAC,WAAW,CAAC,MAAM,KAAK,QAAQ;QACvC,OAAO,CAAC,WAAW,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CACvD,eAAe,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,CAC1C,CACF,CAAC;AACJ,CAAC;AAED,mFAAmF;AACnF,SAAS,eAAe,CAAC,IAA2B,EAAE,KAA4B;IAChF,OAAO,CACL,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,SAAS;QAClC,IAAI,CAAC,WAAW,KAAK,KAAK,CAAC,WAAW;QACtC,IAAI,CAAC,OAAO,KAAK,KAAK,CAAC,OAAO;QAC9B,IAAI,CAAC,UAAU,KAAK,KAAK,CAAC,UAAU,CACrC,CAAC;AACJ,CAAC","sourcesContent":["import type {\n InfraDestroyRequest,\n InfraOwnedResource,\n InfraReconcileResult,\n InfraResourceIdentity,\n InfraResult,\n} from '@ankhorage/contracts/infra';\n\nimport type {\n KubernetesDriverOptions,\n KubernetesDriverRequest,\n} from '../../../../types/kubernetesDriver.js';\nimport { getKubernetesOwnershipQuery } from '../../utils/getKubernetesOwnershipQuery.js';\nimport { getKubernetesResourceReference } from '../../utils/getKubernetesResourceReference.js';\nimport { readKubernetesOwnedResource } from '../../utils/readKubernetesOwnedResource.js';\nimport { sortKubernetesResourcesForRemoval } from '../../utils/sortKubernetesResourcesForRemoval.js';\n\n/*** Remove owned resources in reverse dependency order while enforcing persistence authorization. */\nexport async function removeKubernetesResourcesAsync(\n options: KubernetesDriverOptions,\n request: KubernetesDriverRequest,\n destroy: InfraDestroyRequest,\n): Promise<InfraResult<InfraReconcileResult>> {\n if (!isConfirmed(request, destroy)) {\n return {\n ok: false,\n diagnostics: [\n {\n severity: 'error',\n code: 'kubernetes-destroy-unconfirmed',\n message:\n 'Kubernetes removal requires matching explicit project and environment confirmation.',\n },\n ],\n };\n }\n\n try {\n return await performRemovalAsync(options, request, destroy);\n } catch {\n return {\n ok: false,\n diagnostics: [\n {\n severity: 'error',\n code: 'kubernetes-remove-failed',\n message: 'Kubernetes resources could not be removed safely.',\n },\n ],\n };\n }\n}\n\n/*** Execute the already-confirmed removal against the narrow owned-resource selector. */\nasync function performRemovalAsync(\n options: KubernetesDriverOptions,\n request: KubernetesDriverRequest,\n destroy: InfraDestroyRequest,\n): Promise<InfraResult<InfraReconcileResult>> {\n const observed = await options.api.listOwnedAsync(getKubernetesOwnershipQuery(request));\n const owned = observed.flatMap((resource) => {\n const owner = readKubernetesOwnedResource(resource, request);\n return owner === undefined ? [] : [{ resource, owner }];\n });\n const retained: InfraOwnedResource[] = [];\n const retainNamespace = owned.some(({ owner }) => owner.persistent && !canDelete(owner, destroy));\n for (const { resource, owner } of sortKubernetesResourcesForRemoval(owned)) {\n if ((resource.kind === 'Namespace' && retainNamespace) || !canDelete(owner, destroy)) {\n retained.push(owner);\n continue;\n }\n await options.api.deleteAsync(getKubernetesResourceReference(resource), request.context.signal);\n }\n return { ok: true, value: { resources: retained, outputs: [] }, diagnostics: [] };\n}\n\n/*** Confirm request identity at both destroy boundaries. */\nfunction isConfirmed(request: KubernetesDriverRequest, destroy: InfraDestroyRequest): boolean {\n return (\n destroy.projectId === request.context.projectId &&\n destroy.environment === request.context.environment &&\n destroy.confirmation.projectId === request.context.projectId &&\n destroy.confirmation.environment === request.context.environment\n );\n}\n\n/*** Delete persistent data only when the exact resource has explicit deletion authorization. */\nfunction canDelete(owner: InfraOwnedResource, destroy: InfraDestroyRequest): boolean {\n if (!owner.persistent) return true;\n return (\n destroy.persistence.policy === 'delete' &&\n destroy.persistence.confirmedResources.some((identity) =>\n identitiesEqual(identity, owner.identity),\n )\n );\n}\n\n/*** Compare canonical resource identities without object-reference assumptions. */\nfunction identitiesEqual(left: InfraResourceIdentity, right: InfraResourceIdentity): boolean {\n return (\n left.projectId === right.projectId &&\n left.environment === right.environment &&\n left.adapter === right.adapter &&\n left.resourceId === right.resourceId\n );\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { InfraOutput, InfraResult, InfraWorkloadSpec } from '@ankhorage/contracts/infra';
|
|
2
|
-
import type { KubernetesResolvedWorkloadValues } from '../../../../types/kubernetesResources';
|
|
2
|
+
import type { KubernetesResolvedWorkloadValues } from '../../../../types/kubernetesResources.js';
|
|
3
3
|
/*** Resolve public outputs while retaining privileged workload values as secret references. */
|
|
4
4
|
export declare function resolveKubernetesWorkloadValues(outputs: readonly InfraOutput[], workload: InfraWorkloadSpec): InfraResult<KubernetesResolvedWorkloadValues>;
|
|
5
5
|
//# sourceMappingURL=resolveKubernetesWorkloadValues.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveKubernetesWorkloadValues.d.ts","sourceRoot":"","sources":["../../../../../src/features/workload-reconciliation/application/use-cases/resolveKubernetesWorkloadValues.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,WAAW,EACX,WAAW,EAEX,iBAAiB,EAElB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EACV,gCAAgC,EAGjC,MAAM,
|
|
1
|
+
{"version":3,"file":"resolveKubernetesWorkloadValues.d.ts","sourceRoot":"","sources":["../../../../../src/features/workload-reconciliation/application/use-cases/resolveKubernetesWorkloadValues.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,WAAW,EACX,WAAW,EAEX,iBAAiB,EAElB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,KAAK,EACV,gCAAgC,EAGjC,MAAM,0CAA0C,CAAC;AAGlD,+FAA+F;AAC/F,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,SAAS,WAAW,EAAE,EAC/B,QAAQ,EAAE,iBAAiB,GAC1B,WAAW,CAAC,gCAAgC,CAAC,CAoC/C"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { toKubernetesName } from '../../utils/toKubernetesName';
|
|
1
|
+
import { toKubernetesName } from '../../utils/toKubernetesName.js';
|
|
2
2
|
/*** Resolve public outputs while retaining privileged workload values as secret references. */
|
|
3
3
|
export function resolveKubernetesWorkloadValues(outputs, workload) {
|
|
4
4
|
const environment = {};
|
|
@@ -8,8 +8,10 @@ export function resolveKubernetesWorkloadValues(outputs, workload) {
|
|
|
8
8
|
for (const [name, value] of Object.entries(workload.environment ?? {}).sort(([a], [b]) => a.localeCompare(b))) {
|
|
9
9
|
assignValue(outputs, value, { kind: 'environment', name }, environment, secrets, diagnostics, `env-${name}`);
|
|
10
10
|
}
|
|
11
|
-
for (const [index,
|
|
12
|
-
|
|
11
|
+
for (const [index, [path, value]] of Object.entries(workload.files ?? {})
|
|
12
|
+
.sort(([left], [right]) => left.localeCompare(right))
|
|
13
|
+
.entries()) {
|
|
14
|
+
assignValue(outputs, value, { kind: 'file', path }, files, secrets, diagnostics, `file-${index}`);
|
|
13
15
|
}
|
|
14
16
|
return diagnostics.length > 0
|
|
15
17
|
? { ok: false, diagnostics }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolveKubernetesWorkloadValues.js","sourceRoot":"","sources":["../../../../../src/features/workload-reconciliation/application/use-cases/resolveKubernetesWorkloadValues.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,gBAAgB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"resolveKubernetesWorkloadValues.js","sourceRoot":"","sources":["../../../../../src/features/workload-reconciliation/application/use-cases/resolveKubernetesWorkloadValues.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAEnE,+FAA+F;AAC/F,MAAM,UAAU,+BAA+B,CAC7C,OAA+B,EAC/B,QAA2B;IAE3B,MAAM,WAAW,GAA2B,EAAE,CAAC;IAC/C,MAAM,KAAK,GAA2B,EAAE,CAAC;IACzC,MAAM,OAAO,GAA6B,EAAE,CAAC;IAC7C,MAAM,WAAW,GAAsB,EAAE,CAAC;IAE1C,KAAK,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CACvF,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CACnB,EAAE,CAAC;QACF,WAAW,CACT,OAAO,EACP,KAAK,EACL,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,EAC7B,WAAW,EACX,OAAO,EACP,WAAW,EACX,OAAO,IAAI,EAAE,CACd,CAAC;IACJ,CAAC;IACD,KAAK,MAAM,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,KAAK,IAAI,EAAE,CAAC;SACtE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;SACpD,OAAO,EAAE,EAAE,CAAC;QACb,WAAW,CACT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,QAAQ,EAAE,OAAO;YACjB,IAAI,EAAE,8BAA8B;YACpC,OAAO,EAAE,mBAAmB,KAAK,CAAC,UAAU,IAAI,KAAK,CAAC,MAAM,4BAA4B;SACzF,CAAC,CAAC;QACH,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,MAAM,CAAC,UAAU,KAAK,QAAQ;QACnC,CAAC,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE;QACpD,CAAC,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;AACvD,CAAC","sourcesContent":["import type {\n InfraDiagnostic,\n InfraOutput,\n InfraResult,\n InfraWorkloadScalarValue,\n InfraWorkloadSpec,\n InfraWorkloadValue,\n} from '@ankhorage/contracts/infra';\n\nimport type {\n KubernetesResolvedWorkloadValues,\n KubernetesSecretTarget,\n KubernetesSecretValueSegment,\n} from '../../../../types/kubernetesResources.js';\nimport { toKubernetesName } from '../../utils/toKubernetesName.js';\n\n/*** Resolve public outputs while retaining privileged workload values as secret references. */\nexport function resolveKubernetesWorkloadValues(\n outputs: readonly InfraOutput[],\n workload: InfraWorkloadSpec,\n): InfraResult<KubernetesResolvedWorkloadValues> {\n const environment: Record<string, string> = {};\n const files: Record<string, string> = {};\n const secrets: KubernetesSecretTarget[] = [];\n const diagnostics: InfraDiagnostic[] = [];\n\n for (const [name, value] of Object.entries(workload.environment ?? {}).sort(([a], [b]) =>\n a.localeCompare(b),\n )) {\n assignValue(\n outputs,\n value,\n { kind: 'environment', name },\n environment,\n secrets,\n diagnostics,\n `env-${name}`,\n );\n }\n for (const [index, [path, value]] of Object.entries(workload.files ?? {})\n .sort(([left], [right]) => left.localeCompare(right))\n .entries()) {\n assignValue(\n outputs,\n value,\n { kind: 'file', path },\n files,\n secrets,\n diagnostics,\n `file-${index}`,\n );\n }\n\n return diagnostics.length > 0\n ? { ok: false, diagnostics }\n : { ok: true, value: { environment, files, secrets }, diagnostics: [] };\n}\n\n/*** Assign one portable value without resolving privileged content. */\nfunction assignValue(\n outputs: readonly InfraOutput[],\n value: InfraWorkloadValue,\n target: KubernetesSecretTarget['target'],\n publicValues: Record<string, string>,\n secrets: KubernetesSecretTarget[],\n diagnostics: InfraDiagnostic[],\n key: string,\n): void {\n const publicKey = target.kind === 'environment' ? target.name : target.path;\n const segments = value.kind === 'template' ? value.segments : [value];\n const resolved = segments.map((segment) => resolveSegment(outputs, segment, diagnostics));\n if (resolved.some((segment) => segment === undefined)) return;\n const complete = resolved.filter(\n (segment): segment is KubernetesSecretValueSegment => segment !== undefined,\n );\n if (complete.every((segment) => segment.kind === 'literal')) {\n Object.assign(publicValues, {\n [publicKey]: complete.map(({ value }) => value).join(''),\n });\n return;\n }\n secrets.push({ key: toKubernetesName(key), segments: complete, target });\n}\n\n/*** Resolve one scalar segment without materializing privileged content. */\nfunction resolveSegment(\n outputs: readonly InfraOutput[],\n value: InfraWorkloadScalarValue,\n diagnostics: InfraDiagnostic[],\n): KubernetesSecretValueSegment | undefined {\n if (value.kind === 'literal') return value;\n if (value.kind === 'secret') return { kind: 'reference', reference: value.reference };\n if (value.kind === 'credential') {\n return { kind: 'reference', reference: { ...value.reference, key: value.key } };\n }\n\n const matches = outputs.filter(\n (output) => output.owner.resourceId === value.resourceId && output.name === value.output,\n );\n const [output] = matches;\n if (matches.length !== 1 || output === undefined) {\n diagnostics.push({\n severity: 'error',\n code: 'kubernetes-output-unresolved',\n message: `Workload output ${value.resourceId}.${value.output} did not resolve uniquely.`,\n });\n return undefined;\n }\n return output.visibility === 'secret'\n ? { kind: 'reference', reference: output.reference }\n : { kind: 'literal', value: String(output.value) };\n}\n"]}
|
package/dist/features/workload-reconciliation/application/use-cases/validateKubernetesWorkloads.js
CHANGED
|
@@ -11,7 +11,7 @@ export function validateKubernetesWorkloads(workloads) {
|
|
|
11
11
|
});
|
|
12
12
|
}
|
|
13
13
|
ids.add(workload.id);
|
|
14
|
-
for (const dependency of workload.dependsOn ??
|
|
14
|
+
for (const dependency of Object.keys(workload.dependsOn ?? {}).sort()) {
|
|
15
15
|
if (!workloads.some((candidate) => candidate.id === dependency)) {
|
|
16
16
|
diagnostics.push({
|
|
17
17
|
severity: 'error',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validateKubernetesWorkloads.js","sourceRoot":"","sources":["../../../../../src/features/workload-reconciliation/application/use-cases/validateKubernetesWorkloads.ts"],"names":[],"mappings":"AAEA,sFAAsF;AACtF,MAAM,UAAU,2BAA2B,CACzC,SAAuC;IAEvC,MAAM,WAAW,GAAsB,EAAE,CAAC;IAC1C,MAAM,GAAG,GAAG,IAAI,GAAG,EAAU,CAAC;IAC9B,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,IAAI,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;YACzB,WAAW,CAAC,IAAI,CAAC;gBACf,QAAQ,EAAE,OAAO;gBACjB,IAAI,EAAE,+BAA+B;gBACrC,OAAO,EAAE,eAAe,QAAQ,CAAC,EAAE,iBAAiB;aACrD,CAAC,CAAC;QACL,CAAC;QACD,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACrB,KAAK,MAAM,UAAU,IAAI,QAAQ,CAAC,SAAS,IAAI,EAAE,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"validateKubernetesWorkloads.js","sourceRoot":"","sources":["../../../../../src/features/workload-reconciliation/application/use-cases/validateKubernetesWorkloads.ts"],"names":[],"mappings":"AAEA,sFAAsF;AACtF,MAAM,UAAU,2BAA2B,CACzC,SAAuC;IAEvC,MAAM,WAAW,GAAsB,EAAE,CAAC;IAC1C,MAAM,GAAG,GAAG,IAAI,GAAG,EAAU,CAAC;IAC9B,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;QACjC,IAAI,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;YACzB,WAAW,CAAC,IAAI,CAAC;gBACf,QAAQ,EAAE,OAAO;gBACjB,IAAI,EAAE,+BAA+B;gBACrC,OAAO,EAAE,eAAe,QAAQ,CAAC,EAAE,iBAAiB;aACrD,CAAC,CAAC;QACL,CAAC;QACD,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACrB,KAAK,MAAM,UAAU,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;YACtE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,EAAE,KAAK,UAAU,CAAC,EAAE,CAAC;gBAChE,WAAW,CAAC,IAAI,CAAC;oBACf,QAAQ,EAAE,OAAO;oBACjB,IAAI,EAAE,wCAAwC;oBAC9C,OAAO,EAAE,YAAY,QAAQ,CAAC,EAAE,gCAAgC,UAAU,GAAG;iBAC9E,CAAC,CAAC;YACL,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,WAAW,CAAC;AACrB,CAAC","sourcesContent":["import type { InfraDiagnostic, InfraWorkloadSpec } from '@ankhorage/contracts/infra';\n\n/*** Validate portable invariants required for deterministic Kubernetes projection. */\nexport function validateKubernetesWorkloads(\n workloads: readonly InfraWorkloadSpec[],\n): readonly InfraDiagnostic[] {\n const diagnostics: InfraDiagnostic[] = [];\n const ids = new Set<string>();\n for (const workload of workloads) {\n if (ids.has(workload.id)) {\n diagnostics.push({\n severity: 'error',\n code: 'kubernetes-workload-duplicate',\n message: `Workload ID ${workload.id} is duplicated.`,\n });\n }\n ids.add(workload.id);\n for (const dependency of Object.keys(workload.dependsOn ?? {}).sort()) {\n if (!workloads.some((candidate) => candidate.id === dependency)) {\n diagnostics.push({\n severity: 'error',\n code: 'kubernetes-workload-dependency-missing',\n message: `Workload ${workload.id} depends on missing workload ${dependency}.`,\n });\n }\n }\n }\n return diagnostics;\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { InfraResourceStatus, InfraResult } from '@ankhorage/contracts/infra';
|
|
2
|
-
import type { KubernetesDriverOptions, KubernetesDriverRequest } from '../../../../types/kubernetesDriver';
|
|
2
|
+
import type { KubernetesDriverOptions, KubernetesDriverRequest } from '../../../../types/kubernetesDriver.js';
|
|
3
3
|
/*** Wait dependency-first for required Kubernetes resources to report ready. */
|
|
4
4
|
export declare function waitForKubernetesReadinessAsync(options: KubernetesDriverOptions, request: KubernetesDriverRequest): Promise<InfraResult<readonly InfraResourceStatus[]>>;
|
|
5
5
|
//# sourceMappingURL=waitForKubernetesReadinessAsync.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"waitForKubernetesReadinessAsync.d.ts","sourceRoot":"","sources":["../../../../../src/features/workload-reconciliation/application/use-cases/waitForKubernetesReadinessAsync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,mBAAmB,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEpG,OAAO,KAAK,EACV,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,
|
|
1
|
+
{"version":3,"file":"waitForKubernetesReadinessAsync.d.ts","sourceRoot":"","sources":["../../../../../src/features/workload-reconciliation/application/use-cases/waitForKubernetesReadinessAsync.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAmB,mBAAmB,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAEpG,OAAO,KAAK,EACV,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,uCAAuC,CAAC;AAY/C,gFAAgF;AAChF,wBAAsB,+BAA+B,CACnD,OAAO,EAAE,uBAAuB,EAChC,OAAO,EAAE,uBAAuB,GAC/B,OAAO,CAAC,WAAW,CAAC,SAAS,mBAAmB,EAAE,CAAC,CAAC,CA8BtD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { KUBERNETES_DEFAULT_READINESS_TIMEOUT_SECONDS, KUBERNETES_READINESS_KINDS, } from '../../constants';
|
|
2
|
-
import { getKubernetesResourceReference } from '../../utils/getKubernetesResourceReference';
|
|
3
|
-
import { projectKubernetesResourcesAsync } from './projectKubernetesResourcesAsync';
|
|
1
|
+
import { KUBERNETES_DEFAULT_READINESS_TIMEOUT_SECONDS, KUBERNETES_READINESS_KINDS, } from '../../constants.js';
|
|
2
|
+
import { getKubernetesResourceReference } from '../../utils/getKubernetesResourceReference.js';
|
|
3
|
+
import { projectKubernetesResourcesAsync } from './projectKubernetesResourcesAsync.js';
|
|
4
4
|
/*** Wait dependency-first for required Kubernetes resources to report ready. */
|
|
5
5
|
export async function waitForKubernetesReadinessAsync(options, request) {
|
|
6
6
|
const projection = await projectKubernetesResourcesAsync(request);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"waitForKubernetesReadinessAsync.js","sourceRoot":"","sources":["../../../../../src/features/workload-reconciliation/application/use-cases/waitForKubernetesReadinessAsync.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,4CAA4C,EAC5C,0BAA0B,GAC3B,MAAM,
|
|
1
|
+
{"version":3,"file":"waitForKubernetesReadinessAsync.js","sourceRoot":"","sources":["../../../../../src/features/workload-reconciliation/application/use-cases/waitForKubernetesReadinessAsync.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,4CAA4C,EAC5C,0BAA0B,GAC3B,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,8BAA8B,EAAE,MAAM,+CAA+C,CAAC;AAC/F,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AAEvF,gFAAgF;AAChF,MAAM,CAAC,KAAK,UAAU,+BAA+B,CACnD,OAAgC,EAChC,OAAgC;IAEhC,MAAM,UAAU,GAAG,MAAM,+BAA+B,CAAC,OAAO,CAAC,CAAC;IAClE,IAAI,CAAC,UAAU,CAAC,EAAE;QAAE,OA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AM,EAAE;QACrG,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,QAAQ;KAC9B,CAAC;AACJ,CAAC","sourcesContent":["import type { InfraDiagnostic, InfraResourceStatus, InfraResult } from '@ankhorage/contracts/infra';\n\nimport type {\n KubernetesDriverOptions,\n KubernetesDriverRequest,\n} from '../../../../types/kubernetesDriver.js';\nimport type {\n KubernetesDesiredResource,\n KubernetesResourceObservation,\n} from '../../../../types/kubernetesResources.js';\nimport {\n KUBERNETES_DEFAULT_READINESS_TIMEOUT_SECONDS,\n KUBERNETES_READINESS_KINDS,\n} from '../../constants.js';\nimport { getKubernetesResourceReference } from '../../utils/getKubernetesResourceReference.js';\nimport { projectKubernetesResourcesAsync } from './projectKubernetesResourcesAsync.js';\n\n/*** Wait dependency-first for required Kubernetes resources to report ready. */\nexport async function waitForKubernetesReadinessAsync(\n options: KubernetesDriverOptions,\n request: KubernetesDriverRequest,\n): Promise<InfraResult<readonly InfraResourceStatus[]>> {\n const projection = await projectKubernetesResourcesAsync(request);\n if (!projection.ok) return projection;\n\n const timeoutSeconds =\n options.defaultReadinessTimeoutSeconds ?? KUBERNETES_DEFAULT_READINESS_TIMEOUT_SECONDS;\n const deadline = Date.now() + timeoutSeconds * 1_000;\n try {\n const statuses: InfraResourceStatus[] = [];\n for (const desired of projection.value.resources) {\n if (!KUBERNETES_READINESS_KINDS.has(desired.resource.kind)) continue;\n const observation = await waitForDesiredResourceAsync(options, request, desired, deadline);\n statuses.push(createReadinessStatus(desired, observation));\n if (observation.state !== 'ready') {\n return { ok: false, diagnostics: [createReadinessDiagnostic(desired, observation)] };\n }\n }\n return { ok: true, value: statuses, diagnostics: [] };\n } catch {\n return {\n ok: false,\n diagnostics: [\n {\n severity: 'error',\n code: 'kubernetes-readiness-failed',\n message: 'Kubernetes readiness could not be established.',\n },\n ],\n };\n }\n}\n\n/*** Wait for one resource within the remaining shared readiness deadline. */\nasync function waitForDesiredResourceAsync(\n options: KubernetesDriverOptions,\n request: KubernetesDriverRequest,\n desired: KubernetesDesiredResource,\n deadline: number,\n): Promise<KubernetesResourceObservation> {\n const remainingSeconds = Math.max(0, Math.ceil((deadline - Date.now()) / 1_000));\n if (remainingSeconds === 0) {\n return {\n state: 'degraded',\n detail: 'The shared Kubernetes readiness deadline expired.',\n };\n }\n return options.api.waitUntilReadyAsync(getKubernetesResourceReference(desired.resource), {\n timeoutSeconds: remainingSeconds,\n ...(request.context.signal === undefined ? {} : { signal: request.context.signal }),\n });\n}\n\n/*** Map one observation to the resource status returned by the driver. */\nfunction createReadinessStatus(\n desired: KubernetesDesiredResource,\n observation: KubernetesResourceObservation,\n): InfraResourceStatus {\n return {\n owner: desired.owner.identity,\n state: observation.state,\n ...(observation.detail === undefined ? {} : { detail: observation.detail }),\n };\n}\n\n/*** Create the first actionable readiness diagnostic for dependency-first failure. */\nfunction createReadinessDiagnostic(\n desired: KubernetesDesiredResource,\n observation: KubernetesResourceObservation,\n): InfraDiagnostic {\n const detail = observation.detail === undefined ? '' : ` ${observation.detail}`;\n return {\n severity: 'error',\n code: 'kubernetes-readiness-failed',\n message: `Kubernetes resource ${desired.owner.identity.resourceId} is ${observation.state}.${detail}`,\n owner: desired.owner.identity,\n };\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { KubernetesDriver, KubernetesDriverOptions } from '../../../types/kubernetesDriver';
|
|
1
|
+
import type { KubernetesDriver, KubernetesDriverOptions } from '../../../types/kubernetesDriver.js';
|
|
2
2
|
/***
|
|
3
3
|
* Create the shared Kubernetes workload driver entrypoint.
|
|
4
4
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createKubernetesDriver.d.ts","sourceRoot":"","sources":["../../../../src/features/workload-reconciliation/composition/createKubernetesDriver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"createKubernetesDriver.d.ts","sourceRoot":"","sources":["../../../../src/features/workload-reconciliation/composition/createKubernetesDriver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AASpG;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,uBAAuB,GAAG,gBAAgB,CAWzF"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { getKubernetesOutputsAsync } from '../application/use-cases/getKubernetesOutputsAsync';
|
|
2
|
-
import { getKubernetesStatusAsync } from '../application/use-cases/getKubernetesStatusAsync';
|
|
3
|
-
import { planKubernetesResourcesAsync } from '../application/use-cases/planKubernetesResourcesAsync';
|
|
4
|
-
import { projectKubernetesResourcesAsync } from '../application/use-cases/projectKubernetesResourcesAsync';
|
|
5
|
-
import { reconcileKubernetesResourcesAsync } from '../application/use-cases/reconcileKubernetesResourcesAsync';
|
|
6
|
-
import { removeKubernetesResourcesAsync } from '../application/use-cases/removeKubernetesResourcesAsync';
|
|
7
|
-
import { waitForKubernetesReadinessAsync } from '../application/use-cases/waitForKubernetesReadinessAsync';
|
|
1
|
+
import { getKubernetesOutputsAsync } from '../application/use-cases/getKubernetesOutputsAsync.js';
|
|
2
|
+
import { getKubernetesStatusAsync } from '../application/use-cases/getKubernetesStatusAsync.js';
|
|
3
|
+
import { planKubernetesResourcesAsync } from '../application/use-cases/planKubernetesResourcesAsync.js';
|
|
4
|
+
import { projectKubernetesResourcesAsync } from '../application/use-cases/projectKubernetesResourcesAsync.js';
|
|
5
|
+
import { reconcileKubernetesResourcesAsync } from '../application/use-cases/reconcileKubernetesResourcesAsync.js';
|
|
6
|
+
import { removeKubernetesResourcesAsync } from '../application/use-cases/removeKubernetesResourcesAsync.js';
|
|
7
|
+
import { waitForKubernetesReadinessAsync } from '../application/use-cases/waitForKubernetesReadinessAsync.js';
|
|
8
8
|
/***
|
|
9
9
|
* Create the shared Kubernetes workload driver entrypoint.
|
|
10
10
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createKubernetesDriver.js","sourceRoot":"","sources":["../../../../src/features/workload-reconciliation/composition/createKubernetesDriver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"createKubernetesDriver.js","sourceRoot":"","sources":["../../../../src/features/workload-reconciliation/composition/createKubernetesDriver.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,uDAAuD,CAAC;AAClG,OAAO,EAAE,wBAAwB,EAAE,MAAM,sDAAsD,CAAC;AAChG,OAAO,EAAE,4BAA4B,EAAE,MAAM,0DAA0D,CAAC;AACxG,OAAO,EAAE,+BAA+B,EAAE,MAAM,6DAA6D,CAAC;AAC9G,OAAO,EAAE,iCAAiC,EAAE,MAAM,+DAA+D,CAAC;AAClH,OAAO,EAAE,8BAA8B,EAAE,MAAM,4DAA4D,CAAC;AAC5G,OAAO,EAAE,+BAA+B,EAAE,MAAM,6DAA6D,CAAC;AAE9G;;;;;;;;GAQG;AACH,MAAM,UAAU,sBAAsB,CAAC,OAAgC;IACrE,OAAO;QACL,IAAI,EAAE,YAAY;QAClB,YAAY,EAAE,+BAA+B;QAC7C,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,4BAA4B,CAAC,OAAO,EAAE,OAAO,CAAC;QACtE,cAAc,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,iCAAiC,CAAC,OAAO,EAAE,OAAO,CAAC;QAChF,WAAW,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,CAAC,8BAA8B,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC;QAC5F,WAAW,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,wBAAwB,CAAC,OAAO,EAAE,OAAO,CAAC;QACpE,mBAAmB,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,+BAA+B,CAAC,OAAO,EAAE,OAAO,CAAC;QACnF,YAAY,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,yBAAyB,CAAC,OAAO,EAAE,OAAO,CAAC;KACvE,CAAC;AACJ,CAAC","sourcesContent":["import type { KubernetesDriver, KubernetesDriverOptions } from '../../../types/kubernetesDriver.js';\nimport { getKubernetesOutputsAsync } from '../application/use-cases/getKubernetesOutputsAsync.js';\nimport { getKubernetesStatusAsync } from '../application/use-cases/getKubernetesStatusAsync.js';\nimport { planKubernetesResourcesAsync } from '../application/use-cases/planKubernetesResourcesAsync.js';\nimport { projectKubernetesResourcesAsync } from '../application/use-cases/projectKubernetesResourcesAsync.js';\nimport { reconcileKubernetesResourcesAsync } from '../application/use-cases/reconcileKubernetesResourcesAsync.js';\nimport { removeKubernetesResourcesAsync } from '../application/use-cases/removeKubernetesResourcesAsync.js';\nimport { waitForKubernetesReadinessAsync } from '../application/use-cases/waitForKubernetesReadinessAsync.js';\n\n/***\n * Create the shared Kubernetes workload driver entrypoint.\n *\n * Kubernetes is an implementation dependency for runtime adapters, not a selectable Infra\n * provider. The supplied API port is already authenticated cluster access; the driver adds only\n * standard Kubernetes workload projection and lifecycle semantics.\n *\n * @readme\n */\nexport function createKubernetesDriver(options: KubernetesDriverOptions): KubernetesDriver {\n return {\n kind: 'kubernetes',\n projectAsync: projectKubernetesResourcesAsync,\n planAsync: (request) => planKubernetesResourcesAsync(options, request),\n reconcileAsync: (request) => reconcileKubernetesResourcesAsync(options, request),\n removeAsync: (request, destroy) => removeKubernetesResourcesAsync(options, request, destroy),\n statusAsync: (request) => getKubernetesStatusAsync(options, request),\n waitUntilReadyAsync: (request) => waitForKubernetesReadinessAsync(options, request),\n outputsAsync: (request) => getKubernetesOutputsAsync(options, request),\n };\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { KubernetesResource } from '../../../types/kubernetesResources';
|
|
1
|
+
import type { KubernetesResource } from '../../../types/kubernetesResources.js';
|
|
2
2
|
/*** Compare desired and observed Kubernetes resources while ignoring server-owned metadata. */
|
|
3
3
|
export declare function areKubernetesResourcesEquivalent(desired: KubernetesResource, actual: KubernetesResource): boolean;
|
|
4
4
|
//# sourceMappingURL=areKubernetesResourcesEquivalent.d.ts.map
|
package/dist/features/workload-reconciliation/utils/areKubernetesResourcesEquivalent.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"areKubernetesResourcesEquivalent.d.ts","sourceRoot":"","sources":["../../../../src/features/workload-reconciliation/utils/areKubernetesResourcesEquivalent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"areKubernetesResourcesEquivalent.d.ts","sourceRoot":"","sources":["../../../../src/features/workload-reconciliation/utils/areKubernetesResourcesEquivalent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAEhF,+FAA+F;AAC/F,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,kBAAkB,EAC3B,MAAM,EAAE,kBAAkB,GACzB,OAAO,CAET"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"areKubernetesResourcesEquivalent.js","sourceRoot":"","sources":["../../../../src/features/workload-reconciliation/utils/areKubernetesResourcesEquivalent.ts"],"names":[],"mappings":"AAEA,+FAA+F;AAC/F,MAAM,UAAU,gCAAgC,CAC9C,OAA2B,EAC3B,MAA0B;IAE1B,OAAO,eAAe,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,KAAK,eAAe,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;AACpF,CAAC;AAED,2EAA2E;AAC3E,SAAS,SAAS,CAAC,QAA4B;IAC7C,MAAM,EAAE,UAAU,EAAE,GAAG,QAAQ,CAAC;IAChC,MAAM,IAAI,GACR,UAAU,KAAK,SAAS;QACtB,CAAC,CAAC,QAAQ,CAAC,IAAI;QACf,CAAC,CAAC,MAAM,CAAC,WAAW,CAChB,MAAM,CAAC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IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;aACtC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC;aACvE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IAClB,CAAC;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC","sourcesContent":["import type { KubernetesResource } from '../../../types/kubernetesResources';\n\n/*** Compare desired and observed Kubernetes resources while ignoring server-owned metadata. */\nexport function areKubernetesResourcesEquivalent(\n desired: KubernetesResource,\n actual: KubernetesResource,\n): boolean {\n return stableSerialize(normalize(desired)) === stableSerialize(normalize(actual));\n}\n\n/*** Normalize write-only Secret data and recursively order object keys. */\nfunction normalize(resource: KubernetesResource): unknown {\n const { stringData } = resource;\n const data =\n stringData === undefined\n ? resource.data\n : Object.fromEntries(\n Object.entries(stringData).map(([key, value]) => [\n key,\n Buffer.from(value).toString('base64'),\n ]),\n );\n return {\n apiVersion: resource.apiVersion,\n kind: resource.kind,\n metadata: {\n name: resource.metadata.name,\n ...(resource.metadata.namespace === undefined\n ? {}\n : { namespace: resource.metadata.namespace }),\n labels: resource.metadata.labels,\n annotations: resource.metadata.annotations,\n },\n ...(data === undefined ? {} : { data }),\n ...(resource.spec === undefined ? {} : { spec: resource.spec }),\n };\n}\n\n/*** Serialize plain Kubernetes desired data with stable recursive key ordering. */\nfunction stableSerialize(value: unknown): string {\n if (Array.isArray(value)) return `[${value.map(stableSerialize).join(',')}]`;\n if (value !== null && typeof value === 'object') {\n return `{${Object.entries(value)\n .sort(([a], [b]) => a.localeCompare(b))\n .map(([key, item]) => `${JSON.stringify(key)}:${stableSerialize(item)}`)\n .join(',')}}`;\n }\n return JSON.stringify(value);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"areKubernetesResourcesEquivalent.js","sourceRoot":"","sources":["../../../../src/features/workload-reconciliation/utils/areKubernetesResourcesEquivalent.ts"],"names":[],"mappings":"AAEA,+FAA+F;AAC/F,MAAM,UAAU,gCAAgC,CAC9C,OAA2B,EAC3B,MAA0B;IAE1B,OAAO,eAAe,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,KAAK,eAAe,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;AACpF,CAAC;AAED,2EAA2E;AAC3E,SAAS,SAAS,CAAC,QAA4B;IAC7C,MAAM,EAAE,UAAU,EAAE,GAAG,QAAQ,CAAC;IAChC,MAAM,IAAI,GACR,UAAU,KAAK,SAAS;QACtB,CAAC,CAAC,QAAQ,CAAC,IAAI;QACf,CAAC,CAAC,MAAM,CAAC,WAAW,CAChB,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC;YAC/C,GAAG;YACH,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;SACtC,CAAC,CACH,CAAC;IACR,OAAO;QACL,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,QAAQ,EAAE;YACR,IAAI,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI;YAC5B,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,SAAS,KAAK,SAAS;gBAC3C,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC;YAC/C,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM;YAChC,WAAW,EAAE,QAAQ,CAAC,QAAQ,CAAC,WAAW;SAC3C;QACD,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;QACvC,GAAG,CAAC,QAAQ,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC;KAChE,CAAC;AACJ,CAAC;AAED,mFAAmF;AACnF,SAAS,eAAe,CAAC,KAAc;IACrC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IAC7E,IAAI,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAChD,OAAO,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;aAC7B,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;aACtC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC;aACvE,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;IAClB,CAAC;IACD,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAC/B,CAAC","sourcesContent":["import type { KubernetesResource } from '../../../types/kubernetesResources.js';\n\n/*** Compare desired and observed Kubernetes resources while ignoring server-owned metadata. */\nexport function areKubernetesResourcesEquivalent(\n desired: KubernetesResource,\n actual: KubernetesResource,\n): boolean {\n return stableSerialize(normalize(desired)) === stableSerialize(normalize(actual));\n}\n\n/*** Normalize write-only Secret data and recursively order object keys. */\nfunction normalize(resource: KubernetesResource): unknown {\n const { stringData } = resource;\n const data =\n stringData === undefined\n ? resource.data\n : Object.fromEntries(\n Object.entries(stringData).map(([key, value]) => [\n key,\n Buffer.from(value).toString('base64'),\n ]),\n );\n return {\n apiVersion: resource.apiVersion,\n kind: resource.kind,\n metadata: {\n name: resource.metadata.name,\n ...(resource.metadata.namespace === undefined\n ? {}\n : { namespace: resource.metadata.namespace }),\n labels: resource.metadata.labels,\n annotations: resource.metadata.annotations,\n },\n ...(data === undefined ? {} : { data }),\n ...(resource.spec === undefined ? {} : { spec: resource.spec }),\n };\n}\n\n/*** Serialize plain Kubernetes desired data with stable recursive key ordering. */\nfunction stableSerialize(value: unknown): string {\n if (Array.isArray(value)) return `[${value.map(stableSerialize).join(',')}]`;\n if (value !== null && typeof value === 'object') {\n return `{${Object.entries(value)\n .sort(([a], [b]) => a.localeCompare(b))\n .map(([key, item]) => `${JSON.stringify(key)}:${stableSerialize(item)}`)\n .join(',')}}`;\n }\n return JSON.stringify(value);\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { InfraOwnedResource, InfraResourceIdentity } from '@ankhorage/contracts/infra';
|
|
2
|
-
import type { KubernetesDriverRequest } from '../../../types/kubernetesDriver';
|
|
3
|
-
import type { KubernetesDesiredResource, KubernetesResource } from '../../../types/kubernetesResources';
|
|
2
|
+
import type { KubernetesDriverRequest } from '../../../types/kubernetesDriver.js';
|
|
3
|
+
import type { KubernetesDesiredResource, KubernetesResource } from '../../../types/kubernetesResources.js';
|
|
4
4
|
/*** Attach canonical Infra ownership to a standard Kubernetes desired resource. */
|
|
5
5
|
export declare function createKubernetesDesiredResource(request: KubernetesDriverRequest, input: CreateKubernetesDesiredResourceInput): KubernetesDesiredResource;
|
|
6
6
|
interface CreateKubernetesDesiredResourceInput {
|
package/dist/features/workload-reconciliation/utils/createKubernetesDesiredResource.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createKubernetesDesiredResource.d.ts","sourceRoot":"","sources":["../../../../src/features/workload-reconciliation/utils/createKubernetesDesiredResource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAE5F,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"createKubernetesDesiredResource.d.ts","sourceRoot":"","sources":["../../../../src/features/workload-reconciliation/utils/createKubernetesDesiredResource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAE5F,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAClF,OAAO,KAAK,EACV,yBAAyB,EACzB,kBAAkB,EACnB,MAAM,uCAAuC,CAAC;AAM/C,mFAAmF;AACnF,wBAAgB,+BAA+B,CAC7C,OAAO,EAAE,uBAAuB,EAChC,KAAK,EAAE,oCAAoC,GAC1C,yBAAyB,CAyC3B;AAED,UAAU,oCAAoC;IAC5C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,kBAAkB,CAAC;IACtC,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,SAAS,CAAC,EAAE,kBAAkB,CAAC,WAAW,CAAC,CAAC;IACrD,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,qBAAqB,EAAE,CAAC;CACvD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { KUBERNETES_OWNERSHIP } from '../constants';
|
|
2
|
-
import { getKubernetesResourceKey } from './getKubernetesResourceKey';
|
|
3
|
-
import { getKubernetesResourceReference } from './getKubernetesResourceReference';
|
|
4
|
-
import { toKubernetesName } from './toKubernetesName';
|
|
1
|
+
import { KUBERNETES_OWNERSHIP } from '../constants.js';
|
|
2
|
+
import { getKubernetesResourceKey } from './getKubernetesResourceKey.js';
|
|
3
|
+
import { getKubernetesResourceReference } from './getKubernetesResourceReference.js';
|
|
4
|
+
import { toKubernetesName } from './toKubernetesName.js';
|
|
5
5
|
/*** Attach canonical Infra ownership to a standard Kubernetes desired resource. */
|
|
6
6
|
export function createKubernetesDesiredResource(request, input) {
|
|
7
7
|
const identity = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createKubernetesDesiredResource.js","sourceRoot":"","sources":["../../../../src/features/workload-reconciliation/utils/createKubernetesDesiredResource.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,oBAAoB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"createKubernetesDesiredResource.js","sourceRoot":"","sources":["../../../../src/features/workload-reconciliation/utils/createKubernetesDesiredResource.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,mFAAmF;AACnF,MAAM,UAAU,+BAA+B,CAC7C,OAAgC,EAChC,KAA2C;IAE3C,MAAM,QAAQ,GAA0B;QACtC,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,SAAS;QACpC,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,WAAW;QACxC,OAAO,EAAE,OAAO,CAAC,YAAY;QAC7B,UAAU,EAAE,KAAK,CAAC,UAAU;KAC7B,CAAC;IACF,MAAM,SAAS,GAAG,KAAK,CAAC,SAAS,IAAI,EAAE,CAAC;IACxC,MAAM,QAAQ,GAAuB;QACnC,GAAG,KAAK,CAAC,QAAQ;QACjB,QAAQ,EAAE;YACR,GAAG,KAAK,CAAC,QAAQ,CAAC,QAAQ;YAC1B,MAAM,EAAE;gBACN,GAAG,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM;gBACjC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C;AAC7B,CAAC","sourcesContent":["import type { InfraOwnedResource, InfraResourceIdentity } from '@ankhorage/contracts/infra';\n\nimport type { KubernetesDriverRequest } from '../../../types/kubernetesDriver.js';\nimport type {\n KubernetesDesiredResource,\n KubernetesResource,\n} from '../../../types/kubernetesResources.js';\nimport { KUBERNETES_OWNERSHIP } from '../constants.js';\nimport { getKubernetesResourceKey } from './getKubernetesResourceKey.js';\nimport { getKubernetesResourceReference } from './getKubernetesResourceReference.js';\nimport { toKubernetesName } from './toKubernetesName.js';\n\n/*** Attach canonical Infra ownership to a standard Kubernetes desired resource. */\nexport function createKubernetesDesiredResource(\n request: KubernetesDriverRequest,\n input: CreateKubernetesDesiredResourceInput,\n): KubernetesDesiredResource {\n const identity: InfraResourceIdentity = {\n projectId: request.context.projectId,\n environment: request.context.environment,\n adapter: request.ownerAdapter,\n resourceId: input.resourceId,\n };\n const dependsOn = input.dependsOn ?? [];\n const resource: KubernetesResource = {\n ...input.resource,\n metadata: {\n ...input.resource.metadata,\n labels: {\n ...input.resource.metadata.labels,\n [KUBERNETES_OWNERSHIP.managedByLabel]: KUBERNETES_OWNERSHIP.managedByValue,\n [KUBERNETES_OWNERSHIP.projectLabel]: toKubernetesName(request.context.projectId),\n [KUBERNETES_OWNERSHIP.environmentLabel]: request.context.environment,\n },\n annotations: {\n ...input.resource.metadata.annotations,\n [KUBERNETES_OWNERSHIP.projectAnnotation]: request.context.projectId,\n [KUBERNETES_OWNERSHIP.environmentAnnotation]: request.context.environment,\n [KUBERNETES_OWNERSHIP.adapterAnnotation]: request.ownerAdapter,\n [KUBERNETES_OWNERSHIP.resourceAnnotation]: input.resourceId,\n [KUBERNETES_OWNERSHIP.persistentAnnotation]: String(input.persistent ?? false),\n [KUBERNETES_OWNERSHIP.retentionAnnotation]: input.retention ?? 'retain',\n [KUBERNETES_OWNERSHIP.dependenciesAnnotation]: JSON.stringify(\n dependsOn.map((dependency) => dependency.resourceId),\n ),\n },\n },\n };\n\n const owner: InfraOwnedResource = {\n identity,\n externalId: getKubernetesResourceKey(getKubernetesResourceReference(resource)),\n persistent: input.persistent ?? false,\n retention: input.retention ?? 'retain',\n dependsOn,\n };\n return { resource, owner };\n}\n\ninterface CreateKubernetesDesiredResourceInput {\n readonly resourceId: string;\n readonly resource: KubernetesResource;\n readonly persistent?: boolean;\n readonly retention?: InfraOwnedResource['retention'];\n readonly dependsOn?: readonly InfraResourceIdentity[];\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { InfraResourceIdentity } from '@ankhorage/contracts/infra';
|
|
2
|
-
import type { KubernetesDriverRequest } from '../../../types/kubernetesDriver';
|
|
2
|
+
import type { KubernetesDriverRequest } from '../../../types/kubernetesDriver.js';
|
|
3
3
|
/*** Create a runtime-owned Infra identity without provider-specific assumptions. */
|
|
4
4
|
export declare function createKubernetesIdentity(request: KubernetesDriverRequest, resourceId: string): InfraResourceIdentity;
|
|
5
5
|
//# sourceMappingURL=createKubernetesIdentity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createKubernetesIdentity.d.ts","sourceRoot":"","sources":["../../../../src/features/workload-reconciliation/utils/createKubernetesIdentity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAExE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"createKubernetesIdentity.d.ts","sourceRoot":"","sources":["../../../../src/features/workload-reconciliation/utils/createKubernetesIdentity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAExE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAElF,oFAAoF;AACpF,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,uBAAuB,EAChC,UAAU,EAAE,MAAM,GACjB,qBAAqB,CAOvB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createKubernetesIdentity.js","sourceRoot":"","sources":["../../../../src/features/workload-reconciliation/utils/createKubernetesIdentity.ts"],"names":[],"mappings":"AAIA,oFAAoF;AACpF,MAAM,UAAU,wBAAwB,CACtC,OAAgC,EAChC,UAAkB;IAElB,OAAO;QACL,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,SAAS;QACpC,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,WAAW;QACxC,OAAO,EAAE,OAAO,CAAC,YAAY;QAC7B,UAAU;KACX,CAAC;AACJ,CAAC","sourcesContent":["import type { InfraResourceIdentity } from '@ankhorage/contracts/infra';\n\nimport type { KubernetesDriverRequest } from '../../../types/kubernetesDriver';\n\n/*** Create a runtime-owned Infra identity without provider-specific assumptions. */\nexport function createKubernetesIdentity(\n request: KubernetesDriverRequest,\n resourceId: string,\n): InfraResourceIdentity {\n return {\n projectId: request.context.projectId,\n environment: request.context.environment,\n adapter: request.ownerAdapter,\n resourceId,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"createKubernetesIdentity.js","sourceRoot":"","sources":["../../../../src/features/workload-reconciliation/utils/createKubernetesIdentity.ts"],"names":[],"mappings":"AAIA,oFAAoF;AACpF,MAAM,UAAU,wBAAwB,CACtC,OAAgC,EAChC,UAAkB;IAElB,OAAO;QACL,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,SAAS;QACpC,WAAW,EAAE,OAAO,CAAC,OAAO,CAAC,WAAW;QACxC,OAAO,EAAE,OAAO,CAAC,YAAY;QAC7B,UAAU;KACX,CAAC;AACJ,CAAC","sourcesContent":["import type { InfraResourceIdentity } from '@ankhorage/contracts/infra';\n\nimport type { KubernetesDriverRequest } from '../../../types/kubernetesDriver.js';\n\n/*** Create a runtime-owned Infra identity without provider-specific assumptions. */\nexport function createKubernetesIdentity(\n request: KubernetesDriverRequest,\n resourceId: string,\n): InfraResourceIdentity {\n return {\n projectId: request.context.projectId,\n environment: request.context.environment,\n adapter: request.ownerAdapter,\n resourceId,\n };\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { KubernetesDriverRequest } from '../../../types/kubernetesDriver';
|
|
2
|
-
import type { KubernetesOwnershipQuery } from '../../../types/kubernetesResources';
|
|
1
|
+
import type { KubernetesDriverRequest } from '../../../types/kubernetesDriver.js';
|
|
2
|
+
import type { KubernetesOwnershipQuery } from '../../../types/kubernetesResources.js';
|
|
3
3
|
/*** Build the narrow ownership selector used for every read and prune operation. */
|
|
4
4
|
export declare function getKubernetesOwnershipQuery(request: KubernetesDriverRequest): KubernetesOwnershipQuery;
|
|
5
5
|
//# sourceMappingURL=getKubernetesOwnershipQuery.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getKubernetesOwnershipQuery.d.ts","sourceRoot":"","sources":["../../../../src/features/workload-reconciliation/utils/getKubernetesOwnershipQuery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"getKubernetesOwnershipQuery.d.ts","sourceRoot":"","sources":["../../../../src/features/workload-reconciliation/utils/getKubernetesOwnershipQuery.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAClF,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,uCAAuC,CAAC;AAItF,oFAAoF;AACpF,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,uBAAuB,GAC/B,wBAAwB,CAY1B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { KUBERNETES_OWNERSHIP } from '../constants';
|
|
2
|
-
import { toKubernetesName } from './toKubernetesName';
|
|
1
|
+
import { KUBERNETES_OWNERSHIP } from '../constants.js';
|
|
2
|
+
import { toKubernetesName } from './toKubernetesName.js';
|
|
3
3
|
/*** Build the narrow ownership selector used for every read and prune operation. */
|
|
4
4
|
export function getKubernetesOwnershipQuery(request) {
|
|
5
5
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getKubernetesOwnershipQuery.js","sourceRoot":"","sources":["../../../../src/features/workload-reconciliation/utils/getKubernetesOwnershipQuery.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"getKubernetesOwnershipQuery.js","sourceRoot":"","sources":["../../../../src/features/workload-reconciliation/utils/getKubernetesOwnershipQuery.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD,oFAAoF;AACpF,MAAM,UAAU,2BAA2B,CACzC,OAAgC;IAEhC,OAAO;QACL,SAAS,EACP,OAAO,CAAC,SAAS;YACjB,gBAAgB,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;QACjF,MAAM,EAAE;YACN,CAAC,oBAAoB,CAAC,cAAc,CAAC,EAAE,oBAAoB,CAAC,cAAc;YAC1E,CAAC,oBAAoB,CAAC,YAAY,CAAC,EAAE,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC;YAChF,CAAC,oBAAoB,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,WAAW;SACrE;QACD,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;KACpF,CAAC;AACJ,CAAC","sourcesContent":["import type { KubernetesDriverRequest } from '../../../types/kubernetesDriver.js';\nimport type { KubernetesOwnershipQuery } from '../../../types/kubernetesResources.js';\nimport { KUBERNETES_OWNERSHIP } from '../constants.js';\nimport { toKubernetesName } from './toKubernetesName.js';\n\n/*** Build the narrow ownership selector used for every read and prune operation. */\nexport function getKubernetesOwnershipQuery(\n request: KubernetesDriverRequest,\n): KubernetesOwnershipQuery {\n return {\n namespace:\n request.namespace ??\n toKubernetesName(`${request.context.projectId}-${request.context.environment}`),\n labels: {\n [KUBERNETES_OWNERSHIP.managedByLabel]: KUBERNETES_OWNERSHIP.managedByValue,\n [KUBERNETES_OWNERSHIP.projectLabel]: toKubernetesName(request.context.projectId),\n [KUBERNETES_OWNERSHIP.environmentLabel]: request.context.environment,\n },\n ...(request.context.signal === undefined ? {} : { signal: request.context.signal }),\n };\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { KubernetesResourceReference } from '../../../types/kubernetesResources';
|
|
1
|
+
import type { KubernetesResourceReference } from '../../../types/kubernetesResources.js';
|
|
2
2
|
/*** Build a stable comparison key for a Kubernetes resource identity. */
|
|
3
3
|
export declare function getKubernetesResourceKey(resource: KubernetesResourceReference): string;
|
|
4
4
|
//# sourceMappingURL=getKubernetesResourceKey.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getKubernetesResourceKey.d.ts","sourceRoot":"","sources":["../../../../src/features/workload-reconciliation/utils/getKubernetesResourceKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"getKubernetesResourceKey.d.ts","sourceRoot":"","sources":["../../../../src/features/workload-reconciliation/utils/getKubernetesResourceKey.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,uCAAuC,CAAC;AAEzF,yEAAyE;AACzE,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,2BAA2B,GAAG,MAAM,CAEtF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getKubernetesResourceKey.js","sourceRoot":"","sources":["../../../../src/features/workload-reconciliation/utils/getKubernetesResourceKey.ts"],"names":[],"mappings":"AAEA,yEAAyE;AACzE,MAAM,UAAU,wBAAwB,CAAC,QAAqC;IAC5E,OAAO,CAAC,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,SAAS,IAAI,EAAE,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACjG,CAAC","sourcesContent":["import type { KubernetesResourceReference } from '../../../types/kubernetesResources';\n\n/*** Build a stable comparison key for a Kubernetes resource identity. */\nexport function getKubernetesResourceKey(resource: KubernetesResourceReference): string {\n return [resource.apiVersion, resource.kind, resource.namespace ?? '', resource.name].join('/');\n}\n"]}
|
|
1
|
+
{"version":3,"file":"getKubernetesResourceKey.js","sourceRoot":"","sources":["../../../../src/features/workload-reconciliation/utils/getKubernetesResourceKey.ts"],"names":[],"mappings":"AAEA,yEAAyE;AACzE,MAAM,UAAU,wBAAwB,CAAC,QAAqC;IAC5E,OAAO,CAAC,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC,SAAS,IAAI,EAAE,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACjG,CAAC","sourcesContent":["import type { KubernetesResourceReference } from '../../../types/kubernetesResources.js';\n\n/*** Build a stable comparison key for a Kubernetes resource identity. */\nexport function getKubernetesResourceKey(resource: KubernetesResourceReference): string {\n return [resource.apiVersion, resource.kind, resource.namespace ?? '', resource.name].join('/');\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { KubernetesResource, KubernetesResourceReference } from '../../../types/kubernetesResources';
|
|
1
|
+
import type { KubernetesResource, KubernetesResourceReference } from '../../../types/kubernetesResources.js';
|
|
2
2
|
/*** Return the immutable Kubernetes identity of a desired or observed resource. */
|
|
3
3
|
export declare function getKubernetesResourceReference(resource: KubernetesResource): KubernetesResourceReference;
|
|
4
4
|
//# sourceMappingURL=getKubernetesResourceReference.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getKubernetesResourceReference.d.ts","sourceRoot":"","sources":["../../../../src/features/workload-reconciliation/utils/getKubernetesResourceReference.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,2BAA2B,EAC5B,MAAM,
|
|
1
|
+
{"version":3,"file":"getKubernetesResourceReference.d.ts","sourceRoot":"","sources":["../../../../src/features/workload-reconciliation/utils/getKubernetesResourceReference.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,kBAAkB,EAClB,2BAA2B,EAC5B,MAAM,uCAAuC,CAAC;AAE/C,mFAAmF;AACnF,wBAAgB,8BAA8B,CAC5C,QAAQ,EAAE,kBAAkB,GAC3B,2BAA2B,CAS7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getKubernetesResourceReference.js","sourceRoot":"","sources":["../../../../src/features/workload-reconciliation/utils/getKubernetesResourceReference.ts"],"names":[],"mappings":"AAKA,mFAAmF;AACnF,MAAM,UAAU,8BAA8B,CAC5C,QAA4B;IAE5B,OAAO;QACL,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,IAAI,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI;QAC5B,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,SAAS,KAAK,SAAS;YAC3C,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC;KAChD,CAAC;AACJ,CAAC","sourcesContent":["import type {\n KubernetesResource,\n KubernetesResourceReference,\n} from '../../../types/kubernetesResources';\n\n/*** Return the immutable Kubernetes identity of a desired or observed resource. */\nexport function getKubernetesResourceReference(\n resource: KubernetesResource,\n): KubernetesResourceReference {\n return {\n apiVersion: resource.apiVersion,\n kind: resource.kind,\n name: resource.metadata.name,\n ...(resource.metadata.namespace === undefined\n ? {}\n : { namespace: resource.metadata.namespace }),\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"getKubernetesResourceReference.js","sourceRoot":"","sources":["../../../../src/features/workload-reconciliation/utils/getKubernetesResourceReference.ts"],"names":[],"mappings":"AAKA,mFAAmF;AACnF,MAAM,UAAU,8BAA8B,CAC5C,QAA4B;IAE5B,OAAO;QACL,UAAU,EAAE,QAAQ,CAAC,UAAU;QAC/B,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,IAAI,EAAE,QAAQ,CAAC,QAAQ,CAAC,IAAI;QAC5B,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,SAAS,KAAK,SAAS;YAC3C,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC;KAChD,CAAC;AACJ,CAAC","sourcesContent":["import type {\n KubernetesResource,\n KubernetesResourceReference,\n} from '../../../types/kubernetesResources.js';\n\n/*** Return the immutable Kubernetes identity of a desired or observed resource. */\nexport function getKubernetesResourceReference(\n resource: KubernetesResource,\n): KubernetesResourceReference {\n return {\n apiVersion: resource.apiVersion,\n kind: resource.kind,\n name: resource.metadata.name,\n ...(resource.metadata.namespace === undefined\n ? {}\n : { namespace: resource.metadata.namespace }),\n };\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { InfraOwnedResource } from '@ankhorage/contracts/infra';
|
|
2
|
-
import type { KubernetesDriverRequest } from '../../../types/kubernetesDriver';
|
|
3
|
-
import type { KubernetesResource } from '../../../types/kubernetesResources';
|
|
2
|
+
import type { KubernetesDriverRequest } from '../../../types/kubernetesDriver.js';
|
|
3
|
+
import type { KubernetesResource } from '../../../types/kubernetesResources.js';
|
|
4
4
|
/*** Read trusted ownership metadata, rejecting resources outside the active Infra identity. */
|
|
5
5
|
export declare function readKubernetesOwnedResource(resource: KubernetesResource, request: KubernetesDriverRequest): InfraOwnedResource | undefined;
|
|
6
6
|
//# sourceMappingURL=readKubernetesOwnedResource.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readKubernetesOwnedResource.d.ts","sourceRoot":"","sources":["../../../../src/features/workload-reconciliation/utils/readKubernetesOwnedResource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAyB,MAAM,4BAA4B,CAAC;AAE5F,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"readKubernetesOwnedResource.d.ts","sourceRoot":"","sources":["../../../../src/features/workload-reconciliation/utils/readKubernetesOwnedResource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAyB,MAAM,4BAA4B,CAAC;AAE5F,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAClF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uCAAuC,CAAC;AAKhF,+FAA+F;AAC/F,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,EAAE,uBAAuB,GAC/B,kBAAkB,GAAG,SAAS,CAmChC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { KUBERNETES_OWNERSHIP } from '../constants';
|
|
2
|
-
import { getKubernetesResourceKey } from './getKubernetesResourceKey';
|
|
3
|
-
import { getKubernetesResourceReference } from './getKubernetesResourceReference';
|
|
1
|
+
import { KUBERNETES_OWNERSHIP } from '../constants.js';
|
|
2
|
+
import { getKubernetesResourceKey } from './getKubernetesResourceKey.js';
|
|
3
|
+
import { getKubernetesResourceReference } from './getKubernetesResourceReference.js';
|
|
4
4
|
/*** Read trusted ownership metadata, rejecting resources outside the active Infra identity. */
|
|
5
5
|
export function readKubernetesOwnedResource(resource, request) {
|
|
6
6
|
const { annotations } = resource.metadata;
|