mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 20:24:09 +00:00
Adding more detailed logging for Topology Hints
This commit is contained in:
parent
295a8c1371
commit
f24d917d3c
@ -543,6 +543,7 @@ func (c *Controller) checkNodeTopologyDistribution() {
|
|||||||
c.topologyCache.SetNodes(nodes)
|
c.topologyCache.SetNodes(nodes)
|
||||||
serviceKeys := c.topologyCache.GetOverloadedServices()
|
serviceKeys := c.topologyCache.GetOverloadedServices()
|
||||||
for _, serviceKey := range serviceKeys {
|
for _, serviceKey := range serviceKeys {
|
||||||
|
klog.V(2).Infof("Queuing %s Service after Node change due to overloading", serviceKey)
|
||||||
c.queue.Add(serviceKey)
|
c.queue.Add(serviceKey)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ import (
|
|||||||
"math"
|
"math"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"k8s.io/api/core/v1"
|
v1 "k8s.io/api/core/v1"
|
||||||
discovery "k8s.io/api/discovery/v1"
|
discovery "k8s.io/api/discovery/v1"
|
||||||
"k8s.io/apimachinery/pkg/api/resource"
|
"k8s.io/apimachinery/pkg/api/resource"
|
||||||
"k8s.io/klog/v2"
|
"k8s.io/klog/v2"
|
||||||
@ -132,6 +132,7 @@ func (t *TopologyCache) AddHints(si *SliceInfo) ([]*discovery.EndpointSlice, []*
|
|||||||
// cache.
|
// cache.
|
||||||
func (t *TopologyCache) SetHints(serviceKey string, addrType discovery.AddressType, allocatedHintsByZone EndpointZoneInfo) {
|
func (t *TopologyCache) SetHints(serviceKey string, addrType discovery.AddressType, allocatedHintsByZone EndpointZoneInfo) {
|
||||||
if len(allocatedHintsByZone) == 0 {
|
if len(allocatedHintsByZone) == 0 {
|
||||||
|
klog.V(2).Infof("No hints allocated for zones, removing them from %s EndpointSlices for %s Service", addrType, serviceKey)
|
||||||
t.RemoveHints(serviceKey, addrType)
|
t.RemoveHints(serviceKey, addrType)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -184,6 +185,7 @@ func (t *TopologyCache) SetNodes(nodes []*v1.Node) {
|
|||||||
if !ok || zone == "" || nodeCPU.IsZero() {
|
if !ok || zone == "" || nodeCPU.IsZero() {
|
||||||
cpuByZone = map[string]*resource.Quantity{}
|
cpuByZone = map[string]*resource.Quantity{}
|
||||||
sufficientNodeInfo = false
|
sufficientNodeInfo = false
|
||||||
|
klog.Warningf("Can't get CPU or zone information for %s node", node.Name)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -199,6 +201,7 @@ func (t *TopologyCache) SetNodes(nodes []*v1.Node) {
|
|||||||
defer t.lock.Unlock()
|
defer t.lock.Unlock()
|
||||||
|
|
||||||
if totalCPU.IsZero() || !sufficientNodeInfo || len(cpuByZone) < 2 {
|
if totalCPU.IsZero() || !sufficientNodeInfo || len(cpuByZone) < 2 {
|
||||||
|
klog.V(2).Infof("Insufficient node info for topology hints (%d zones, %s CPU, %t)", len(cpuByZone), totalCPU.MilliValue(), sufficientNodeInfo)
|
||||||
t.sufficientNodeInfo = false
|
t.sufficientNodeInfo = false
|
||||||
t.cpuByZone = nil
|
t.cpuByZone = nil
|
||||||
t.cpuRatiosByZone = nil
|
t.cpuRatiosByZone = nil
|
||||||
@ -219,6 +222,7 @@ func (t *TopologyCache) SetNodes(nodes []*v1.Node) {
|
|||||||
// threshold, a nil value will be returned.
|
// threshold, a nil value will be returned.
|
||||||
func (t *TopologyCache) getAllocations(numEndpoints int) map[string]Allocation {
|
func (t *TopologyCache) getAllocations(numEndpoints int) map[string]Allocation {
|
||||||
if t.cpuRatiosByZone == nil || len(t.cpuRatiosByZone) < 2 || len(t.cpuRatiosByZone) > numEndpoints {
|
if t.cpuRatiosByZone == nil || len(t.cpuRatiosByZone) < 2 || len(t.cpuRatiosByZone) > numEndpoints {
|
||||||
|
klog.V(2).Infof("Insufficient info to allocate endpoints (%d endpoints, %d zones)", numEndpoints, len(t.cpuRatiosByZone))
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user