This commit is contained in:
pat-s 2024-10-02 11:16:35 +02:00
parent 866039360c
commit 34fd3849d9
No known key found for this signature in database
GPG key ID: 3C6318841EF78925

View file

@ -382,7 +382,7 @@ func podSecurityContext(sc *SecurityContext, secCtxConf SecurityContextConfig, s
user *int64 user *int64
group *int64 group *int64
fsGroup *int64 fsGroup *int64
fsGroupChangePolicy *string // fsGroupChangePolicy *v1.PodFSGroupChangePolicy
seccomp *v1.SeccompProfile seccomp *v1.SeccompProfile
apparmor *v1.AppArmorProfile apparmor *v1.AppArmorProfile
) )
@ -414,11 +414,12 @@ func podSecurityContext(sc *SecurityContext, secCtxConf SecurityContextConfig, s
// if unset, set fsGroup to 1000 by default to support non-root images // if unset, set fsGroup to 1000 by default to support non-root images
if sc.FSGroup == nil { if sc.FSGroup == nil {
fsGroup = 1000 fsGroup = newInt64(1000)
// do the same for fsGroupChangePolicy but only if fsGroup is also set accordingly // do the same for fsGroupChangePolicy but only if fsGroup is also set accordingly
if sc.FSGroupChangePolicy == nil { // if sc.FSGroupChangePolicy == nil {
fsGroupChangePolicy = "OnRootMismatch" // policy := v1.PodFSGroupChangePolicyOnRootMismatch
} // fsGroupChangePolicy = &policy
// }
} }
seccomp = seccompProfile(sc.SeccompProfile) seccomp = seccompProfile(sc.SeccompProfile)
@ -434,7 +435,7 @@ func podSecurityContext(sc *SecurityContext, secCtxConf SecurityContextConfig, s
RunAsUser: user, RunAsUser: user,
RunAsGroup: group, RunAsGroup: group,
FSGroup: fsGroup, FSGroup: fsGroup,
FSGroupChangePolicy: fsGroupChangePolicy, // FSGroupChangePolicy: fsGroupChangePolicy,
SeccompProfile: seccomp, SeccompProfile: seccomp,
AppArmorProfile: apparmor, AppArmorProfile: apparmor,
} }