mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-10 12:32:03 +00:00
Remove unnecessary if judgments
This commit is contained in:
parent
d97ea0f705
commit
ee99ca25ee
@ -116,13 +116,8 @@ func (w *patternAllowlist) Admit(attrs *lifecycle.PodAdmitAttributes) lifecycle.
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var hostNet, hostIPC bool
|
|
||||||
if pod.Spec.SecurityContext != nil {
|
|
||||||
hostNet = pod.Spec.HostNetwork
|
|
||||||
hostIPC = pod.Spec.HostIPC
|
|
||||||
}
|
|
||||||
for _, s := range pod.Spec.SecurityContext.Sysctls {
|
for _, s := range pod.Spec.SecurityContext.Sysctls {
|
||||||
if err := w.validateSysctl(s.Name, hostNet, hostIPC); err != nil {
|
if err := w.validateSysctl(s.Name, pod.Spec.HostNetwork, pod.Spec.HostIPC); err != nil {
|
||||||
return lifecycle.PodAdmitResult{
|
return lifecycle.PodAdmitResult{
|
||||||
Admit: false,
|
Admit: false,
|
||||||
Reason: ForbiddenReason,
|
Reason: ForbiddenReason,
|
||||||
|
Loading…
Reference in New Issue
Block a user