Skip to content

allow deletion of overlay nads even if kubeovn is disabled#251

Merged
Vicente-Cheng merged 2 commits intoharvester:masterfrom
rrajendran17:overlay-nad
Mar 26, 2026
Merged

allow deletion of overlay nads even if kubeovn is disabled#251
Vicente-Cheng merged 2 commits intoharvester:masterfrom
rrajendran17:overlay-nad

Conversation

@rrajendran17
Copy link
Copy Markdown
Contributor

@rrajendran17 rrajendran17 commented Mar 24, 2026

Problem:
currently overlay nads can be created but cannot be deleted when kubeovn add-on is disabled.

Solution:
do not allow overlay nad creation when kubeovn is disabled and allow deletion of overlay nads even if kubeovn is disabled.

Related Issue:
harvester/harvester#10273

Test plan:
case 1:
1.Install Harvester v1.8.0
2.Kubeovn addon is not enabled.
3.Create VM Network with type overlay
4.webhook must return error

case 2:
1.Install Harvester v1.8.0
2.Kubeovn addon is enabled.
3.Create VM Network with type overlay
4.Create subnets, VMs
5.Delete VMs,subnets, disable kubeovn addon
6.Delete VM Network with type overlay
7.Deletion of overlay VM Network must be successful

Copilot AI review requested due to automatic review settings March 24, 2026 06:35
Signed-off-by: Renuka Devi Rajendran <renuka.rajendran@suse.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the NAD admission webhook to prevent creating overlay (Kube-OVN) NetworkAttachmentDefinitions when the Kube-OVN addon/Subnet CRD is not enabled, and adjusts delete behavior for overlay NADs.

Changes:

  • Add a create-time guard that blocks creating Kube-OVN NADs when subnetEnabled is false.
  • Modify overlay NAD delete-path error handling (currently still blocks deletion when subnetEnabled is false).
  • Add unit tests covering create/delete behavior when subnetEnabled is false.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
pkg/webhook/nad/validator.go Adds a create-time check for Kube-OVN NADs and changes delete-path behavior/errors.
pkg/webhook/nad/validator_test.go Adds new tests for overlay NAD create/delete when Subnet CRD (kubeovn) is not enabled.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@rrajendran17 rrajendran17 changed the title allow creation of overlay nads only if kubeovn is enabled allow deletion of overlay nads even if kubeovn is disabled Mar 24, 2026
@rrajendran17 rrajendran17 requested a review from a team March 24, 2026 06:43
Copy link
Copy Markdown
Member

@w13915984028 w13915984028 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One open question, thanks.

}

//allow overlay nad creation only if subnet crd/kubeovn is enabled
if conf.IsKubeOVNCNI() {
Copy link
Copy Markdown
Member

@w13915984028 w13915984028 Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check !v.subnetEnabled to allow deletion is fine.

for create case, need to double check if this will affect those automatic tests:

if nad is created but the related vendor is not ready, normally the vm's backend pod will not be created successful as kubelet does not get response from cni driver

we need to do a test:

create overlay-nad & VM before OVN is enabled; or nad is leftover when ovn is disabled (e.g. the upgrade case or on old version without this check): will the VM just stuck on starting;

then enable OVN, could the VM turn to normal running status.

cc @irishgordo @TachunLin @khushboo-rancher to check if some test scripts could be affected, thanks.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah that is a good case.Though we cannot create VMs in custom subnets when ovn is disabled, but if we create an overlay network when ovn is disabled and attach a vm to overlay interface, it will be stuck but once the ovn is enabled, the VM will be able to get ip address from default subnet ovn-default and will move to running state.
With this observation, I think we should allow creation of overlay networks even if ovn is disabled. WDYT ?

Copy link
Copy Markdown
Contributor

@Vicente-Cheng Vicente-Cheng Mar 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @rrajendran17, @w13915984028,

Since I would like to have this on today's RC3, I will merge this PR first.
Could you create another issue to track the above case?
Thanks!

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can have a follow-up issue to track this (for whatever we should allow users to pre-create overlay networks and their VMs, or the test plan adaptation).

@w13915984028 w13915984028 requested a review from a team March 25, 2026 10:34
Copy link
Copy Markdown
Member

@starbops starbops left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you.

@Vicente-Cheng Vicente-Cheng merged commit 75b1593 into harvester:master Mar 26, 2026
5 checks passed
@Vicente-Cheng
Copy link
Copy Markdown
Contributor

@Mergifyio backport v1.8

@mergify
Copy link
Copy Markdown

mergify bot commented Mar 26, 2026

backport v1.8

✅ Backports have been created

Details

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.

6 participants