@@ -55,32 +55,34 @@ func singleNUMAContainerLevelHandler(lh logr.Logger, pod *v1.Pod, zones topology
55
55
// https://kubernetes.io/docs/concepts/workloads/pods/init-containers/#understanding-init-containers
56
56
// therefore, we don't need to accumulate their resources together
57
57
for _ , initContainer := range pod .Spec .InitContainers {
58
- lh .V (6 ).Info ("init container desired resources" , stringify .ResourceListToLoggable (initContainer .Resources .Requests )... )
58
+ // TODO: handle sidecar explicitely (new kind)
59
+ clh := lh .WithValues (logging .KeyContainer , initContainer .Name , logging .KeyContainerKind , logging .KindContainerInit )
60
+ clh .V (6 ).Info ("desired resources" , stringify .ResourceListToLoggable (initContainer .Resources .Requests )... )
59
61
60
- _ , match := resourcesAvailableInAnyNUMANodes (lh , nodes , initContainer .Resources .Requests , qos , nodeInfo )
62
+ _ , match := resourcesAvailableInAnyNUMANodes (clh , nodes , initContainer .Resources .Requests , qos , nodeInfo )
61
63
if ! match {
62
64
// we can't align init container, so definitely we can't align a pod
63
- lh .V (2 ).Info ("cannot align container" , "name" , initContainer . Name , "kind" , "init " )
65
+ clh .V (2 ).Info ("cannot align container" )
64
66
return framework .NewStatus (framework .Unschedulable , "cannot align init container" )
65
67
}
66
68
}
67
69
68
70
for _ , container := range pod .Spec .Containers {
69
- // TODO: add containerName
70
- lh .V (6 ).Info ("app container resources" , stringify .ResourceListToLoggable (container .Resources .Requests )... )
71
+ clh := lh . WithValues ( logging . KeyContainer , container . Name , logging . KeyContainerKind , logging . KindContainerApp )
72
+ clh .V (6 ).Info ("app container resources" , stringify .ResourceListToLoggable (container .Resources .Requests )... )
71
73
72
- numaID , match := resourcesAvailableInAnyNUMANodes (lh , nodes , container .Resources .Requests , qos , nodeInfo )
74
+ numaID , match := resourcesAvailableInAnyNUMANodes (clh , nodes , container .Resources .Requests , qos , nodeInfo )
73
75
if ! match {
74
76
// we can't align container, so definitely we can't align a pod
75
- lh .V (2 ).Info ("cannot align container" , "name" , container . Name , "kind" , "app " )
77
+ clh .V (2 ).Info ("cannot align container" )
76
78
return framework .NewStatus (framework .Unschedulable , "cannot align container" )
77
79
}
78
80
79
81
// subtract the resources requested by the container from the given NUMA.
80
82
// this is necessary, so we won't allocate the same resources for the upcoming containers
81
- subtractFromNUMA (lh , nodes , numaID , container )
83
+ subtractFromNUMA (clh , nodes , numaID , container )
84
+ clh .V (4 ).Info ("app container placed" , "numaCell" , numaID )
82
85
}
83
- lh .V (2 ).Info ("can align all containers" )
84
86
return nil
85
87
}
86
88
@@ -150,7 +152,7 @@ func resourcesAvailableInAnyNUMANodes(lh logr.Logger, numaNodes NUMANodeList, re
150
152
151
153
// at least one NUMA node is available
152
154
ret := ! bitmask .IsEmpty ()
153
- lh .V (2 ).Info ("final verdict" , "suitable" , ret )
155
+ lh .V (2 ).Info ("final verdict" , "suitable" , ret , "numaCell" , numaID )
154
156
return numaID , ret
155
157
}
156
158
@@ -172,11 +174,12 @@ func singleNUMAPodLevelHandler(lh logr.Logger, pod *v1.Pod, zones topologyv1alph
172
174
logNumaNodes (lh , "pod handler NUMA resources" , nodeInfo .Node ().Name , nodes )
173
175
lh .V (6 ).Info ("pod desired resources" , stringify .ResourceListToLoggable (resources )... )
174
176
175
- if _ , match := resourcesAvailableInAnyNUMANodes (lh , createNUMANodeList (lh , zones ), resources , v1qos .GetPodQOS (pod ), nodeInfo ); ! match {
177
+ numaID , match := resourcesAvailableInAnyNUMANodes (lh , createNUMANodeList (lh , zones ), resources , v1qos .GetPodQOS (pod ), nodeInfo )
178
+ if ! match {
176
179
lh .V (2 ).Info ("cannot align pod" , "name" , pod .Name )
177
180
return framework .NewStatus (framework .Unschedulable , "cannot align pod" )
178
181
}
179
- lh .V (2 ).Info ("can align pod" )
182
+ lh .V (4 ).Info ("all container placed" , "numaCell" , numaID )
180
183
return nil
181
184
}
182
185
0 commit comments