feat(console): add fleetsK8sToml.ts, the client-side write helper for fleets-k8s.toml (studio#104) - #110
Open
brettchien wants to merge 1 commit into
Conversation
… fleets-k8s.toml (studio#104) Sixth sub-item of #104, stacked on #109. Mirrors fleetToml.ts for fleets-k8s.toml, same rationale: k8s_fleet_config_write (#107) has no partial/append primitive, so the client computes the new/edited TOML text and calls it with the whole file. `findFleetBlock`/`appendMember` are identical between the two files (same `[fleet.<name>]` table shape, same `members = [...]` array, neither references any AWS-specific field) — reused via import from fleetToml.ts rather than duplicated. Exported `quote()` from fleetToml.ts (was a private helper) so both modules share the one implementation. Only `appendK8sFleetBlock` (creating a brand-new fleet block) is new code — required/optional fields differ from AWS's appendFleetBlock: `context` (optional) + `namespace` (required, always written) instead of region+profile, same `expected_principal` (optional) as AWS. **Not wired into deploy.ts's submit flow yet** — the k8s identity form still can't submit (see #108: deploy_provision has no k8s dispatch, architecture question still open in #104). This PR is the write-path helper only, same "build the piece, wire it once its dependency resolves" pattern as #107's k8s_fleet_config_write tool (also not yet called by anything). Verified locally: npm run typecheck clean, npm test 106/106 (4 new tests), npm run build succeeds. Ref: studio#104.
brettchien
added a commit
that referenced
this pull request
Aug 27, 2026
…104) t_provision now branches on a new provider arg (default "aws", unchanged behavior): "k8s" calls provision_from_library_k8s (#114) with context/ expected_principal taken as direct args, not resolved via a fleet name — the console's identity form already collects context/namespace/service- account directly (#108/#109), and for a brand-new fleet there's no existing K8sFleetBinding to look up anyway. Fleet-scoped k8s lookup (for redeploying into an already-known k8s fleet) is left as explicit future work, not needed for this dispatch to exist. Also updates deploy_provision's tool description, which was stale after #113 (redeploy no longer requires an existing manifest) and needed the new provider/context/expected_principal params documented. NOTE — branch lineage: this stack (#112→#113→#114→this) was cut from `main` before #104's original stack (#105-110) merged, not from #110 — so K8sFleetBinding.expected_principal (originally #107) is re-added here too. Identical field in both places; trivial merge conflict to resolve whenever both land, flagging explicitly rather than silently duplicating without a note. With this, deploy_provision fully supports k8s end-to-end (provisioning side) — the remaining piece for full onboarding is unblocking console's k8s "Next" button (#108/#109's placeholder), a separate follow-up. Ref: studio#104.
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.
Summary
Sixth sub-item of #104, stacked on #109 (→ #108 → #107 → #106 → #105, merge in order). New
console/src/fleetsK8sToml.ts— the client-side text-mutation helper forfleets-k8s.toml, mirroringfleetToml.ts(used for AWS'sfleets.toml). Same rationale as the original:k8s_fleet_config_write(#107) has no partial/append primitive — it overwrites the whole file — so the client computes the new/edited TOML text and calls it with the full content.findFleetBlock/appendMemberare reused, not duplicated — both files share the exact same[fleet.<name>]table shape andmembers = [...]array, and neither function references any AWS-specific field (region/profile never appear in their logic).fleetsK8sToml.tsimports and re-exportsappendMemberfromfleetToml.tsrather than copy-pasting it.quote()fromfleetToml.ts(was a private one-line helper) so both modules share the one implementation instead of duplicating aJSON.stringifywrapper.appendK8sFleetBlockis the only genuinely new function — creates a brand-new[fleet.<name>]block. Field shape differs from AWS'sappendFleetBlock:context(optional) +namespace(required, always written) instead of region+profile; sameexpected_principal(optional) as AWS.Not wired into
deploy.tsyetThe k8s identity form still can't submit (#108 blocks it —
deploy_provisionhas no k8s dispatch, and the architecture question posted to #104 is still unanswered). This PR is the write-path helper only, built ahead of its consumer — same pattern as #107'sk8s_fleet_config_writetool, which also isn't called by anything yet. Once thedeploy_provisionquestion resolves, wiringdeploy.ts's k8s submit path is: calldeploy_provision(or whatever the resolved dispatch mechanism is) → on success,appendK8sFleetBlock/appendMember(mode-dependent, same branchingdeploy.tsalready does for AWS) →k8s_fleet_config_write.Testing
New
fleetsK8sToml.test.ts, mirroringfleetToml.test.ts's coverage:appendMemberworks against the k8s file's shape,appendK8sFleetBlockwrites all fields / omits optional ones / spaces blocks correctly.npm run typecheckclean,npm test106/106 (4 new),npm run buildsucceeds.Scope note
The
deploy_provision/K8sDriverdispatch design question is still the one blocking item for full end-to-end k8s onboarding — tracked in #104, unresolved as of this PR. With this PR, every independently-buildable piece of #104's scope is now open as a PR.Ref #104. Stacks on #109 (→ #108 → #107 → #106 → #105) — merge in order.