Fix privileged steps in kubernetes (#3711)

This commit is contained in:
Anbraten
2024-05-30 18:53:03 +02:00
committed by GitHub
parent 4c6089630f
commit f6904d6662
4 changed files with 76 additions and 15 deletions

View File

@@ -445,7 +445,19 @@ func containerSecurityContext(sc *SecurityContext, stepPrivileged bool) *v1.Secu
return nil
}
privileged := false
// if security context privileged is set explicitly
if sc != nil && sc.Privileged != nil && *sc.Privileged {
privileged = true
}
// if security context privileged is not set explicitly, but step is privileged
if (sc == nil || sc.Privileged == nil) && stepPrivileged {
privileged = true
}
if privileged {
securityContext := &v1.SecurityContext{
Privileged: newBool(true),
}