mirror of https://github.com/k3s-io/k3s
PodSecurityPolicy: avoid unnecessary mutation of supplemental groups
parent
cfb490e3a1
commit
abc7c077e1
|
@ -34,7 +34,7 @@ func NewRunAsAny() (GroupStrategy, error) {
|
|||
|
||||
// Generate creates the group based on policy rules. This strategy returns an empty slice.
|
||||
func (s *runAsAny) Generate(pod *api.Pod) ([]int64, error) {
|
||||
return []int64{}, nil
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
// Generate a single value to be applied. This is used for FSGroup. This strategy returns nil.
|
||||
|
|
|
@ -80,7 +80,7 @@ func (s *simpleProvider) CreatePodSecurityContext(pod *api.Pod) (*api.PodSecurit
|
|||
}
|
||||
annotations := maps.CopySS(pod.Annotations)
|
||||
|
||||
if len(sc.SupplementalGroups) == 0 {
|
||||
if sc.SupplementalGroups == nil {
|
||||
supGroups, err := s.strategies.SupplementalGroupStrategy.Generate(pod)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
|
|
|
@ -993,7 +993,7 @@ func TestAdmitSupplementalGroups(t *testing.T) {
|
|||
pod: goodPod(),
|
||||
psps: []*extensions.PodSecurityPolicy{runAsAny},
|
||||
shouldPass: true,
|
||||
expectedSupGroups: []int64{},
|
||||
expectedSupGroups: nil,
|
||||
expectedPSP: runAsAny.Name,
|
||||
},
|
||||
"runAsAny pod request": {
|
||||
|
|
Loading…
Reference in New Issue