mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 13:37:30 +00:00
kubelet: set user namespace options
Set the user namespace options to use for the pod. Signed-off-by: Rodrigo Campos <rodrigoca@microsoft.com>
This commit is contained in:
parent
67b38ffe6e
commit
138e80819e
@ -100,9 +100,15 @@ func PidNamespaceForPod(pod *v1.Pod) runtimeapi.NamespaceMode {
|
|||||||
// namespacesForPod returns the runtimeapi.NamespaceOption for a given pod.
|
// namespacesForPod returns the runtimeapi.NamespaceOption for a given pod.
|
||||||
// An empty or nil pod can be used to get the namespace defaults for v1.Pod.
|
// An empty or nil pod can be used to get the namespace defaults for v1.Pod.
|
||||||
func NamespacesForPod(pod *v1.Pod, runtimeHelper kubecontainer.RuntimeHelper) (*runtimeapi.NamespaceOption, error) {
|
func NamespacesForPod(pod *v1.Pod, runtimeHelper kubecontainer.RuntimeHelper) (*runtimeapi.NamespaceOption, error) {
|
||||||
|
userNs, err := runtimeHelper.GetOrCreateUserNamespaceMappings(pod)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
return &runtimeapi.NamespaceOption{
|
return &runtimeapi.NamespaceOption{
|
||||||
Ipc: IpcNamespaceForPod(pod),
|
Ipc: IpcNamespaceForPod(pod),
|
||||||
Network: NetworkNamespaceForPod(pod),
|
Network: NetworkNamespaceForPod(pod),
|
||||||
Pid: PidNamespaceForPod(pod),
|
Pid: PidNamespaceForPod(pod),
|
||||||
|
UsernsOptions: userNs,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user