Avoid panic during startup with 1.10.2 (#26219)

* fix: initalize the topology of teh processors to avoid nil pointers

* func: initialize topology to avoid nil pointers

* fix: update the new public method for NodeProcessorResources
This commit is contained in:
Juana De La Cuesta
2025-07-08 16:07:14 +02:00
committed by GitHub
parent e13ceab855
commit 3b44090156
6 changed files with 17 additions and 4 deletions

View File

@@ -1569,6 +1569,12 @@ func (c *Client) setupNode() error {
node.NodeResources.MinDynamicPort = newConfig.MinDynamicPort
node.NodeResources.MaxDynamicPort = newConfig.MaxDynamicPort
node.NodeResources.Processors = newConfig.Node.NodeResources.Processors
if node.NodeResources.Processors.Empty() {
node.NodeResources.Processors = structs.NodeProcessorResources{
Topology: &numalib.Topology{},
}
}
}
if node.ReservedResources == nil {
node.ReservedResources = &structs.NodeReservedResources{}

View File

@@ -18,7 +18,7 @@ type SystemScanner interface {
// a single Topology, which can then be used to answer questions about the CPU
// topology of the system.
func Scan(scanners []SystemScanner) *Topology {
top := new(Topology)
top := &Topology{}
for _, scanner := range scanners {
scanner.ScanSystem(top)
}