Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature request] set the init container of volcano job as privileged mode #2123

Closed
zrss opened this issue Mar 28, 2022 · 3 comments · Fixed by #2125
Closed

[feature request] set the init container of volcano job as privileged mode #2123

zrss opened this issue Mar 28, 2022 · 3 comments · Fixed by #2125
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@zrss
Copy link
Contributor

zrss commented Mar 28, 2022

// Skip verify container SecurityContex.Privileged as it depends on
// the kube-apiserver `allow-privileged` flag.
for i, container := range coreTemplateSpec.Spec.Containers {
if container.SecurityContext != nil && container.SecurityContext.Privileged != nil {
coreTemplateSpec.Spec.Containers[i].SecurityContext.Privileged = nil
}
}

obviously, volcano forgets to cover the init container case ... and once the init container set the privileged field, it turns out

Error from server: error when creating "vj-test.yaml": admission webhook "validatejob.volcano.sh" denied the request: spec.task[0].template.spec.initContainers[0].securityContext.privileged: Forbidden: disallowed by cluster policy.
@k82cn
Copy link
Member

k82cn commented Mar 28, 2022

/kind bug

@volcano-sh-bot volcano-sh-bot added the kind/bug Categorizes issue or PR as related to a bug. label Mar 28, 2022
@wpeng102
Copy link
Member

/kind bug

I am not sure if the original logic to Skip verify container SecurityContex.Privileged is appropriate. The root cause is kube-apiserver configured --allow-privileged=true and kube-apiserver will use this config to init capabilities. But the volcano does not know the kube-apiserver configuration.

if sc.Privileged != nil {
if *sc.Privileged && !capabilities.Get().AllowPrivileged {
allErrs = append(allErrs, field.Forbidden(fldPath.Child("privileged"), "disallowed by cluster policy"))
}
}

If volcano use the same logic to valid pod, it maybe mismache by kube-apiserver.

if allErrs := k8scorevalid.ValidatePodTemplate(&corePodTemplate, opts); len(allErrs) > 0 {

So, maybe we need introduce allow-privileged flag for volcano webhook, which need guide users to config same value as kube-apiserver.

@k82cn
Copy link
Member

k82cn commented Mar 28, 2022

IMO, we just need to skip this check in Volcano, and deligate this to kube-apiserver :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants