feat(kubeovn): add OVN EIP/FIP/SNAT/DNAT, VIP, VPC DNS, Switch LB Rule (Phase 4)#180
Open
jniedergang wants to merge 11 commits intoharvester:masterfrom
Open
feat(kubeovn): add OVN EIP/FIP/SNAT/DNAT, VIP, VPC DNS, Switch LB Rule (Phase 4)#180jniedergang wants to merge 11 commits intoharvester:masterfrom
jniedergang wants to merge 11 commits intoharvester:masterfrom
Conversation
|
This pull request is now in conflict. Could you fix it @jniedergang? 🙏 |
added 9 commits
March 6, 2026 17:33
Add Terraform resource and data source for managing Harvester addons (pcidevices-controller, nvidia-driver-toolkit, vm-import-controller, harvester-seeder). Addons are pre-existing in Harvester and cannot be created or deleted via the API - Create enables/configures the addon, Delete disables it. Schema fields: - enabled (bool): enable/disable the addon - values_content (string): Helm values YAML configuration - repo, chart, version (computed): read-only addon metadata - state (computed): addon deployment status Includes unit tests for the importer with coverage for enabled, disabled, and nil labels/annotations cases. Signed-off-by: Terraform Provider Developer <terraform@harvester.local>
Add Phase 1 core networking support for KubeOVN SDN addon: - Add kube-ovn v1.13.0 typed client to pkg/client - harvester_kubeovn_vpc: resource + datasource for OVN virtual private clouds with static routes, policy routes, namespace binding - harvester_kubeovn_subnet: resource + datasource for OVN subnets with CIDR, gateway, DHCP, NAT, LB, private/allow controls - harvester_kubeovn_ip: datasource for reading pod IP assignments - Unit tests for all three importers - Terraform examples for all resources and datasources All resources are cluster-scoped (NonNamespacedSchemaWrap) matching KubeOVN CRD definitions. Requires kubeovn-operator addon to be enabled. Signed-off-by: Terraform Provider Developer <terraform@harvester.local>
- Rename subnet `provider` field to `network_provider` to avoid Terraform reserved field name conflict - Make VPC static_routes `policy` field Computed (KubeOVN server sets default `policyDst`), add `policyDst` to validation - Add retry loop to VPC delete to handle subnet cleanup race condition (KubeOVN webhook rejects VPC deletion while subnets still exist) Tested on Harvester v1.6.1 with KubeOVN v1.13.13: - Create VPC + Subnet: OK - Idempotence (0 changes): OK - Update in-place: OK - Destroy (subnet before VPC): OK - Datasources read: OK Signed-off-by: Terraform Provider Developer <terraform@harvester.local>
Add 5 KubeOVN NAT Gateway resources for external connectivity from VPCs: - harvester_kubeovn_vpc_nat_gateway: VPC NAT Gateway with delete retry - harvester_kubeovn_iptables_eip: Elastic IP with ForceNew on nat_gw_dp - harvester_kubeovn_iptables_snat_rule: Source NAT rule - harvester_kubeovn_iptables_dnat_rule: Destination NAT rule with protocol - harvester_kubeovn_iptables_fip_rule: Floating IP rule Each resource includes: schema, constructor, CRUD, datasource, importer with unit tests, and TF examples. All cluster-scoped via NonNamespacedSchemaWrap. Status fields prefixed with status_ to avoid collisions with spec fields. Signed-off-by: Terraform Provider Developer <terraform@harvester.local>
Run `go generate` to produce tfplugindocs for the 5 new NAT resources and their data sources. Signed-off-by: Terraform Provider Developer <terraform@harvester.local>
…SecurityGroup, QoSPolicy) Add 5 new KubeOVN resources with full CRUD, datasources, importers, unit tests, examples, and generated docs: - harvester_kubeovn_ippool: IP address pool management with namespace scoping and IPv4/IPv6 availability status - harvester_kubeovn_vlan: VLAN management with provider network binding and retry-on-delete for dependent resources - harvester_kubeovn_provider_network: Physical network interface mapping with custom per-node interfaces and node exclusion - harvester_kubeovn_security_group: Network security rules with ingress/ egress rule blocks supporting address and security group remote types - harvester_kubeovn_qos_policy: Quality of Service policies with bandwidth limit rules for EIP and NAT Gateway bindings All resources are cluster-scoped and use the existing KubeOVN v1.13.0 typed client. No dependency changes required. Signed-off-by: Terraform Provider Developer <terraform@harvester.local>
KubeOVN v1.14 webhook rejects Vlan creation without spec.provider. Update schema from Optional to Required and constructor accordingly. Signed-off-by: Terraform Provider Developer <terraform@harvester.local>
…s (Phase 4) Add 7 new KubeOVN resources for OVN-level networking: - harvester_kubeovn_ovn_eip: OVN Elastic IP - harvester_kubeovn_ovn_fip: OVN Floating IP - harvester_kubeovn_ovn_snat_rule: OVN SNAT Rule - harvester_kubeovn_ovn_dnat_rule: OVN DNAT Rule - harvester_kubeovn_vip: Virtual IP - harvester_kubeovn_vpc_dns: VPC DNS - harvester_kubeovn_switch_lb_rule: Switch LB Rule Each resource includes schema, constructor, CRUD operations, datasource, importer with unit tests, examples, and generated documentation. Signed-off-by: Terraform Provider Developer <terraform@harvester.local>
KubeOVN controller adds labels with the ovn.kubernetes.io/ prefix (e.g. ip_reserved, subnet) to VIP resources. These controller-managed labels caused idempotence drift on subsequent plan/apply cycles. Filter them in GetLabels alongside existing harvesterhci.io/ filters. Signed-off-by: Terraform Provider Developer <terraform@harvester.local>
f461b14 to
c956a43
Compare
Extract assertStringSlice helper to reduce cyclomatic complexity flagged by CodeFactor. Signed-off-by: Terraform Provider Developer <terraform@harvester.local>
6 tasks
…m SDK conflict Signed-off-by: Terraform Provider Developer <terraform@harvester.local>
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
Adds 7 new KubeOVN resources and data sources for OVN-level networking:
harvester_kubeovn_ovn_eip— OVN Elastic IP from external subnetharvester_kubeovn_ovn_fip— OVN Floating IP (1:1 NAT)harvester_kubeovn_ovn_snat_rule— OVN Source NATharvester_kubeovn_ovn_dnat_rule— OVN Destination NAT with port mappingharvester_kubeovn_vip— Virtual IP for load balancer/HAharvester_kubeovn_vpc_dns— VPC-scoped DNS resolutionharvester_kubeovn_switch_lb_rule— OVN switch-level load balancer rulesRef: harvester/harvester#10148
Depends on: #176 (Phase 1), #178 (Phase 2), #179 (Phase 3)
Also filters
ovn.kubernetes.io/controller-managed labels inGetLabels()to prevent drift.Related Issue
harvester/harvester#10148
Test plan
go test ./pkg/importer/ -run "TestResourceKubeOVN(OvnEip|OvnFip|OvnSnatRule|OvnDnatRule|Vip|VpcDns|SwitchLBRule)")go build ./...— compilation passesgofmt -l .— no formatting issuesterraform planshows 0 changesterraform destroy— clean teardown (external subnet delete may need retry if EIP IPs still releasing)typefield renamed toeip_type(Terraform SDK conflict); Harvester webhook requiresname.namespace.ovnformat for subnetprovider