mirror of
https://github.com/kubernetes-sigs/node-feature-discovery.git
synced 2024-12-14 11:57:51 +00:00
Merge pull request #633 from we4tech/fix/topologyupdater-backtrace
topologyupdater: logs relevant message when feature-gate is disabled.
This commit is contained in:
commit
5a193fd15a
3 changed files with 12 additions and 8 deletions
|
@ -60,7 +60,7 @@ func main() {
|
|||
|
||||
klConfig, err := kubeconf.GetKubeletConfigFromLocalFile(resourcemonitorArgs.KubeletConfigFile)
|
||||
if err != nil {
|
||||
klog.Fatalf("error reading kubelet config: %v", err)
|
||||
klog.Exitf("error reading kubelet config: %v", err)
|
||||
}
|
||||
tmPolicy := string(topologypolicy.DetectTopologyPolicy(klConfig.TopologyManagerPolicy, klConfig.TopologyManagerScope))
|
||||
klog.Infof("detected kubelet Topology Manager policy %q", tmPolicy)
|
||||
|
|
|
@ -88,8 +88,7 @@ func (w *nfdTopologyUpdater) Run() error {
|
|||
|
||||
podResClient, err := podres.GetPodResClient(w.resourcemonitorArgs.PodResourceSocketPath)
|
||||
if err != nil {
|
||||
klog.Fatalf("failed to get PodResource Client: %w", err)
|
||||
return err
|
||||
return fmt.Errorf("failed to get PodResource Client: %w", err)
|
||||
}
|
||||
|
||||
kubeApihelper := apihelper.K8sHelpers{Kubeconfig: w.args.KubeConfigFile}
|
||||
|
@ -97,8 +96,7 @@ func (w *nfdTopologyUpdater) Run() error {
|
|||
|
||||
resScan, err = resourcemonitor.NewPodResourcesScanner(w.resourcemonitorArgs.Namespace, podResClient, kubeApihelper)
|
||||
if err != nil {
|
||||
klog.Fatalf("failed to initialize ResourceMonitor instance: %w", err)
|
||||
return err
|
||||
return fmt.Errorf("failed to initialize ResourceMonitor instance: %w", err)
|
||||
}
|
||||
|
||||
// CAUTION: these resources are expected to change rarely - if ever.
|
||||
|
@ -109,8 +107,7 @@ func (w *nfdTopologyUpdater) Run() error {
|
|||
|
||||
resAggr, err := resourcemonitor.NewResourcesAggregator(podResClient)
|
||||
if err != nil {
|
||||
klog.Fatalf("failed to obtain node resource information: %w", err)
|
||||
return err
|
||||
return fmt.Errorf("failed to obtain node resource information: %w", err)
|
||||
}
|
||||
|
||||
klog.V(2).Infof("resAggr is: %v\n", resAggr)
|
||||
|
|
|
@ -75,7 +75,14 @@ func NewResourcesAggregator(podResourceClient podresourcesapi.PodResourcesLister
|
|||
// Pod Resource API client
|
||||
resp, err := podResourceClient.GetAllocatableResources(ctx, &podresourcesapi.AllocatableResourcesRequest{})
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("can't receive response: %v.Get(_) = _, %w", podResourceClient, err)
|
||||
if strings.Contains(err.Error(), "API GetAllocatableResources disabled") {
|
||||
klog.Error("Kubelet's pod resources 'GetAllocatableResources' functionality is disabled. " +
|
||||
"Ensure feature flag 'KubeletPodResourcesGetAllocatable' is set to true. " +
|
||||
"You can find more about the feature gates from the following URL - " +
|
||||
"https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/")
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("failed to get allocatable resources (ensure that KubeletPodResourcesGetAllocatable feature gate is enabled): %w", err)
|
||||
}
|
||||
|
||||
return NewResourcesAggregatorFromData(topo, resp, memoryResourcesCapacityPerNUMA), nil
|
||||
|
|
Loading…
Reference in a new issue