mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 15:37:24 +00:00
Add "MayRunAs" value among other GroupStrategies
Adds "MayRunAs" value among other group strategies. This strategy allows to define a certain range of GIDs for FSGroupStrategy and SupplementalGroupStrategy in a PSP. This new strategy works similarly to the "MustRunAs" one, except that when no GID is specified in a pod/container security context then no GID is generated for the respective containers. Resolves #56173
This commit is contained in:
@@ -48,12 +48,14 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
|
||||
|
||||
supplementalGroupsRules := []policy.SupplementalGroupsStrategyType{
|
||||
policy.SupplementalGroupsStrategyRunAsAny,
|
||||
policy.SupplementalGroupsStrategyMayRunAs,
|
||||
policy.SupplementalGroupsStrategyMustRunAs,
|
||||
}
|
||||
psp.SupplementalGroups.Rule = supplementalGroupsRules[c.Rand.Intn(len(supplementalGroupsRules))]
|
||||
|
||||
fsGroupRules := []policy.FSGroupStrategyType{
|
||||
policy.FSGroupStrategyMustRunAs,
|
||||
policy.FSGroupStrategyMayRunAs,
|
||||
policy.FSGroupStrategyRunAsAny,
|
||||
}
|
||||
psp.FSGroup.Rule = fsGroupRules[c.Rand.Intn(len(fsGroupRules))]
|
||||
|
||||
Reference in New Issue
Block a user