Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nad: Skip NADs with empty config #90

Merged
merged 1 commit into from
Feb 6, 2025

Conversation

oshoval
Copy link
Collaborator

@oshoval oshoval commented Feb 4, 2025

What this PR does / why we need it:
Until now, a NAD with empty config, was considered invalid,
causing an error / rejecting it on the webhook.
Istio creates such NADs, so we can't consider them as fatal,
once we list all the NADs in a namespace.
Otherwise the webhook will block VM creation [1] in case it uses
such NAD.

Therefore just ignore those.

[1] virtualmachine-controller    Error creating pod: admission webhook "ipam-claims.k8s.cni.cncf.io" denied the request: failed to extract CNI configuration from NAD: unexpected end of JSON input

Example of resource that create such NAD:

apiVersion: maistra.io/v1
kind: ServiceMeshMemberRoll
metadata:
  name: default
  namespace: istio-system
spec:
  members:
  - non-udn-ns

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Special notes for your reviewer:

Release note:

None

@kubevirt-bot kubevirt-bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. labels Feb 4, 2025
@oshoval oshoval changed the title WIP nad: Skip NADs with empty config Feb 5, 2025
@oshoval
Copy link
Collaborator Author

oshoval commented Feb 5, 2025

Hi @maiqueb
I can just change NewConfig but it will ignore empty NADs even on NADs that were supposed to belong to OVN-K
(unless for example we filter by istio label, but since this label might get changed and due to the relative complexity for just this purpose, i don't think this is good idea)
Would you prefer the current solution or just to change NewConfig ?
Once we converge i can add UT, thanks

@maiqueb
Copy link
Collaborator

maiqueb commented Feb 5, 2025

Hi @maiqueb I can just change NewConfig but it will ignore empty NADs even on NADs that were supposed to belong to OVN-K (unless for example we filter by istio label, but since this label might get changed and due to the relative complexity for just this purpose, i don't think this is good idea) Would you prefer the current solution or just to change NewConfig ? Once we converge i can add UT, thanks

@oshoval how can an empty NAD belong to OVN-K ?

For a NAD to be associated w/ a plugin, it must feature the name of the plugin in their type. If it's empty, it can't belong to it. Hence, nothing to do.

Copy link
Collaborator

@maiqueb maiqueb left a comment

Choose a reason for hiding this comment

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

Can you coalesce this check to a single place ?

@oshoval
Copy link
Collaborator Author

oshoval commented Feb 5, 2025

@oshoval how can an empty NAD belong to OVN-K ?

of course it shouldn't, i mean just because of a bug (which was the original reason we added it in the first place)
anyhow will consolidate

Until now, a NAD with empty config, was considered invalid,
causing an error / rejecting it on the webhook.
Istio creates such NADs, so we can't consider them as fatal,
once we list all the NADs in a namespace.
Otherwise the webhook will block VM creation in case it uses
such NAD.

Therefore just ignore those.

Signed-off-by: Or Shoval <[email protected]>
@oshoval
Copy link
Collaborator Author

oshoval commented Feb 5, 2025

Consolidated (an empty config is robust in the current callers, they will just "continue", each on its own way)
I don't think it deserve UT, and also there isn't UT for the current function atm

@oshoval oshoval marked this pull request as ready for review February 5, 2025 12:24
@kubevirt-bot kubevirt-bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 5, 2025
@kubevirt-bot kubevirt-bot requested a review from maiqueb February 5, 2025 12:24
Copy link
Collaborator

@maiqueb maiqueb left a comment

Choose a reason for hiding this comment

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

/lgtm

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Feb 6, 2025
@maiqueb
Copy link
Collaborator

maiqueb commented Feb 6, 2025

/lgtm

/approve

@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: maiqueb

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubevirt-bot kubevirt-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 6, 2025
@kubevirt-bot kubevirt-bot merged commit a1ee313 into kubevirt:main Feb 6, 2025
4 checks passed
@oshoval
Copy link
Collaborator Author

oshoval commented Feb 6, 2025

I will just issue a release and we make sure it works with it, as it shouldn't be risky

@oshoval
Copy link
Collaborator Author

oshoval commented Feb 6, 2025

btw note please that sometimes doing double tag on the same hash cause mistakes on CNAO
(some of them were solved, some not sure yet)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lgtm Indicates that a PR is ready to be merged. size/XS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants