...

Source file src/k8s.io/kubernetes/pkg/kubelet/cm/memorymanager/policy_none.go

Documentation: k8s.io/kubernetes/pkg/kubelet/cm/memorymanager

     1  /*
     2  Copyright 2020 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 memorymanager
    18  
    19  import (
    20  	v1 "k8s.io/api/core/v1"
    21  	"k8s.io/kubernetes/pkg/kubelet/cm/memorymanager/state"
    22  	"k8s.io/kubernetes/pkg/kubelet/cm/topologymanager"
    23  )
    24  
    25  const policyTypeNone policyType = "None"
    26  
    27  // none is implementation of the policy interface for the none policy, using none
    28  // policy is the same as disable memory management
    29  type none struct{}
    30  
    31  var _ Policy = &none{}
    32  
    33  // NewPolicyNone returns new none policy instance
    34  func NewPolicyNone() Policy {
    35  	return &none{}
    36  }
    37  
    38  func (p *none) Name() string {
    39  	return string(policyTypeNone)
    40  }
    41  
    42  func (p *none) Start(s state.State) error {
    43  	return nil
    44  }
    45  
    46  // Allocate call is idempotent
    47  func (p *none) Allocate(s state.State, pod *v1.Pod, container *v1.Container) error {
    48  	return nil
    49  }
    50  
    51  // RemoveContainer call is idempotent
    52  func (p *none) RemoveContainer(s state.State, podUID string, containerName string) {
    53  }
    54  
    55  // GetTopologyHints implements the topologymanager.HintProvider Interface
    56  // and is consulted to achieve NUMA aware resource alignment among this
    57  // and other resource controllers.
    58  func (p *none) GetTopologyHints(s state.State, pod *v1.Pod, container *v1.Container) map[string][]topologymanager.TopologyHint {
    59  	return nil
    60  }
    61  
    62  // GetPodTopologyHints implements the topologymanager.HintProvider Interface
    63  // and is consulted to achieve NUMA aware resource alignment among this
    64  // and other resource controllers.
    65  func (p *none) GetPodTopologyHints(s state.State, pod *v1.Pod) map[string][]topologymanager.TopologyHint {
    66  	return nil
    67  }
    68  
    69  // GetAllocatableMemory returns the amount of allocatable memory for each NUMA node
    70  func (p *none) GetAllocatableMemory(s state.State) []state.Block {
    71  	return []state.Block{}
    72  }
    73  

View as plain text