feat(deployer): separate kubernetes and standalone code paths #647
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
thwap/thwap-pagesd!647
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/deployer-selection"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Separate the Kubernetes and standalone deployment code paths behind a single
Deployerinterface, and allow selecting the backend at startup.site.KubernetesClientrenamed tosite.Deployer;SiteServicenow holds adeployerinstead of a kubernetes client, making it agnostic to the runtime.kubernetes.Clientrenamed toKubernetesDeployer(New→NewKubernetesDeployer); the redundant producer-sideKubernetesServiceinterface is removed (superseded bysite.Deployer).internal/docker/deployer.goimplementingsite.Deployer, verifying Docker socket access at construction (CheckAccess);SiteURL/PreviewURLcomputed from base domain; lifecycle operations return clear not-implemented errors until Phase 2 (container lifecycle).config.Deployer(defaultkubernetes);--deployerflag, bareDEPLOYERenv var, and config resolution incmd/thwap-pagesd/main.go;buildRouterconstructs the selected deployer and matching site repository (standalone uses in-memory persistence until Phase 6 SQLite). Unknown values (e.g.swarm) rejected until Phase 5.Why
Phase 1 requires the deployer seam before standalone container operations (Phase 2), config extensions (#343), and site operations (Phase 4) can be layered on. This makes the deployment backend a single, selectable point of configuration.
Testing
internal/docker—StandaloneDeployertests: nil-client, socket-access failure at construction, URL helpers (default host + custom domain), lifecycle not-implemented errorscmd/thwap-pagesd—resolveDeployerprecedence (flag > env > config > default) andvalidateDeployerrejection testsinternal/config— default deployer assertion; YAML/TOML fixtures updatedgo vet ./...cleango test -race -count=1 ./...— 37 packages pass, no failuresBreaking Changes
None externally. Internal renames (
KubernetesClient→Deployer,kubernetes.Client→KubernetesDeployer,kubernetes.New→NewKubernetesDeployer) affect internal callers only.Notes
Standalone mode's container lifecycle is intentionally deferred:
CreateSiteIngress/PublishSite/etc. return not-implemented errors until Phase 2 (#349) fills them in. Site persistence for standalone is in-memory until Phase 6 (#432) introduces the local database.Closes #333
Closes #334
Closes #335
Closes #336
Closes #337
Clean seam. The
Deployerinterface rename is complete and mechanical (no leftoverKubernetesClient/kubernetes.Newcallers), the redundant producer-sideKubernetesServiceinterface is correctly removed,resolveDeployerprecedence (flag > DEPLOYER env > config incl.THWAP_PAGESD_DEPLOYER> default) is sound and well tested, and the standalone deployer fails fast on socket access. Referenced issues #333–#337 match the roadmap checkboxes.Suggestions
cmd/thwap-pagesd/main.go(newDeployer) — standalone's base domain comes fromcfg.Kubernetes.BaseDomain, so standalone mode still reads thekubernetesconfig section. Consider a dedicated standalone config value (ties to #338) or document the reuse. Filed as #648.internal/docker/deployer.go— thepackage dockerdoc comment is duplicated verbatim fromdocker.go; single package comment per package. Filed as #649.cmd/thwap-pagesd/main.go—newDeployerbranching (kubernetes/standalone) is untested; consider injectable constructor funcs or a fake-socket test. Filed as #650.internal/docker/deployer.go— deferred lifecycle ops return ad-hoc errors; a sharedErrNotImplementedsentinel would let the API return 501 vs 500 until Phase 2. Filed as #651.Questions
CheckAccesswith a timeout) is now relevant at daemon startup, sinceNewStandaloneDeployerperforms the check at construction.No blocking issues. Approving.