mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-02 03:08:15 +00:00
KEP-3619: Fine-grained SupplementalGroups control (#117842)
* Add `Linux{Sandbox,Container}SecurityContext.SupplementalGroupsPolicy` and `ContainerStatus.user` in cri-api
* Add `PodSecurityContext.SupplementalGroupsPolicy`, `ContainerStatus.User` and its featuregate
* Implement DropDisabledPodFields for PodSecurityContext.SupplementalGroupsPolicy and ContainerStatus.User fields
* Implement kubelet so to wire between SecurityContext.SupplementalGroupsPolicy/ContainerStatus.User and cri-api in kubelet
* Clarify `SupplementalGroupsPolicy` is an OS depdendent field.
* Make `ContainerStatus.User` is initially attached user identity to the first process in the ContainerStatus
It is because, the process identity can be dynamic if the initially attached identity
has enough privilege calling setuid/setgid/setgroups syscalls in Linux.
* Rewording suggestion applied
* Add TODO comment for updating SupplementalGroupsPolicy default value in v1.34
* Added validations for SupplementalGroupsPolicy and ContainerUser
* No need featuregate check in validation when adding new field with no default value
* fix typo: identitiy -> identity
This commit is contained in:
@@ -437,3 +437,20 @@ func calcSwapForBurstablePods(containerMemoryRequest, nodeTotalMemory, totalPods
|
||||
|
||||
return int64(swapAllocation), nil
|
||||
}
|
||||
|
||||
func toKubeContainerUser(statusUser *runtimeapi.ContainerUser) *kubecontainer.ContainerUser {
|
||||
if statusUser == nil {
|
||||
return nil
|
||||
}
|
||||
|
||||
user := &kubecontainer.ContainerUser{}
|
||||
if statusUser.GetLinux() != nil {
|
||||
user.Linux = &kubecontainer.LinuxContainerUser{
|
||||
UID: statusUser.GetLinux().GetUid(),
|
||||
GID: statusUser.GetLinux().GetGid(),
|
||||
SupplementalGroups: statusUser.GetLinux().GetSupplementalGroups(),
|
||||
}
|
||||
}
|
||||
|
||||
return user
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user