From 42c71b1e7e289d6458127c1c7cd2536052d4c85a Mon Sep 17 00:00:00 2001 From: Zach Hammer Date: Mon, 8 Jan 2024 14:27:31 -0500 Subject: [PATCH] add workaround for yaml bug unmarshalling int to interface Signed-off-by: Zach Hammer --- controller/cache/info.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/controller/cache/info.go b/controller/cache/info.go index 56a455c7894d6..ba221432008a4 100644 --- a/controller/cache/info.go +++ b/controller/cache/info.go @@ -106,9 +106,10 @@ func populateServiceInfo(un *unstructured.Unstructured, res *ResourceInfo) { } func populateReplicaSetInfo(un *unstructured.Unstructured, res *ResourceInfo) { - replicas, ok, err := unstructured.NestedInt64(un.Object, "spec", "replicas") + // due to https://github.com/kubernetes-sigs/yaml/issues/45, replicas is parsed as a float + replicas, ok, err := unstructured.NestedFloat64(un.Object, "spec", "replicas") if err == nil && ok { - res.Info = append(res.Info, v1alpha1.InfoItem{Name: "Replicas", Value: fmt.Sprintf("Replicas:%d", replicas)}) + res.Info = append(res.Info, v1alpha1.InfoItem{Name: "Replicas", Value: fmt.Sprintf("Replicas:%d", int(replicas))}) } }