|
| 1 | +/* |
| 2 | +Copyright 2025 The Kubernetes Authors. |
| 3 | +
|
| 4 | +Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +you may not use this file except in compliance with the License. |
| 6 | +You may obtain a copy of the License at |
| 7 | +
|
| 8 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +
|
| 10 | +Unless required by applicable law or agreed to in writing, software |
| 11 | +distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +See the License for the specific language governing permissions and |
| 14 | +limitations under the License. |
| 15 | +*/ |
| 16 | + |
| 17 | +package userns |
| 18 | + |
| 19 | +import ( |
| 20 | + v1 "k8s.io/api/core/v1" |
| 21 | + "k8s.io/apimachinery/pkg/types" |
| 22 | + runtimeapi "k8s.io/cri-api/pkg/apis/runtime/v1" |
| 23 | + kubecontainer "k8s.io/kubernetes/pkg/kubelet/container" |
| 24 | +) |
| 25 | + |
| 26 | +type UsernsManager struct{} |
| 27 | + |
| 28 | +func MakeUserNsManager(kl userNsPodsManager) (*UsernsManager, error) { |
| 29 | + return nil, nil |
| 30 | +} |
| 31 | + |
| 32 | +// Release releases the user namespace allocated to the specified pod. |
| 33 | +func (m *UsernsManager) Release(podUID types.UID) { |
| 34 | + return |
| 35 | +} |
| 36 | + |
| 37 | +func (m *UsernsManager) GetOrCreateUserNamespaceMappings(pod *v1.Pod, runtimeHandler string) (*runtimeapi.UserNamespace, error) { |
| 38 | + return nil, nil |
| 39 | +} |
| 40 | + |
| 41 | +// CleanupOrphanedPodUsernsAllocations reconciliates the state of user namespace |
| 42 | +// allocations with the pods actually running. It frees any user namespace |
| 43 | +// allocation for orphaned pods. |
| 44 | +func (m *UsernsManager) CleanupOrphanedPodUsernsAllocations(pods []*v1.Pod, runningPods []*kubecontainer.Pod) error { |
| 45 | + return nil |
| 46 | +} |
| 47 | + |
| 48 | +func EnabledUserNamespacesSupport() bool { |
| 49 | + return false |
| 50 | +} |
0 commit comments