-
Notifications
You must be signed in to change notification settings - Fork 55
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 ability to use SCCs in DevWorkspaces on OpenShift #679
Conversation
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.
LGTM. I'm definitely a fan of giving cluster admins all the control here
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: amisevsk, JPinkney 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 |
/test v8-devworkspace-operator-e2e |
Allow the controller to create LocalSubjectAccessReviews in order to review user permissions when access DevWorkspace features. Signed-off-by: Angel Misevski <[email protected]>
Signed-off-by: Angel Misevski <[email protected]>
Add attribute 'controller.devfile.io/scc' which defines additional SCCs to add to the workspace service account. Add a MutatingWebhook check that reviews the requesters permissions for access the given SCC. Functionality only enabled on OpenShift. Signed-off-by: Angel Misevski <[email protected]>
Look into 'controller.devfile.io/scc' attribute on DevWorkspaces and attempt to add scc listed there to the workspace serviceAccount. This requires additional privileges for the DW controller which are not provided by default (must be granted explicitly by a cluster-admin) Signed-off-by: Angel Misevski <[email protected]>
The way that controller-runtime caches works means that errors in listing and watching a resource results in cluster interactions that require the cache hanging and errors being logged asynchronously. In order to use the cached client we have to check for list/watch access. Signed-off-by: Angel Misevski <[email protected]>
Signed-off-by: Angel Misevski <[email protected]>
Signed-off-by: Angel Misevski <[email protected]>
d0edd51
to
74780cc
Compare
New changes are detected. LGTM label has been removed. |
/test v8-devworkspace-operator-e2e |
What does this PR do?
This is a proof-of-concept PR that adds the ability to use SecurityContextConstraints (SCCs) in DevWorkspaces, which can be used to e.g. enable container builds within workspace containers. SCCs used by a DevWorkspace are defined through the attribute
controller.devfile.io/scc: <scc-name>
.In order to avoid overextending the default DWO RBAC, no ability to view/edit SCCs is granted to the Operator by default, and attempting to use SCCs in workspaces will fail with a message like
The requirements to use this feature are:
get
andupdate
privileges for a given SCC by a cluster-adminuse
privilege on that SCC by a cluster-admincontroller.devfile.io/scc
attribute by a user with permissions touse
that SCC.One benefit in this approach is that the cluster admin can revoke these privileges from users/the controller after the fact without breaking regular workspaces.
Once the
controller.devfile.io/scc
attribute is set on a DevWorkspace, it cannot be modified in order to avoid leaking SAs into existin SCCs. Using the attribute adds a finalizer for SCCs to the DevWorkspace to ensure any changes to SCCs are cleaned up when the workspace is deleted.Since SCCs are an OpenShift feature, this functionality is disabled on Kubernetes and attempting to use the attribute will be rejected by webhooks.
What issues does this PR fix or reference?
Closes eclipse-che/che#20459
Is it tested? How?
The steps below follow similarly to the Buildah OpenShift rootless build doc.
anyuid
SCC with the added requirement that containers drop theKILL
capability.get
andupdate
privileges for this SCC:use
thecontainer-build
SCC:container-build
SCC:openshift.io/scc: container-build
annotation.users
field incontainer-build
SCC is empty (i.e. that the workspace's ServiceAccount is removed)PR Checklist
/test v8-devworkspace-operator-e2e, v8-che-happy-path
to trigger)v8-devworkspace-operator-e2e
: DevWorkspace e2e testv8-che-happy-path
: Happy path for verification integration with Che