...

Source file src/k8s.io/kubernetes/pkg/kubelet/cm/memorymanager/policy.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  // Type defines the policy type
    26  type policyType string
    27  
    28  // Policy implements logic for pod container to a memory assignment.
    29  type Policy interface {
    30  	Name() string
    31  	Start(s state.State) error
    32  	// Allocate call is idempotent
    33  	Allocate(s state.State, pod *v1.Pod, container *v1.Container) error
    34  	// RemoveContainer call is idempotent
    35  	RemoveContainer(s state.State, podUID string, containerName string)
    36  	// GetTopologyHints implements the topologymanager.HintProvider Interface
    37  	// and is consulted to achieve NUMA aware resource alignment among this
    38  	// and other resource controllers.
    39  	GetTopologyHints(s state.State, pod *v1.Pod, container *v1.Container) map[string][]topologymanager.TopologyHint
    40  	// GetPodTopologyHints implements the topologymanager.HintProvider Interface
    41  	// and is consulted to achieve NUMA aware resource alignment among this
    42  	// and other resource controllers.
    43  	GetPodTopologyHints(s state.State, pod *v1.Pod) map[string][]topologymanager.TopologyHint
    44  	// GetAllocatableMemory returns the amount of allocatable memory for each NUMA node
    45  	GetAllocatableMemory(s state.State) []state.Block
    46  }
    47  

View as plain text