mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 15:05:27 +00:00
use feature gate instead of flag to control support for GPUs
Signed-off-by: Vishnu kannan <vishnuk@google.com>
This commit is contained in:
parent
3b0a408e3b
commit
69acb02394
@ -206,7 +206,6 @@ func (s *KubeletServer) AddFlags(fs *pflag.FlagSet) {
|
||||
fs.BoolVar(&s.BabysitDaemons, "babysit-daemons", s.BabysitDaemons, "If true, the node has babysitter process monitoring docker and kubelet.")
|
||||
fs.MarkDeprecated("babysit-daemons", "Will be removed in a future version.")
|
||||
fs.Int32Var(&s.MaxPods, "max-pods", s.MaxPods, "Number of Pods that can run on this Kubelet.")
|
||||
fs.BoolVar(&s.ExperimentalEnableNvidiaGPU, "experimental-enable-nvidia-gpu", s.ExperimentalEnableNvidiaGPU, "Enable experimental Nvidia GPU support.")
|
||||
// TODO(#40229): Remove the docker-exec-handler flag.
|
||||
fs.StringVar(&s.DockerExecHandlerName, "docker-exec-handler", s.DockerExecHandlerName, "Handler to use when executing a command in a container. Valid values are 'native' and 'nsenter'. Defaults to 'native'.")
|
||||
fs.MarkDeprecated("docker-exec-handler", "this flag will be removed and only the 'native' handler will be supported in the future.")
|
||||
|
@ -362,8 +362,6 @@ type KubeletConfiguration struct {
|
||||
BabysitDaemons bool
|
||||
// maxPods is the number of pods that can run on this Kubelet.
|
||||
MaxPods int32
|
||||
// Enable experimental Nvidia GPU
|
||||
ExperimentalEnableNvidiaGPU bool
|
||||
// dockerExecHandlerName is the handler to use when executing a command
|
||||
// in a container. Valid values are 'native' and 'nsenter'. Defaults to
|
||||
// 'native'.
|
||||
|
@ -407,8 +407,6 @@ type KubeletConfiguration struct {
|
||||
BabysitDaemons bool `json:"babysitDaemons"`
|
||||
// maxPods is the number of pods that can run on this Kubelet.
|
||||
MaxPods int32 `json:"maxPods"`
|
||||
// Enable Nvidia GPU support on this node.
|
||||
ExperimentalEnableNvidiaGPU bool `json:"experimentalEnableNvidiaGPU"`
|
||||
// dockerExecHandlerName is the handler to use when executing a command
|
||||
// in a container. Valid values are 'native' and 'nsenter'. Defaults to
|
||||
// 'native'.
|
||||
|
@ -353,7 +353,6 @@ func autoConvert_v1alpha1_KubeletConfiguration_To_componentconfig_KubeletConfigu
|
||||
out.HairpinMode = in.HairpinMode
|
||||
out.BabysitDaemons = in.BabysitDaemons
|
||||
out.MaxPods = in.MaxPods
|
||||
out.ExperimentalEnableNvidiaGPU = in.ExperimentalEnableNvidiaGPU
|
||||
out.DockerExecHandlerName = in.DockerExecHandlerName
|
||||
out.PodCIDR = in.PodCIDR
|
||||
out.ResolverConfig = in.ResolverConfig
|
||||
@ -531,7 +530,6 @@ func autoConvert_componentconfig_KubeletConfiguration_To_v1alpha1_KubeletConfigu
|
||||
out.HairpinMode = in.HairpinMode
|
||||
out.BabysitDaemons = in.BabysitDaemons
|
||||
out.MaxPods = in.MaxPods
|
||||
out.ExperimentalEnableNvidiaGPU = in.ExperimentalEnableNvidiaGPU
|
||||
out.DockerExecHandlerName = in.DockerExecHandlerName
|
||||
out.PodCIDR = in.PodCIDR
|
||||
out.ResolverConfig = in.ResolverConfig
|
||||
|
@ -73,6 +73,13 @@ const (
|
||||
// Determines if affinity defined in annotations should be processed
|
||||
// TODO: remove when alpha support for affinity is removed
|
||||
AffinityInAnnotations utilfeature.Feature = "AffinityInAnnotations"
|
||||
|
||||
// owner: @vishh
|
||||
// alpha: v1.6
|
||||
//
|
||||
// Enables support for GPUs as a schedulable resource.
|
||||
// Only Nvidia GPUs are supported as of v1.6
|
||||
Accelerators utilfeature.Feature = "Accelerators"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@ -90,6 +97,7 @@ var defaultKubernetesFeatureGates = map[utilfeature.Feature]utilfeature.FeatureS
|
||||
ExperimentalHostUserNamespaceDefaultingGate: {Default: false, PreRelease: utilfeature.Beta},
|
||||
ExperimentalCriticalPodAnnotation: {Default: false, PreRelease: utilfeature.Alpha},
|
||||
AffinityInAnnotations: {Default: false, PreRelease: utilfeature.Alpha},
|
||||
Accelerators: {Default: false, PreRelease: utilfeature.Alpha},
|
||||
|
||||
// inherited features from generic apiserver, relisted here to get a conflict if it is changed
|
||||
// unintentionally on either side:
|
||||
|
17231
pkg/generated/openapi/zz_generated.openapi.go
Normal file
17231
pkg/generated/openapi/zz_generated.openapi.go
Normal file
File diff suppressed because it is too large
Load Diff
@ -787,7 +787,7 @@ func NewMainKubelet(kubeCfg *componentconfig.KubeletConfiguration, kubeDeps *Kub
|
||||
|
||||
klet.appArmorValidator = apparmor.NewValidator(kubeCfg.ContainerRuntime)
|
||||
klet.softAdmitHandlers.AddPodAdmitHandler(lifecycle.NewAppArmorAdmitHandler(klet.appArmorValidator))
|
||||
if kubeCfg.ExperimentalEnableNvidiaGPU {
|
||||
if utilfeature.DefaultFeatureGate.Enabled(features.Accelerators) {
|
||||
klet.gpuManager = nvidia.NewNvidiaGPUManager(klet, klet.dockerClient)
|
||||
} else {
|
||||
klet.gpuManager = gpu.NewGPUManagerStub()
|
||||
|
Loading…
Reference in New Issue
Block a user