mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 12:43:23 +00:00
kuberuntime: set namespsace options regardless of security context
This commit is contained in:
parent
3b8e327924
commit
5812c876f7
@ -41,24 +41,24 @@ func (m *kubeGenericRuntimeManager) determineEffectiveSecurityContext(pod *v1.Po
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set namespace options and supplemental groups.
|
// set namespace options and supplemental groups.
|
||||||
podSc := pod.Spec.SecurityContext
|
|
||||||
if podSc == nil {
|
|
||||||
return synthesized
|
|
||||||
}
|
|
||||||
synthesized.NamespaceOptions = &runtimeapi.NamespaceOption{
|
synthesized.NamespaceOptions = &runtimeapi.NamespaceOption{
|
||||||
HostNetwork: pod.Spec.HostNetwork,
|
HostNetwork: pod.Spec.HostNetwork,
|
||||||
HostIpc: pod.Spec.HostIPC,
|
HostIpc: pod.Spec.HostIPC,
|
||||||
HostPid: pod.Spec.HostPID,
|
HostPid: pod.Spec.HostPID,
|
||||||
}
|
}
|
||||||
if podSc.FSGroup != nil {
|
podSc := pod.Spec.SecurityContext
|
||||||
synthesized.SupplementalGroups = append(synthesized.SupplementalGroups, *podSc.FSGroup)
|
if podSc != nil {
|
||||||
|
if podSc.FSGroup != nil {
|
||||||
|
synthesized.SupplementalGroups = append(synthesized.SupplementalGroups, *podSc.FSGroup)
|
||||||
|
}
|
||||||
|
|
||||||
|
if podSc.SupplementalGroups != nil {
|
||||||
|
synthesized.SupplementalGroups = append(synthesized.SupplementalGroups, podSc.SupplementalGroups...)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if groups := m.runtimeHelper.GetExtraSupplementalGroupsForPod(pod); len(groups) > 0 {
|
if groups := m.runtimeHelper.GetExtraSupplementalGroupsForPod(pod); len(groups) > 0 {
|
||||||
synthesized.SupplementalGroups = append(synthesized.SupplementalGroups, groups...)
|
synthesized.SupplementalGroups = append(synthesized.SupplementalGroups, groups...)
|
||||||
}
|
}
|
||||||
if podSc.SupplementalGroups != nil {
|
|
||||||
synthesized.SupplementalGroups = append(synthesized.SupplementalGroups, podSc.SupplementalGroups...)
|
|
||||||
}
|
|
||||||
|
|
||||||
return synthesized
|
return synthesized
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user