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

Register user-defined-network (UDN) binding on kubevirt CR #3034

Merged
merged 5 commits into from
Aug 12, 2024

Conversation

RamLavi
Copy link
Contributor

@RamLavi RamLavi commented Jul 31, 2024

What this PR does / why we need it:
This PR adds support to user-defined-network binding to the kubevirt CR.
This is part of the process described on kubevirt user guide.
The behavior added is currently dev-preview, and as such is protected behind a FG: PrimaryUserDefinedNetworkBinding, that is set to false by default.

Reviewer Checklist

Reviewers are supposed to review the PR for every aspect below one by one. To check an item means the PR is either "OK" or "Not Applicable" in terms of that item. All items are supposed to be checked before merging a PR.

  • PR Message
  • Commit Messages
  • How to test
  • Unit Tests
  • Functional Tests
  • User Documentation
  • Developer Documentation
  • Upgrade Scenario
  • Uninstallation Scenario
  • Backward Compatibility
  • Troubleshooting Friendly

Jira Ticket:


Release note:

NONE

@kubevirt-bot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

1 similar comment
Copy link

openshift-ci bot commented Jul 31, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@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 Jul 31, 2024
@kubevirt-bot kubevirt-bot added do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. size/L labels Jul 31, 2024
Copy link
Collaborator

@nunnatsa nunnatsa left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. Added some inline comments.

My main comment is about modifying the HC CR in kubevirt.go. We need to avoid that.

also, some TODOs, yes, I know it's WIP...

  1. please update docs/cluster-configuration.md
  2. please update the "feature gate defaults" test in tests/func-tests/defaults_test.go

const (
// Needs to align with the NAD that will be deployed by CNAO
primaryUDNNetworkBindingName = "primaryUserDefinedNetwork"
primaryUDNNetworkBindingNamespace = "default"
Copy link
Collaborator

Choose a reason for hiding this comment

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

why in the default ns?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In order for the NetworkAttachmentDefinition to be available to all VMs on all namespaces, it needs to be deployed on default namespace.
For the dev-preview we think this is a good enough approach, but IMO in the future we will need to think of other ways.

Also note that HCO I changed the PR since when we talked and not it is not not deploying the NetworkAttachmentDefinition (will happen on CNAO)

Comment on lines 432 to 441
if hc.Spec.NetworkBinding == nil {
hc.Spec.NetworkBinding = make(map[string]kubevirtcorev1.InterfaceBindingPlugin)
}

var sidecarImage string
var ok bool
if sidecarImage, ok = os.LookupEnv(hcoutil.PrimaryUDNImageEnvV); !ok {
return nil, errors.New("failed to get primary UDN image env Var")
}
hc.Spec.NetworkBinding[primaryUDNNetworkBindingName] = primaryUserDefinedNetworkBinding(sidecarImage)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we need to modify the HyperConverged CR? we'll need really good reason for that. the spec is for the user.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can't directly change the kubevirt CR. If we do, HCO will reconcile back to what's on hc.Spec.NetworkBinding..

Copy link
Collaborator

Choose a reason for hiding this comment

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

HCO currently just copies the NetworkBinding map to KV. I think we can change this code with the new logic.

e.g., instead of

		NetworkConfiguration: &kubevirtcorev1.NetworkConfiguration{
			NetworkInterface: string(kubevirtcorev1.MasqueradeInterface),
			Binding:          hc.Spec.NetworkBinding,
		},

do something like

		NetworkConfiguration: &kubevirtcorev1.NetworkConfiguration{
			NetworkInterface: string(kubevirtcorev1.MasqueradeInterface),
			Binding:          getNetworkBinding(hc),
		},

Copy link
Collaborator

Choose a reason for hiding this comment

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

and the new logic will get into the new function getNetworkBinding

Copy link
Contributor Author

Choose a reason for hiding this comment

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

DONE

@@ -34,3 +34,4 @@ KUBEVIRT_CONSOLE_PROXY_IMAGE,quay.io/kubevirt-ui/kubevirt-apiserver-proxy,KUBEVI
AAQ_OPERATOR_IMAGE,quay.io/kubevirt/aaq-operator,AAQ_VERSION,002513b78dfd795f5195534b651eace136ead3d73c8ac8cae145607e79c8a8ba
AAQ_SERVER_IMAGE,quay.io/kubevirt/aaq-server,AAQ_VERSION,9db6ca9147b1d75ba4d6bb1326c4ec289327eb9f8aadbcd951fcc689e584cd0d
AAQ_CONTROLLER_IMAGE,quay.io/kubevirt/aaq-controller,AAQ_VERSION,170abd7a75397ddce07ba0d64886ead25183c49cacbccf0d191a4dd37ca013fd
PRIMARY_USER_DEFINED_NETWORK_BINDING_IMAGE,quay.io/kubevirt/network-passt-binding,KUBEVIRT_VERSION,3fb5f9fb87a9ab1f06bed2b2358ad862ef66bc47dc73044f1076a3eb9a4c55ff
Copy link
Collaborator

Choose a reason for hiding this comment

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

please move it up, to be grouped with all the lines that use the KUBEVIRT_VERSION variable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

DONE

@@ -325,7 +326,8 @@ ${PROJECT_ROOT}/tools/manifest-templator/manifest-templator \
--aaq-version="${AAQ_VERSION}" \
--operator-image="${HCO_OPERATOR_IMAGE}" \
--webhook-image="${HCO_WEBHOOK_IMAGE}" \
--cli-downloads-image="${HCO_DOWNLOADS_IMAGE}"
--cli-downloads-image="${HCO_DOWNLOADS_IMAGE}" \
--primary-udn-image="${}"
Copy link
Collaborator

Choose a reason for hiding this comment

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

you need use the PRIMARY_USER_DEFINED_NETWORK_BINDING_IMAGE var here

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also, the parameter name is wrong: should be primary-udn-binding-image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

oh damn, I though I got everything.
Thanks for the catch!

api/v1beta1/hyperconverged_types.go Show resolved Hide resolved
@kubevirt-bot kubevirt-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 31, 2024
@RamLavi RamLavi force-pushed the register_udn branch 2 times, most recently from 7e5a784 to a34a83a Compare July 31, 2024 18:28
@RamLavi RamLavi changed the title [WIP] Register user-defined-network (UDN) binding on kubevirt CR Register user-defined-network (UDN) binding on kubevirt CR Jul 31, 2024
@kubevirt-bot kubevirt-bot added release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Jul 31, 2024
@RamLavi
Copy link
Contributor Author

RamLavi commented Jul 31, 2024

Change: Added unit tests.

@RamLavi
Copy link
Contributor Author

RamLavi commented Aug 1, 2024

Change: Added kubebuilder default labels on HCO CR tree, Added documentation for new FG

@kubevirt-bot kubevirt-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 1, 2024
@RamLavi
Copy link
Contributor Author

RamLavi commented Aug 1, 2024

Change: auto-generating manifests, rebase

@RamLavi RamLavi marked this pull request as ready for review August 1, 2024 07:56
@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 Aug 1, 2024
@kubevirt-bot kubevirt-bot requested a review from sradco August 1, 2024 07:56
},
ComputeResourceOverhead: &corev1.ResourceRequirements{
Requests: corev1.ResourceList{
corev1.ResourceMemory: resource.MustParse("500Mi"),
Copy link
Collaborator

Choose a reason for hiding this comment

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

This magic number of 500Mi is not clear. Can we use a constant with meaningful name, that will self explain it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

DONE.

var sidecarImage string
var ok bool
if sidecarImage, ok = os.LookupEnv(hcoutil.PrimaryUDNImageEnvV); !ok {
return nil, errors.New("failed to get primary UDN image env Var")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure about this error. This is not something the user can fix. Maybe it will better to check it on boot time and exit, to fail the pod? @tiraboschi WDYT?

Copy link
Member

Choose a reason for hiding this comment

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

I agree: this is something we are configuring at the bundle build time as part of the opinionated deployment and it's not something the user can or should try to fix.

### primaryUserDefinedNetworkBinding Feature Gate
Set the `primaryUserDefinedNetworkBinding` feature gate to deploy the needed configurations for kubevirt users, so they
can bind their VM to a user-defined network (UDN) on the VM's primary interface.

Copy link
Collaborator

Choose a reason for hiding this comment

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

do we have some kind of documentation we can add as a reference? I'm afraid this description is a bit crypt.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@maiqueb do we?

Copy link
Contributor

Choose a reason for hiding this comment

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

what documentation are you hoping for @nunnatsa ?

I'm afraid all we have is the openshift enhancement document.

Copy link
Contributor

@oshoval oshoval Aug 1, 2024

Choose a reason for hiding this comment

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

maybe worth to add the env var that can be set in order to determine non default value
(this what we are doing for example on CNAO readme)
together with the current info, it can give a simple user guide (please consider adding few words that will make it user guide in case it miss)

also good to have please on PR desc the important details, such as the feature gate name and so on

Copy link
Contributor Author

@RamLavi RamLavi Aug 4, 2024

Choose a reason for hiding this comment

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

@oshoval

maybe worth to add the env var that can be set in order to determine non default value (this what we are doing for example on CNAO readme) together with the current info, it can give a simple user guide (please consider adding few words that will make it user guide in case it miss)

Not sure what you mean here. what env var? This FG is set by HCO CR, and is set to false by default.. In order to activate it, no env var is required - only changing the FG value to true.

also good to have please on PR desc the important details, such as the feature gate name and so on

DONE

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm afraid all we have is the openshift enhancement document.

@nunnatsa will that be sufficient?

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure what you mean here. what env var? This FG is set by HCO CR, and is set to false by default.. In order to activate it, no env var is required - only changing the FG value to true.

I meant the one that allows to override the image, but no biggie

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah.. that's not something a user should be exposed to imo.

@RamLavi
Copy link
Contributor Author

RamLavi commented Aug 1, 2024

Change: Add meaningful name const.

@hco-bot
Copy link
Collaborator

hco-bot commented Aug 12, 2024

hco-e2e-upgrade-prev-operator-sdk-aws lane succeeded.
/override ci/prow/hco-e2e-upgrade-prev-operator-sdk-azure
hco-e2e-consecutive-operator-sdk-upgrades-aws lane succeeded.
/override ci/prow/hco-e2e-consecutive-operator-sdk-upgrades-azure
hco-e2e-upgrade-operator-sdk-sno-aws lane succeeded.
/override ci/prow/hco-e2e-upgrade-operator-sdk-sno-azure

@kubevirt-bot
Copy link
Contributor

@hco-bot: Overrode contexts on behalf of hco-bot: ci/prow/hco-e2e-consecutive-operator-sdk-upgrades-azure, ci/prow/hco-e2e-upgrade-operator-sdk-sno-azure, ci/prow/hco-e2e-upgrade-prev-operator-sdk-azure

In response to this:

hco-e2e-upgrade-prev-operator-sdk-aws lane succeeded.
/override ci/prow/hco-e2e-upgrade-prev-operator-sdk-azure
hco-e2e-consecutive-operator-sdk-upgrades-aws lane succeeded.
/override ci/prow/hco-e2e-consecutive-operator-sdk-upgrades-azure
hco-e2e-upgrade-operator-sdk-sno-aws lane succeeded.
/override ci/prow/hco-e2e-upgrade-operator-sdk-sno-azure

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Copy link
Collaborator

@nunnatsa nunnatsa left a comment

Choose a reason for hiding this comment

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

/approve

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Aug 12, 2024
@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nunnatsa

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 Aug 12, 2024
@nunnatsa
Copy link
Collaborator

/retest

Copy link

openshift-ci bot commented Aug 12, 2024

@RamLavi: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/hco-e2e-upgrade-operator-sdk-sno-azure 508d61b link false /test hco-e2e-upgrade-operator-sdk-sno-azure
ci/prow/hco-e2e-consecutive-operator-sdk-upgrades-azure 508d61b link true /test hco-e2e-consecutive-operator-sdk-upgrades-azure
ci/prow/hco-e2e-upgrade-prev-operator-sdk-azure 508d61b link true /test hco-e2e-upgrade-prev-operator-sdk-azure
ci/prow/hco-e2e-upgrade-prev-operator-sdk-sno-aws 508d61b link false /test hco-e2e-upgrade-prev-operator-sdk-sno-aws

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@hco-bot
Copy link
Collaborator

hco-bot commented Aug 12, 2024

hco-e2e-upgrade-prev-operator-sdk-sno-azure lane succeeded.
/override ci/prow/hco-e2e-upgrade-prev-operator-sdk-sno-aws

@kubevirt-bot
Copy link
Contributor

@hco-bot: Overrode contexts on behalf of hco-bot: ci/prow/hco-e2e-upgrade-prev-operator-sdk-sno-aws

In response to this:

hco-e2e-upgrade-prev-operator-sdk-sno-azure lane succeeded.
/override ci/prow/hco-e2e-upgrade-prev-operator-sdk-sno-aws

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@kubevirt-bot kubevirt-bot merged commit fc1c591 into kubevirt:main Aug 12, 2024
31 checks passed
maiqueb added a commit to maiqueb/openshift-release that referenced this pull request Oct 11, 2024
This HCO feature gate was introduced in [0].

[0] - kubevirt/hyperconverged-cluster-operator#3034

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
maiqueb added a commit to maiqueb/openshift-release that referenced this pull request Oct 14, 2024
This HCO feature gate was introduced in [0].

[0] - kubevirt/hyperconverged-cluster-operator#3034

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
maiqueb added a commit to maiqueb/openshift-release that referenced this pull request Oct 14, 2024
This HCO feature gate was introduced in [0].

[0] - kubevirt/hyperconverged-cluster-operator#3034

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
maiqueb added a commit to maiqueb/openshift-release that referenced this pull request Oct 14, 2024
This HCO feature gate was introduced in [0].

[0] - kubevirt/hyperconverged-cluster-operator#3034

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
maiqueb added a commit to maiqueb/openshift-release that referenced this pull request Oct 14, 2024
This HCO feature gate was introduced in [0].

[0] - kubevirt/hyperconverged-cluster-operator#3034

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
maiqueb added a commit to maiqueb/openshift-release that referenced this pull request Oct 14, 2024
This HCO feature gate was introduced in [0].

[0] - kubevirt/hyperconverged-cluster-operator#3034

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
maiqueb added a commit to maiqueb/openshift-release that referenced this pull request Oct 14, 2024
This HCO feature gate was introduced in [0].

[0] - kubevirt/hyperconverged-cluster-operator#3034

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
maiqueb added a commit to maiqueb/openshift-release that referenced this pull request Oct 15, 2024
This HCO feature gate was introduced in [0].

[0] - kubevirt/hyperconverged-cluster-operator#3034

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
maiqueb added a commit to maiqueb/openshift-release that referenced this pull request Oct 15, 2024
This HCO feature gate was introduced in [0].

[0] - kubevirt/hyperconverged-cluster-operator#3034

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
maiqueb added a commit to maiqueb/openshift-release that referenced this pull request Oct 15, 2024
This HCO feature gate was introduced in [0].

[0] - kubevirt/hyperconverged-cluster-operator#3034

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
maiqueb added a commit to maiqueb/openshift-release that referenced this pull request Oct 15, 2024
This HCO feature gate was introduced in [0].

[0] - kubevirt/hyperconverged-cluster-operator#3034

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
maiqueb added a commit to maiqueb/openshift-release that referenced this pull request Oct 15, 2024
This HCO feature gate was introduced in [0].

[0] - kubevirt/hyperconverged-cluster-operator#3034

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
maiqueb added a commit to maiqueb/openshift-release that referenced this pull request Oct 15, 2024
This HCO feature gate was introduced in [0]; it also requires the
KubeVirt IPAM controller component to persist the IP addresses between
VM migrations, and restarts.

[0] - kubevirt/hyperconverged-cluster-operator#3034

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
maiqueb added a commit to maiqueb/openshift-release that referenced this pull request Oct 15, 2024
This HCO feature gate was introduced in [0]; it also requires the
KubeVirt IPAM controller component to persist the IP addresses between
VM migrations, and restarts.

[0] - kubevirt/hyperconverged-cluster-operator#3034

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
maiqueb added a commit to maiqueb/openshift-release that referenced this pull request Oct 15, 2024
This HCO feature gate was introduced in [0]; it also requires the
KubeVirt IPAM controller component to persist the IP addresses between
VM migrations, and restarts.

[0] - kubevirt/hyperconverged-cluster-operator#3034

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
qinqon pushed a commit to qinqon/release that referenced this pull request Oct 17, 2024
This HCO feature gate was introduced in [0]; it also requires the
KubeVirt IPAM controller component to persist the IP addresses between
VM migrations, and restarts.

[0] - kubevirt/hyperconverged-cluster-operator#3034

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
openshift-merge-bot bot pushed a commit to openshift/release that referenced this pull request Oct 18, 2024
…ubmits (#57704)

* ovn-kubernetes, virt: add new AWS virt lane to run OVN presubmits

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>

* udn, virt: enable primary UDN binding

This HCO feature gate was introduced in [0]; it also requires the
KubeVirt IPAM controller component to persist the IP addresses between
VM migrations, and restarts.

[0] - kubevirt/hyperconverged-cluster-operator#3034

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>

* udn, virt, tests: run only virt-aware tests

A future PR will add tests for this feature gate and feature in
openshift/origin project.

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>

* ovn-kubernetes, virt: add new AWS virt lane to run OVN 4.18/4.19 presubmits

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>

---------

Signed-off-by: Miguel Duarte Barroso <mdbarroso@redhat.com>
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. release-note-none Denotes a PR that doesn't merit a release note. size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants