-
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
set selinux labels on build docker containers when running pods in crio #17094
Conversation
/test crio |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: bparees The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these OWNERS Files:
You can indicate your approval by writing |
/unassign @mfojtik @stevekuznetsov |
/test crio |
/test crio |
/test crio |
pkg/build/builder/util_linux.go
Outdated
return fmt.Sprintf("label=level:%s", match[1]), nil | ||
} | ||
} | ||
return "", nil |
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.
Do we want to return an error if we don't find a match or just skip adding SecurityOpt if we don't find it adding a warning in the log?
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.
yeah i'll add a warning and skip.
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.
Is this code being run within a container? Why not just use
if label, err := selinux.CurrentLabel(); err != nil {
....
}
level := selinux.NewContext("level")
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.
import "github.com/opencontainers/selinux/go-selinux"
/test crio |
1 similar comment
/test crio |
@bparees there are still build tests failing in the cri-o job in the CI |
/test crio |
pkg/build/builder/util_linux.go
Outdated
} | ||
if match := selinuxLabelPattern.FindStringSubmatch(s.Text()); match != nil { | ||
glog.V(6).Infof("found selinux labels: %v", match[1]) | ||
return fmt.Sprintf("label=level:%s", match[1]), nil |
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 thought we needed to match user/role/type as well here? What happens if there is a customer SELinux label on the container, no match?
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.
s/customer/custom but in any case, response was explained here: #17094 (comment)
@pweil- It is a safe assumption that this is not the case. And you probably don't want to match the type. Most likely you are running a container that can talk to docker, which is probably a looser policy while you want to run the build with the traditional SELinux label. In SELinux terms the User and Role are almost never used. |
@runcom they look like networking problems now:
|
Travis is complaining on
|
extended_image_ecosystem:
|
@bparees We preserved a test instance and I was able to logon and verify that regular pods have internet connectivity. If you can stop a build with assemble script on one of these then we can debug the networking issues tomorrow. |
/retest |
Cri-o wise, this PR looks good as it fixes build tests 👍 |
@bparees Can we get this merged? |
@mrunalp it's fine with me, i assumed you wanted the crio tests passing. |
also the "extended builds" suite is being skipped. i'd prefer to see it actually pass that suite. |
(for which we need @stevekuznetsov to tell us why it's being skipped) |
c40d1ce
to
bce732a
Compare
/test crio |
@bparees the extended build test looks like it ran and failed -- what do you mean? |
@stevekuznetsov wasn't the situation last night. |
/test crio |
/test extended_builds |
/test extended_conformance_install |
@bparees: The following tests failed, say
Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR. 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. |
Automatic merge from submit-queue (batch tested with PRs 17476, 17143, 15115, 17094, 17500). |
@runcom why? |
@bparees to fix builds there as well? |
@runcom we don't generally backport things to older origin releases. I assume we didn't make any claims about crio support in 3.7 (since we didn't get it working before 3.7 shipped) so i don't see why we'd backport it now. |
We did ship cri-o in tech preview for 3.7. |
as @mrunalp said, we shipped it as tech preview and we have this working now. It would be nice to have this backported so people can actually start using CRI-O if they want and we get feedback and all the rest |
We're not usually in the business of releasing point patches on top of old Origin releases. /cc @smarterclayton |
ack ack, sorry for the noise :) |
Automatic merge from submit-queue. [release-3.7] setup selinux labels for build containers back ports #17094 to `release-3.7` @smarterclayton PTAL
for bug https://bugzilla.redhat.com/show_bug.cgi?id=1507424