From faa65014cc136a8447b1c7dd19511d9c9ca777cf Mon Sep 17 00:00:00 2001 From: chenk Date: Mon, 15 Apr 2024 13:38:22 +0300 Subject: [PATCH] fix: better error handling for node config api data (#107) Signed-off-by: chenk --- pkg/collector/collect.go | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/pkg/collector/collect.go b/pkg/collector/collect.go index d4a59c5..a118faf 100644 --- a/pkg/collector/collect.go +++ b/pkg/collector/collect.go @@ -89,14 +89,14 @@ func CollectData(cmd *cobra.Command, target string) error { } nodeName := cmd.Flag("node").Value.String() nodeConfig, err := loadNodeConfig(ctx, *cluster, nodeName) - if err != nil { - return err - } - configVal, err := getValuesFromkubeletConfig(nodeConfig) - if err != nil { - return err + if err == nil { + + configVal, err := getValuesFromkubeletConfig(nodeConfig) + if err != nil { + return err + } + mergeConfigValues(nodeInfo, configVal) } - mergeConfigValues(nodeInfo, configVal) nodeData := Node{ APIVersion: Version, Kind: Kind,