mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-09-01 22:38:33 +00:00
Add fsGroupChangePolicy
option to Kubernetes backend (#5416)
Co-authored-by: Lilly Sell <sell@b1-systems.de>
This commit is contained in:
@@ -462,12 +462,13 @@ func toleration(backendToleration Toleration) v1.Toleration {
|
||||
|
||||
func podSecurityContext(sc *SecurityContext, secCtxConf SecurityContextConfig, stepPrivileged bool) *v1.PodSecurityContext {
|
||||
var (
|
||||
nonRoot *bool
|
||||
user *int64
|
||||
group *int64
|
||||
fsGroup *int64
|
||||
seccomp *v1.SeccompProfile
|
||||
apparmor *v1.AppArmorProfile
|
||||
nonRoot *bool
|
||||
user *int64
|
||||
group *int64
|
||||
fsGroup *int64
|
||||
fsGroupChangePolicy *v1.PodFSGroupChangePolicy
|
||||
seccomp *v1.SeccompProfile
|
||||
apparmor *v1.AppArmorProfile
|
||||
)
|
||||
|
||||
if secCtxConf.RunAsNonRoot {
|
||||
@@ -505,6 +506,7 @@ func podSecurityContext(sc *SecurityContext, secCtxConf SecurityContextConfig, s
|
||||
|
||||
seccomp = seccompProfile(sc.SeccompProfile)
|
||||
apparmor = apparmorProfile(sc.ApparmorProfile)
|
||||
fsGroupChangePolicy = sc.FsGroupChangePolicy
|
||||
}
|
||||
|
||||
if nonRoot == nil && user == nil && group == nil && fsGroup == nil && seccomp == nil && apparmor == nil {
|
||||
@@ -512,12 +514,13 @@ func podSecurityContext(sc *SecurityContext, secCtxConf SecurityContextConfig, s
|
||||
}
|
||||
|
||||
securityContext := &v1.PodSecurityContext{
|
||||
RunAsNonRoot: nonRoot,
|
||||
RunAsUser: user,
|
||||
RunAsGroup: group,
|
||||
FSGroup: fsGroup,
|
||||
SeccompProfile: seccomp,
|
||||
AppArmorProfile: apparmor,
|
||||
RunAsNonRoot: nonRoot,
|
||||
RunAsUser: user,
|
||||
RunAsGroup: group,
|
||||
FSGroup: fsGroup,
|
||||
FSGroupChangePolicy: fsGroupChangePolicy,
|
||||
SeccompProfile: seccomp,
|
||||
AppArmorProfile: apparmor,
|
||||
}
|
||||
log.Trace().Msgf("pod security context that will be used: %v", securityContext)
|
||||
return securityContext
|
||||
|
Reference in New Issue
Block a user