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

Integrate macvtap cni #346

Merged
merged 7 commits into from
Mar 17, 2020
Merged

Conversation

maiqueb
Copy link
Contributor

@maiqueb maiqueb commented Mar 12, 2020

Add macvtap CNI to the list of network addons installed by the CNAO operator.

It deploys and empty configuration, which currently doesn't expose any host interfaces.

Once kubevirt/macvtap-cni#11 is merged, it would start to expose all the host's interfaces.

Add macvtap-cni as a network addon.

@kubevirt-bot kubevirt-bot added dco-signoff: yes Indicates the PR's author has DCO signed all their commits. 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 Mar 12, 2020
@kubevirt-bot kubevirt-bot requested review from qinqon and RamLavi March 12, 2020 16:21
@kubevirt-bot kubevirt-bot added size/L release-note Denotes a PR that will be considered when it comes time to generate release notes. 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 Mar 12, 2020
@maiqueb
Copy link
Contributor Author

maiqueb commented Mar 12, 2020

/cc @phoracek

@kubevirt-bot kubevirt-bot requested a review from phoracek March 12, 2020 16:50
@maiqueb maiqueb force-pushed the integrate_macvtap_cni branch 2 times, most recently from 78637c8 to c7e51bd Compare March 13, 2020 13:47
@@ -55,7 +55,7 @@ type templateData struct {
OperatorVersion string
Namespace string
ContainerPrefix string
ImageName string
ImageName string
ContainerTag string
Copy link
Collaborator

Choose a reason for hiding this comment

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

Space

Copy link
Contributor Author

@maiqueb maiqueb Mar 13, 2020

Choose a reason for hiding this comment

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

go fmt is good w/ it ...

EDIT: my bad, commented on outdated code; please confirm it's OK now.

tools/manifest-templator/manifest-templator.go Outdated Show resolved Hide resolved
@maiqueb maiqueb force-pushed the integrate_macvtap_cni branch from c7e51bd to dd3517d Compare March 13, 2020 14:46
@maiqueb maiqueb requested a review from qinqon March 13, 2020 14:47
@maiqueb maiqueb force-pushed the integrate_macvtap_cni branch from dd3517d to 6fc524a Compare March 13, 2020 14:57
Copy link
Member

@phoracek phoracek left a comment

Choose a reason for hiding this comment

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

Please add a new section to the README. Explain how to make it expose some ifaces.

data/macvtap/001-rbac.yaml Outdated Show resolved Hide resolved
@@ -0,0 +1,63 @@
---
kind: ConfigMap
Copy link
Member

Choose a reason for hiding this comment

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

Please try to edit this CM deployed by CNAO. I have a bad feeling the settings would get reverted by the operator. e.g. deploy macvtap, edit the CM, additionally deploy ovs, see if the CM remained in the original state.

If the CM changes, we have two options:

  • Ask user to deploy it themselves
  • Add explicit setting to CNAO not to touch it

I feel the former is better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, after updating the value, the operator puts it back the way it was.

Remember that in kubevirt/macvtap-cni#11 the configmap is still required, and that the macvtap DS won't come up until the config map is available.

That would require us (at least in the tests) to create the config map by some other means (hacky move).

How can we add the explicit setting to CNAO to stay away from the config map ? What are the disadvantages of this option ?

Copy link
Member

Choose a reason for hiding this comment

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

Disadvantage is that we spoil the generic code with "if macvtap DP".

I was writing a guide on "how to hack it", but I think there is an elegant way too.

So this issue where we want to keep user changes on objects deployed is pretty common, although we were successful avoiding addressing it, until now.

So let's think how can we make it generic in the CNAO framework and keep everything specific to the component under data/ or pkg/network.

Option A: The simplest fit into the current API would be to introduce a Kubernetes object label networkaddonsoperator.network.kubevirt.io/untouchable: "true" (or any better name after /). That can be set by a user who wants to debug manual changes on any deployed component (e.g. they want to change resource requests, add debugging flags to running apps etc). It can be also set by default under data/ manifests. The only code we need to introduce then would live around https://github.com/kubevirt/cluster-network-addons-operator/blob/master/pkg/apply/apply.go#L37, where we check if an existing object we want to update has this flag, if it does, we ignore it. If you implement it, please do it in a separate PR (in case we need to backport it) and document it at the bottom of the README.

I am tempted to say "let's just keep it as it is and wait for the proper API", but that would make it harder to test under kubevirt and if somebody unaware uses it (despite it us "experimental", they may get hurt).

data/macvtap/002-macvtap-daemonset.yaml Show resolved Hide resolved
test/e2e/workflow/validation_test.go Outdated Show resolved Hide resolved
test/check/components.go Show resolved Hide resolved
pkg/network/macvtap.go Outdated Show resolved Hide resolved
pkg/network/macvtap.go Outdated Show resolved Hide resolved
Copy link
Contributor Author

@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.

Will push a new version w/out the RBAC.

@@ -0,0 +1,63 @@
---
kind: ConfigMap
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, after updating the value, the operator puts it back the way it was.

Remember that in kubevirt/macvtap-cni#11 the configmap is still required, and that the macvtap DS won't come up until the config map is available.

That would require us (at least in the tests) to create the config map by some other means (hacky move).

How can we add the explicit setting to CNAO to stay away from the config map ? What are the disadvantages of this option ?

data/macvtap/002-macvtap-daemonset.yaml Show resolved Hide resolved
pkg/network/macvtap.go Outdated Show resolved Hide resolved
pkg/network/macvtap.go Outdated Show resolved Hide resolved
test/check/components.go Show resolved Hide resolved
test/e2e/workflow/validation_test.go Outdated Show resolved Hide resolved
@@ -55,7 +55,7 @@ type templateData struct {
OperatorVersion string
Namespace string
ContainerPrefix string
ImageName string
ImageName string
ContainerTag string
Copy link
Contributor Author

@maiqueb maiqueb Mar 13, 2020

Choose a reason for hiding this comment

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

go fmt is good w/ it ...

EDIT: my bad, commented on outdated code; please confirm it's OK now.

data/macvtap/001-rbac.yaml Outdated Show resolved Hide resolved
@maiqueb maiqueb force-pushed the integrate_macvtap_cni branch from b2d5234 to e9b03d3 Compare March 13, 2020 16:49
@maiqueb maiqueb requested a review from phoracek March 13, 2020 16:50
@maiqueb maiqueb mentioned this pull request Mar 13, 2020
@maiqueb
Copy link
Contributor Author

maiqueb commented Mar 13, 2020

/retest

Macvtap-cni must be explicitly configured by the administrator, indicating the
interfaces on top of which logical networks can be created.

A simple example on how to do so, the user must deploy a `ConfigMap`, such as in [this example](https://github.com/kubevirt/macvtap-cni/blob/master/examples/macvtap-deviceplugin-config.yaml).
Copy link
Contributor Author

@maiqueb maiqueb Mar 13, 2020

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Currently we don't have any tests of functionality of operands. I really want to add at least basic sanity checks, but we need to setup test lane for it first. No need to add the test.

Macvtap-cni must be explicitly configured by the administrator, indicating the
interfaces on top of which logical networks can be created.

A simple example on how to do so, the user must deploy a `ConfigMap`, such as in [this example](https://github.com/kubevirt/macvtap-cni/blob/master/examples/macvtap-deviceplugin-config.yaml).
Copy link
Member

Choose a reason for hiding this comment

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

Currently we don't have any tests of functionality of operands. I really want to add at least basic sanity checks, but we need to setup test lane for it first. No need to add the test.

requests:
cpu: "60m"
memory: "30Mi"
limits:
Copy link
Member

Choose a reason for hiding this comment

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

Please drop limits. It causes obscure bugs on OpenShift. requests is enough

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.

@@ -0,0 +1,63 @@
---
kind: ConfigMap
Copy link
Member

Choose a reason for hiding this comment

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

Disadvantage is that we spoil the generic code with "if macvtap DP".

I was writing a guide on "how to hack it", but I think there is an elegant way too.

So this issue where we want to keep user changes on objects deployed is pretty common, although we were successful avoiding addressing it, until now.

So let's think how can we make it generic in the CNAO framework and keep everything specific to the component under data/ or pkg/network.

Option A: The simplest fit into the current API would be to introduce a Kubernetes object label networkaddonsoperator.network.kubevirt.io/untouchable: "true" (or any better name after /). That can be set by a user who wants to debug manual changes on any deployed component (e.g. they want to change resource requests, add debugging flags to running apps etc). It can be also set by default under data/ manifests. The only code we need to introduce then would live around https://github.com/kubevirt/cluster-network-addons-operator/blob/master/pkg/apply/apply.go#L37, where we check if an existing object we want to update has this flag, if it does, we ignore it. If you implement it, please do it in a separate PR (in case we need to backport it) and document it at the bottom of the README.

I am tempted to say "let's just keep it as it is and wait for the proper API", but that would make it harder to test under kubevirt and if somebody unaware uses it (despite it us "experimental", they may get hurt).

@maiqueb maiqueb force-pushed the integrate_macvtap_cni branch from 0e76c7a to e659087 Compare March 16, 2020 10:59
maiqueb added 3 commits March 16, 2020 12:05
Signed-off-by: Miguel Duarte Barroso <[email protected]>
Also deploy the default configuration of the macvtap feature.

Signed-off-by: Miguel Duarte Barroso <[email protected]>
maiqueb added 4 commits March 16, 2020 12:05
As a result, when you apply the generated CNAO manifest, it will
also deploy the macvtap-cni daemonsets and configuration.

Signed-off-by: Miguel Duarte Barroso <[email protected]>
Signed-off-by: Miguel Duarte Barroso <[email protected]>
Signed-off-by: Miguel Duarte Barroso <[email protected]>
Signed-off-by: Miguel Duarte Barroso <[email protected]>
@maiqueb maiqueb force-pushed the integrate_macvtap_cni branch from e659087 to 1322900 Compare March 16, 2020 11:05
Copy link
Contributor Author

@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.

Option A: The simplest fit into the current API would be to introduce a Kubernetes object label networkaddonsoperator.network.kubevirt.io/untouchable: "true" (or any better name after /). That can be set by a user who wants to debug manual changes on any deployed component (e.g. they want to change resource requests, add debugging flags to running apps etc). It can be also set by default under data/ manifests. The only code we need to introduce then would live around https://github.com/kubevirt/cluster-network-addons-operator/blob/master/pkg/apply/apply.go#L37, where we check if an existing object we want to update has this flag, if it does, we ignore it. If you implement it, please do it in a separate PR (in case we need to backport it) and document it at the bottom of the README.

I am tempted to say "let's just keep it as it is and wait for the proper API", but that would make it harder to test under kubevirt and if somebody unaware uses it (despite it us "experimental", they may get hurt).

Whatever the choice, it'll happen on a follow up set of patches.

I'm quite OK with adding that label.

requests:
cpu: "60m"
memory: "30Mi"
limits:
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.

@maiqueb maiqueb requested a review from phoracek March 16, 2020 14:16
Copy link
Member

@phoracek phoracek left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label Mar 17, 2020
@kubevirt-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: phoracek

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 Mar 17, 2020
@kubevirt-bot kubevirt-bot merged commit 2232143 into kubevirt:master Mar 17, 2020
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 Denotes a PR that will be considered when it comes time to generate release notes. size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants