fix(kubernetes): harden ServiceAccount/ConfigMap/Job/Object reconcile + add lifecycle convergence tests#235
Closed
sam-goodwin wants to merge 1 commit intomainfrom
Closed
fix(kubernetes): harden ServiceAccount/ConfigMap/Job/Object reconcile + add lifecycle convergence tests#235sam-goodwin wants to merge 1 commit intomainfrom
sam-goodwin wants to merge 1 commit intomainfrom
Conversation
… + add lifecycle convergence tests - Map HTTP status to narrow typed errors (NotFound/Conflict/Gone/Unauthorized/ServerError) - Retry SSA Conflict + 5xx with exponential backoff on applyObject/deleteObject - Idempotent delete with propagationPolicy: Background; 404 swallowed - Send application/apply-patch+yaml only for PATCH; JSON otherwise - ConfigMap.binaryData / .immutable; ServiceAccount.automountServiceAccountToken / .imagePullSecrets; Job.parallelism / .completions / .backoffLimit / .activeDeadlineSeconds / .ttlSecondsAfterFinished / .annotations - Pure unit tests for classifier, kind support, path builder, apply/delete ordering Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Contributor
|
Install the packages built from this commit: alchemy bun add alchemy@https://pkg.ing/alchemy/93b96fb@alchemy.run/better-auth bun add @alchemy.run/better-auth@https://pkg.ing/@alchemy.run/better-auth/93b96fb@alchemy.run/pr-package bun add @alchemy.run/pr-package@https://pkg.ing/@alchemy.run/pr-package/93b96fb |
Contributor
Website Preview DeployedURL: https://alchemyeffectwebsite-worker-pr-235-wfg5itvz6426xl4d.testing-2b2.workers.dev Built from commit This comment updates automatically with each push. |
Contributor
Author
|
Superseded by #249 (consolidated hardening sweep). Closing — the equivalent commit landed on |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tighten the Kubernetes REST client and surface a few real props on the resource wrappers. Out-of-band edits and transient API failures used to fall through
requestJsonas untyped errors; the reconciler now reacts to them deterministically.Reconciler changes
Typed errors per HTTP status, instead of the single
KubernetesApiErrorcatch-all:Apply and delete now ride out transient races:
deleteObjectusespropagationPolicy: Backgroundso dependents (Job-managed Pods) are reaped without blocking, and 404 is treated as the desired terminal state.Apply also stops sending
application/apply-patch+yamlfor non-PATCH verbs:Resource wrappers grew the props that practical use needs:
ConfigMap—binaryData,immutableServiceAccount—automountServiceAccountToken,imagePullSecretsJob—parallelism,completions,backoffLimit,activeDeadlineSeconds,ttlSecondsAfterFinished,annotationsJSDoc on
Objectnow spells out that custom resources work as long as theirapiVersion/kindis registered insupportedKinds.New lifecycle tests
Pure unit tests in
packages/alchemy/test/Kubernetes/client.test.ts(24 cases). Integration coverage is deferred — there is no kind/minikube fixture in this repo yet, so per-resource lifecycle convergence (no-op redeploy, drift reconcile, OOB delete recovery, name-change replace, double-destroy) cannot be exercised end-to-end without standing one up.classifyKubernetesStatus— every status maps to its narrowest typed error; 422 stays untyped (context-dependent, not auto-retried)isKubernetesKindSupported— accepts the six canonical kinds, rejects unknown CRDs without throwingbuildKubernetesObjectPath— core vs grouped vs cluster-scoped; throws on missing namespace for namespaced kindschunkByApplyRank/sortRefsForDelete— Namespace -> SA -> CM -> Job on apply, exact reverse on delete