-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Add tap plugin test #27737
Add tap plugin test #27737
Conversation
a64c5bf
to
f1a8bc9
Compare
Hi @mlguerrero12. Thanks for your PR. I'm waiting for a openshift member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. 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/test-infra repository. |
test/extended/networking/tap.go
Outdated
ns, | ||
nadName, | ||
fmt.Sprintf(`{"cniVersion":"0.4.0","name":"%s","type": "tap", | ||
"selinuxcontext": "system_u:system_r:container_t:s0", "ipam": {}}`, nadName), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe make a variable out of the config,move to line 25, and format it for better readability?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
f1a8bc9
to
d83eb5d
Compare
lgtm |
/lgtm |
/ok-to-test |
d83eb5d
to
95f7e41
Compare
67c2551
to
12114da
Compare
test/extended/networking/tap.go
Outdated
}) | ||
|
||
g.AfterEach(func() { | ||
// Disable container_use_devices selinux boolean. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In BeforeEach, the tun module is loaded (if not already) but here it is not unloaded. Should it be?
I guess it depends if something else on the system is using it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not loaded. The test always fails without it. I didn't unload it because it always complains that the module is in use even after removing the tap interface. So, I figured it is safe to leave it there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should not be that hard to implement.
The BeforEach DS should mount a dir on the node, and note whether the bool has been set:
sh -c 'getsebool container_use_devices > /host/tmp/initial_state
and the AfterEach DS would then revert the value only if the content of this file is 0.
test/extended/networking/tap.go
Outdated
g.AfterEach(func() { | ||
// Disable container_use_devices selinux boolean. | ||
_, err := exutil.ExecCommandOnMachineConfigDaemon(f.ClientSet, oc, worker, []string{ | ||
"sh", "-c", "nsenter --mount=/proc/1/ns/mnt -- sh -c 'setsebool container_use_devices 0'", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This SELinux boolean may have been already set as a dependency of some service/app on the host. Blindly disabling it might have unintended consequences. Perhaps check if it's already set (in BeforeEach) and only disable it (in AfterEach) if it was not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test always fails without it. I know that it is a good practice to do what you're suggesting but I wonder if it is worth doing it in this case. No other tests modify selinux booleans.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a strong opinion here so either way is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will it be wrong to leave it on just to see if it collides with other services/apps? This way, we would be able to detect what cannot be run together with the tap plugin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a good point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, let's see what we get
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cgoncalves, I decided to follow your suggestion. Please review again.
/lgtm |
12114da
to
e37ba3f
Compare
/retest |
Test for the following PR: containernetworking/plugins#832 Signed-off-by: Marcelo Guerrero Viveros <marguerr@redhat.com>
e37ba3f
to
b461281
Compare
/retest |
/retest-required |
/retest |
/approve |
/lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bparees, cgoncalves, mlguerrero12, mmirecki 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 |
@mlguerrero12: The following tests failed, say
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/test-infra repository. I understand the commands that are listed here. |
/retest-required |
Test for the following PR:
containernetworking/plugins#832
Signed-off-by: Marcelo Guerrero Viveros marguerr@redhat.com