From c7d4d3a5db36327fc791627d6155a29990cba5b8 Mon Sep 17 00:00:00 2001 From: fgksgf Date: Wed, 15 Jan 2025 19:39:08 +0800 Subject: [PATCH] address comments --- pkg/utils/k8s/pod.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pkg/utils/k8s/pod.go b/pkg/utils/k8s/pod.go index 9a497c31d3..276c465d1c 100644 --- a/pkg/utils/k8s/pod.go +++ b/pkg/utils/k8s/pod.go @@ -54,7 +54,9 @@ func CalculateHashAndSetLabels(pod *corev1.Pod) { // This prevents the hash from being changed when new fields are added to the `PodSpec` due to K8s version upgrades. buf := bytes.Buffer{} - _ = podEncoder.Encode(&corev1.Pod{Spec: *spec}, &buf) + if err := podEncoder.Encode(&corev1.Pod{Spec: *spec}, &buf); err != nil { + panic(fmt.Errorf("failed to encode pod spec, %w", err)) + } hasher := fnv.New32a() hashutil.DeepHashObject(hasher, buf.Bytes())