Skip to content

feat(web): pick a site profile preset on deploy; edit the release's affinity and tolerations on upgrade - #127

Open
aceforeverd wants to merge 3 commits into
mainfrom
feat-site-presets
Open

aceforeverd wants to merge 3 commits into
mainfrom
feat-site-presets

Conversation

@aceforeverd

@aceforeverd aceforeverd commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • feature

What this PR does and why

Deploy (modules/swiss and modules/inferences):

  • A Preset select appears when the site profile lists presets, defaulting to none.
  • Picking one shows its description and its values as YAML.
  • The web merges the preset into the form layer it builds:
    • maps merge;
    • a list keeps the preset's items and adds the form's it lacks, ignoring key order;
    • a value the form sets wins.
  • Compose and apply are unchanged.

Upgrade (both modules): there is no preset concept on upgrade.

  • The web rebuilds the whole form layer, the release's own with the form's values over it, and sends it.
  • Affinity: every rule in affinity and in each pd.<role>.affinityReplace shows as a YAML box you can edit, or remove and undo. That includes the GPU product term. Compose stays disabled while a box doesn't parse.
  • Tolerations: they come back exactly as deployed.
    • Kept now: a toleration with no key (it tolerates every taint), tolerationSeconds, and a missing operator read as Equal.
    • Before, the first two were dropped and a missing operator was read as Exists.
    • Removing every row sends [].

Site profile pages (both):

  • The page shows a Presets section.
  • The edit form has a Presets section: each preset is listed with edit and remove.
  • A dialog takes the name, description and values as YAML. It stores the preset only once the name is set and unique and the values parse to a map.

Shortcomings: swissd still merges an upgrade over the release's form layer, so a map key the web leaves out stays. That decides how the last item of a list is removed:

Removed Sent
a role's last affinity rule pd.<role>.affinityReplace: null, which the chart reads as inherit
the last required node term the required block as null, since Kubernetes refuses an empty nodeSelectorTerms
the last item of any other list []

modelsphere/swiss#56 tracks storing the form layer exactly as sent. That issue also covers:

  • switches the form always sends, so a preset can't set them;
  • the GPU product term that swissd writes over the form's while products are picked.

Which issue(s) this PR fixes

Needs modelsphere/swiss#57 (swissd parses presets).
Refs modelsphere/modelsphere#57 (item 3), modelsphere/swiss#56.

How it was tested

  • formLayer.test.ts:
    • preset merge and list de-duplication;
    • overlay onto the release's form layer;
    • listing affinity rules, editing them (strings stay strings) and invalid YAML;
    • writing the lists back, including the [] and null cases;
    • tolerations round-tripping exactly, an edited row keeping tolerationSeconds, and removing every row.
  • profile.test.ts: a preset's row round-trip, its name and values errors, and renaming, adding and removing.
  • Not tried in a browser or on a cluster.

Checks

  • npm run typecheck && npm test && npm run build in web/ (613 tests)
  • No internal hostnames, IPs, registries or credentials

Notes for reviewers

Start with web/src/modules/swiss/lib/formLayer.ts and affinity.ts, then planRequest in DeploySettings.tsx.

Release note

Deploy can pick a site profile preset. Upgrade shows the release's affinity and tolerations exactly, each one editable or removable. Needs a swissd that accepts the profile's presets.

…ffinity and tolerations on upgrade

Deploy, in both modules, offers the site profile's presets. The picked
one is merged into the form layer the web builds: maps merge, a list
keeps both sides' items once, and a value the form sets wins.

An upgrade rebuilds the whole form layer: the release's own, with the
form's values over it. Every affinity rule in affinity and in each
pd.<role>.affinityReplace shows as YAML to edit or remove, and the
tolerations come back exactly as deployed, keys no field shows included.
A list emptied of rules goes as [] or, where that is not valid, null,
since swissd still merges an upgrade over the release's form layer.

The site profile pages list the presets.
A Presets section in both modules' profile forms lists each preset with
edit and remove; a dialog takes its name, description and values as YAML,
and stores it only once the name is set and unique and the values parse
to a map.
The preset picker moves next to the tolerations in both modules, and the
inferences one uses FieldSelect so its floating label no longer sits on
the selected value.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant