From 4662c9fc7ea9568568bb8112606f90e6892f902c Mon Sep 17 00:00:00 2001 From: Yash Mehrotra Date: Wed, 23 Oct 2024 08:58:59 +0530 Subject: [PATCH] fix(kubernetes-resource): handle default display template error in case of timeout --- checks/kubernetes_resource.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/checks/kubernetes_resource.go b/checks/kubernetes_resource.go index a807cabb8..b05398471 100644 --- a/checks/kubernetes_resource.go +++ b/checks/kubernetes_resource.go @@ -152,6 +152,12 @@ func (c *KubernetesResourceChecker) Check(ctx context.Context, check v1.Kubernet backoff = retry.WithMaxDuration(maxRetryTimeout, backoff) } + // We do this before virtual check run in case the check times out + // and returns an err, the default templating requires 'display' in env + result.AddData(map[string]any{ + "display": make(map[string]any), + }) + retryErr := retry.Do(ctx, backoff, func(_ctx gocontext.Context) error { ctx.Logger.V(4).Infof("running check: %s", virtualCanary.Name)