RFE: Namespace's sa.scc.uid-range should support a list of ranges
A typical namespace:
kind: Namespace
metadata:
annotations:
openshift.io/sa.initialized-roles: "true"
openshift.io/sa.scc.mcs: s0:c1,c0
openshift.io/sa.scc.supplemental-groups: 1000000000/10000
openshift.io/sa.scc.uid-range: 1000000000/10000
...
My existing nfs export dir has an owner of 99 and GID of 5555. I want a non-root pod to access this nfs mount, so I add securityContext.runAsUser: 99 to my pod spec. But the pod fails with this error:
Error from server: error when creating "nfs-pod1.yaml": Pod "nfs-pod1" is forbidden: unable to validate against any security context constraint: [provider restricted: .spec.containers[0].securityContext.securityContext.runAsUser: invalid value '99', Details: UID on container nfs-busybox does not match required range. Found 99, required min: 1000000000 max: 1000009999]
Today, ignoring SCCs for the moment and just relying on the namespace's default IDs, I have to change the sa.scc.uid-range to something like 90/110 or 99-99 so that the runAsUser id is allowed.
IMO, a better approach is to support appending ",99-99" to the existing openshift.io/sa.scc.uid-range value, making UID ranges work the same as supplemental-groups. I expect that the code for supplemental-groups ranges can be leveraged to handle a list of user id ranges.
I think this is a good idea in general. After dealing with sup groups it was clear that we could reuse strategies between the two and that UID was more complicated than it needed to be.
In the upstream PR I've suggested doing this exact thing: https://github.com/kubernetes/kubernetes/pull/7893/files#diff-e1c628c34c42840b0392c48481d41320R967
So the question is whether or not we want to implement it in OpenShift or just wait for PSP. I would favor waiting since you can work around this by creating a copy of the restricted SCC with a MustRunAs(99) strategy.
From the other one - the first uid in the range should be the default, ie I should be able to define 1,0,1000-10000 to default to 1, have access to a unique range, and be able to be root optionally.
Alternatively we define another annotation that is extended ranges and continue to use this existing one as the primary range for mapping. It really depends on whether we ever expect Uid remapping to not suck.
Issues go stale after 90d of inactivity.
Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.
If this issue is safe to close now please do so with /close.
/lifecycle stale
/lifecycle frozen
/remove-lifecycle stale