k8s.io/kubernetes@v1.29.3/pkg/kubelet/cm/cgroup_manager_unsupported.go (about) 1 //go:build !linux 2 // +build !linux 3 4 /* 5 Copyright 2016 The Kubernetes Authors. 6 7 Licensed under the Apache License, Version 2.0 (the "License"); 8 you may not use this file except in compliance with the License. 9 You may obtain a copy of the License at 10 11 http://www.apache.org/licenses/LICENSE-2.0 12 13 Unless required by applicable law or agreed to in writing, software 14 distributed under the License is distributed on an "AS IS" BASIS, 15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 See the License for the specific language governing permissions and 17 limitations under the License. 18 */ 19 20 package cm 21 22 import ( 23 "errors" 24 25 v1 "k8s.io/api/core/v1" 26 ) 27 28 type unsupportedCgroupManager struct{} 29 30 var errNotSupported = errors.New("Cgroup Manager is not supported in this build") 31 32 // Make sure that unsupportedCgroupManager implements the CgroupManager interface 33 var _ CgroupManager = &unsupportedCgroupManager{} 34 35 type CgroupSubsystems struct { 36 Mounts []interface{} 37 MountPoints map[string]string 38 } 39 40 func NewCgroupManager(_ interface{}) CgroupManager { 41 return &unsupportedCgroupManager{} 42 } 43 44 func (m *unsupportedCgroupManager) Name(_ CgroupName) string { 45 return "" 46 } 47 48 func (m *unsupportedCgroupManager) Validate(_ CgroupName) error { 49 return errNotSupported 50 } 51 52 func (m *unsupportedCgroupManager) Exists(_ CgroupName) bool { 53 return false 54 } 55 56 func (m *unsupportedCgroupManager) Destroy(_ *CgroupConfig) error { 57 return nil 58 } 59 60 func (m *unsupportedCgroupManager) Update(_ *CgroupConfig) error { 61 return nil 62 } 63 64 func (m *unsupportedCgroupManager) Create(_ *CgroupConfig) error { 65 return errNotSupported 66 } 67 68 func (m *unsupportedCgroupManager) MemoryUsage(_ CgroupName) (int64, error) { 69 return -1, errNotSupported 70 } 71 72 func (m *unsupportedCgroupManager) Pids(_ CgroupName) []int { 73 return nil 74 } 75 76 func (m *unsupportedCgroupManager) CgroupName(name string) CgroupName { 77 return CgroupName([]string{}) 78 } 79 80 func (m *unsupportedCgroupManager) ReduceCPULimits(cgroupName CgroupName) error { 81 return nil 82 } 83 84 func (m *unsupportedCgroupManager) GetCgroupConfig(name CgroupName, resource v1.ResourceName) (*ResourceConfig, error) { 85 return nil, errNotSupported 86 } 87 88 func (m *unsupportedCgroupManager) SetCgroupConfig(name CgroupName, resource v1.ResourceName, resourceConfig *ResourceConfig) error { 89 return errNotSupported 90 } 91 92 var RootCgroupName = CgroupName([]string{}) 93 94 func NewCgroupName(base CgroupName, components ...string) CgroupName { 95 return append(append([]string{}, base...), components...) 96 } 97 98 func (cgroupName CgroupName) ToSystemd() string { 99 return "" 100 } 101 102 func ParseSystemdToCgroupName(name string) CgroupName { 103 return nil 104 } 105 106 func (cgroupName CgroupName) ToCgroupfs() string { 107 return "" 108 } 109 110 func ParseCgroupfsToCgroupName(name string) CgroupName { 111 return nil 112 } 113 114 func IsSystemdStyleName(name string) bool { 115 return false 116 }