mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-25 04:33:26 +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.
|
||||
// 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) {
|
||||
userNs, err := runtimeHelper.GetOrCreateUserNamespaceMappings(pod)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &runtimeapi.NamespaceOption{
|
||||
Ipc: IpcNamespaceForPod(pod),
|
||||
Network: NetworkNamespaceForPod(pod),
|
||||
Pid: PidNamespaceForPod(pod),
|
||||
Ipc: IpcNamespaceForPod(pod),
|
||||
Network: NetworkNamespaceForPod(pod),
|
||||
Pid: PidNamespaceForPod(pod),
|
||||
UsernsOptions: userNs,
|
||||
}, nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user