From 08c85000f44e5cd5cc639be579107a58d0ea8c5e Mon Sep 17 00:00:00 2001 From: Isitha Subasinghe Date: Tue, 14 Feb 2023 07:09:15 +1100 Subject: [PATCH] fix: use env when pod version annotation is missing. Fixes #10237 (#10457) Signed-off-by: Isitha Subasinghe Co-authored-by: Alex Collins --- workflow/util/pod_name.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/workflow/util/pod_name.go b/workflow/util/pod_name.go index d7dad3b3b09e..afab1fb06247 100644 --- a/workflow/util/pod_name.go +++ b/workflow/util/pod_name.go @@ -79,8 +79,10 @@ func ensurePodNamePrefixLength(prefix string) string { // given workflow func GetWorkflowPodNameVersion(wf *v1alpha1.Workflow) PodNameVersion { annotations := wf.GetAnnotations() - version := annotations[common.AnnotationKeyPodNameVersion] - + version, ok := annotations[common.AnnotationKeyPodNameVersion] + if !ok { + return GetPodNameVersion() + } switch version { case PodNameV1.String(): return PodNameV1