Files
harvester-ui-extension/pkg/harvester/models
Marcelo Fukumoto 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>
2026-11-19 21:05:20 +01:00
..
2024-10-23 17:00:47 +02:00
2024-11-12 11:50:20 +01:00
2024-10-23 17:00:47 +02:00