mirror of
https://github.com/harvester/harvester-ui-extension.git
synced 2026-11-21 16:22:08 +08:00
4c60f8ec340ebef12d33d2bcdff477d8b93b6e3b
3
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
e66b61d0d1 |
feat: add the Kube-OVN VPC Egress Gateways page (#1263)
* feat: add the Kube-OVN VPC Egress Gateways page List, create and edit VpcEgressGateway resources under Overlay Networks > NAT & Internet, right below the NAT gateways, which are now labeled NAT Gateways. The form covers the VPC, replicas, internal and external subnets, SNAT policies, internal and external IPs, BFD and the bandwidth limit, and keeps the fields it does not show. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * feat: add the VPC BFD port and link the Egress Gateway BFD warning to it The VPC form gets a BFD Port tab with the enabled switch and its IP, which an Egress Gateway with BFD needs. The gateway form now checks the VPC's spec.bfdPort instead of a spec.bfd field that VPCs don't have, and its warning links to the VPC. Bandwidth also takes quantities such as 1Gi, and a gateway that only uses selectors no longer needs a policy. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * feat: check the Egress Gateway and BFD port against what Kube-OVN accepts Kube-OVN runs as a secondary CNI in Harvester, so an Egress Gateway's internal subnet has to sit on a virtual machine network and its external subnet on a network attachment; the subnet lists now offer only those. The internal and external IPs must be unique and inside their subnet, other than its gateway, and the two subnets must differ. Selectors don't work in that mode, so a gateway needs a policy again. Policies set with IP blocks show them, and BFD intervals hidden while BFD is off fall back to their defaults. Save stays disabled while either form is invalid, each field shows its own error, and a tab with errors is marked. The VPC's BFD port IP can't be in one of its subnets, its tab warns when it is turned off while gateways of the VPC use BFD, and the gateway's BFD warning opens the VPC's BFD Port tab in a new tab. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * fix: show why Save is disabled on the Egress Gateway and VPC forms Every field that can block Save shows its own message once touched: the name, the VPC and both subnets, which have none when left empty. When the chosen VPC has no subnet on a virtual machine network, the Internal Subnet placeholder says so. A subnet can only be in one policy: the gateway leaves a source out of SNAT when any policy has SNAT off for it, so the same subnet in a second policy would silently ignore one of them. Enable SNAT explains what turning it off needs. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * fix: keep one Egress Gateway policy for each SNAT setting Kube-OVN merges the sources of every policy with the same SNAT setting, so a second policy with SNAT on (or off) only adds to the first one. The form now flags it on the second policy, Add Policy adds the setting that isn't used yet and goes away once both exist, and the Policies tab says a gateway has at most two policies. Policies with IP blocks are left out of the check, since the form can't move those. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * refactor: ask for the Egress Gateway subnets with and without SNAT Kube-OVN puts the sources of every policy into two sets, with SNAT and without, and leaves a source out of SNAT when any policy has SNAT off for it. A list of policies with a checkbox each let the form build policies that only repeated or silently overrode each other, so the Policies tab now asks for those two sets: Subnets with SNAT and Subnets without SNAT, a subnet in one list only and at least one subnet in all. Saving writes one policy for each list that has subnets. Editing reads existing policies the way Kube-OVN applies them, so a subnet that was in both lands in Subnets without SNAT, and IP blocks set outside the form are kept and shown read-only. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * refactor: go back to the Egress Gateway policy list The VpcEgressGateway CRD and the issue describe policies as a list, each with snat and subnets, and Kube-OVN accepts any number of them: policies with the same SNAT setting just work together. The two subnet lists hid that shape and rewrote existing policies, and they couldn't mark "one of these two" as required. This puts back the policy list, where each policy needs a subnet and a subnet can be in one policy only, which is the one case that changes what the gateway does. The Policies tab now says how policies work together. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * refactor: ask for the Egress Gateway subnets with and without SNAT again Kube-OVN only uses which subnets have SNAT and which don't, so two lists, Subnets with SNAT and Subnets without SNAT, hold the same data as the policy list, are clearer to fill in, and can't build a policy that repeats or overrides another. Saving writes one policy for each list that has subnets. Neither list is marked required: the Policies tab says one subnet in either list is needed, and both lists show that message once touched while they're empty. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * fix: show the Egress Gateway policy rule once for both subnet lists One subnet in either list is enough, but a warning on each list read as if both lists were required. The lists no longer show a warning; one message under them says to select at least one subnet in either list while both are empty, next to the tab mark and the disabled Save. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * fix: say why the Egress Gateway subnet lists are empty The policy lists only offer subnets of the VPC chosen on the Basic tab, so before a VPC is chosen they were empty with no reason given. They now say to select a VPC on the Basic tab first, or that the chosen VPC has no subnets. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * fix: make the Egress Gateway fields that need a VPC say so Internal Subnet and both policy lists only offer subnets of the chosen VPC, so they're disabled until a VPC is chosen and say to select one first. The policy lists keep their dropdown attached to the field, so it follows the field when a chip is removed instead of leaving a gap. The BFD intervals are labeled Receive Interval and Transmit Interval, which fit next to their unit, with a tooltip each. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * fix: keep the external subnet out of Egress Gateway policies and check usable IPs Kube-OVN reroutes a policy's sources to the gateway, so the gateway's own external subnet as a source would send its outbound traffic back into it; the policy lists no longer offer it and the form flags it. Static IPs must also be usable addresses: Kube-OVN assigns from the network address + 1 to the broadcast address - 1, so those two are rejected along with the gateway. The policy rule is an error banner like the IP count rule, the BFD multiplier has its own message, the IP Addresses and Bandwidth instructions are hidden on the read-only page, and the VPC's warning about gateways that need its BFD port reads right for one gateway. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * chore: declare ipaddr.js, which the subnet model imports It was only installed as a dependency of webpack-dev-server. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * feat: support PrimaryCNI Egress Gateways Kube-OVN v1.17 can send a gateway's traffic out through the pod network when it isn't the primary CNI, as on Harvester. Such a gateway takes no external subnet, external IPs or bandwidth, so the form couldn't save one. The Basic tab now picks the external network, locked after creation, and hides the fields PrimaryCNI doesn't take. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * fix: offer Primary CNI only when the cluster's CRD has it Kube-OVN v1.16, in Harvester v1.10.0-rc1 and older, has no externalNetworkMode and requires an external subnet, so a Primary CNI gateway was rejected there. The form reads the CRD's schema definition and only shows the External Network choice when the field exists. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> --------- Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> |
||
|
|
aa6d11a840 |
fix: block VM creation/save with invalid CloudInit YAML (#1040)
* fix(vm): block VM creation with invalid CloudInit YAML content * fix(vm): add isWindows guard to validateCloudInit in template version * fix: validate Windows CloudInit YAML on save Co-authored-by: a110605 <5744158+a110605@users.noreply.github.com> * fix: validate cloud-init by format in the VM mixin Cloud-init picks the user data format from the first line, so scripts, MIME messages and Jinja templates are valid without being YAML. Parsing all user data blocked them, and it stopped any existing VM holding one from being saved, even with nothing changed. Only parse user data that starts with #cloud-config, and require a mapping for it and for network data, because plain words are valid YAML and were still saved. Both forms already use the VM mixin, so the check moves there and shares the header pattern with hasCloudConfigComment. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * fix: save other user data formats as typed and check text without a header The form added #cloud-config to any user data that parses as YAML, so a script was saved with the header and its lines folded together, and Edit Config then failed the check on it. User data that starts with a script, MIME or another cloud-init or Cloudbase-Init format is now saved as typed, and any other text is checked as cloud-config, with or without the header, because the form adds the header when saving it. Editing only checks cloud-init that changed, so a VM saved before this change can still be edited with the cloud-init it already has. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> --------- Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: a110605 <5744158+a110605@users.noreply.github.com> Co-authored-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> |
||
|
|
d6f6f7c54c |
chore(deps): bump @rancher/shell to 3.0.14 (#1208)
* chore(deps): bump @rancher/shell to 3.0.14 3.0.14 resolves [[name]] tokens in translations from values registered as l10n globals, which the standalone UI needs to pick the product name. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * fix: save cloud-config template edits with @rancher/shell 3.0.14 The YamlEditor of shell 3.0.14 no longer emits onChanges, so editing a template saved its old cloud config. Copy the text from update:value, which both shell versions emit. Jest transforms @replit/codemirror-vim-core, an ESM-only dependency of the new YamlEditor, like the dashboard does. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * fix: keep the YAML editor heights with CodeMirror 6 The min-height rules targeted the CodeMirror 5 element, so the editors shrank to their text. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * fix: reject IP ranges the network settings don't support The CIDR check of @rancher/shell 3.0.14 also accepts short forms such as 10.1/16, extra parts and IPv6, so the VM migration, RWX and storage network settings saved them. Use a strict IPv4 CIDR check of our own. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * fix: keep the look of the file selector buttons The FileSelector of @rancher/shell 3.0.14 no longer takes button classes and renders a medium secondary button. Pass the variant and size that match the previous primary and secondary buttons. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * fix: keep Enter in a migration wizard field on the same step The Wizard of @rancher/shell 3.0.14 renders its step headers as submit buttons, so Enter in a text field clicked the first one and jumped back to step 1. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * fix: show the created message after a restore, upgrade or upload Since @rancher/shell 3.0.14, save() no longer shows the message for resources with a generated name; callers show it with notifyGeneratedName(). Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * refactor: fold the logging output buffer with the CodeMirror 6 helpers The YAML editor of @rancher/shell 3.0.14 is CodeMirror 6, and its CodeMirror 5 methods are deprecated. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * fix: keep the shell's table views off in standalone @rancher/shell 3.0.14 turns its table views on for every list in the standalone UI, as the server has no ui-configurable-tables feature and the default is on. The table views drop the filters the lists put in the table header, which also left the Images list empty. Add the feature, disabled, to the management store in standalone only. Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> * fix: reject zero-padded octets in IP ranges Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> --------- Signed-off-by: Marcelo Fukumoto <marcelo.fukumoto@suse.com> |