Add hint to fake topology manager.

This commit is contained in:
kikimo
2021-05-22 15:29:08 +08:00
parent 916ed1d3ad
commit 20c02357ca

View File

@@ -17,12 +17,14 @@ limitations under the License.
package topologymanager
import (
"k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
"k8s.io/klog/v2"
"k8s.io/kubernetes/pkg/kubelet/lifecycle"
)
type fakeManager struct{}
type fakeManager struct {
hint *TopologyHint
}
//NewFakeManager returns an instance of FakeManager
func NewFakeManager() Manager {
@@ -30,9 +32,21 @@ func NewFakeManager() Manager {
return &fakeManager{}
}
// NewFakeManagerWithHint returns an instance of fake topology manager with specified topology hints
func NewFakeManagerWithHint(hint *TopologyHint) Manager {
klog.InfoS("NewFakeManagerWithHint")
return &fakeManager{
hint: hint,
}
}
func (m *fakeManager) GetAffinity(podUID string, containerName string) TopologyHint {
klog.InfoS("GetAffinity", "podUID", podUID, "containerName", containerName)
return TopologyHint{}
if m.hint == nil {
return TopologyHint{}
}
return *m.hint
}
func (m *fakeManager) AddHintProvider(h HintProvider) {