Skip to content

Commit

Permalink
fix: Incorrect pod name for inline templates. Fixes #10912 (#10921)
Browse files Browse the repository at this point in the history
Signed-off-by: Yuan Tang <terrytangyuan@gmail.com>
  • Loading branch information
terrytangyuan authored Apr 18, 2023
1 parent c6862e9 commit 9d28a02
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion workflow/util/pod_name.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"hash/fnv"
"os"
"strings"

"github.com/argoproj/argo-workflows/v3/pkg/apis/workflow/v1alpha1"
"github.com/argoproj/argo-workflows/v3/workflow/common"
Expand Down Expand Up @@ -55,7 +56,10 @@ func GeneratePodName(workflowName, nodeName, templateName, nodeID string, versio
return workflowName
}

prefix := fmt.Sprintf("%s-%s", workflowName, templateName)
prefix := workflowName
if !strings.Contains(nodeName, ".inline") {
prefix = fmt.Sprintf("%s-%s", workflowName, templateName)
}
prefix = ensurePodNamePrefixLength(prefix)

h := fnv.New32a()
Expand Down
4 changes: 4 additions & 0 deletions workflow/util/pod_name_v2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,8 @@ func TestPodNameV2(t *testing.T) {
name = GeneratePodName(longWfName, nodeName, longTemplateName, nodeID, PodNameV2)
assert.Equal(t, expectedPodName, name)

h = fnv.New32a()
_, _ = h.Write([]byte("stp.inline"))
name = GeneratePodName(shortWfName, "stp.inline", longTemplateName, nodeID, PodNameV2)
assert.Equal(t, fmt.Sprintf("wfname-%v", h.Sum32()), name)
}

0 comments on commit 9d28a02

Please sign in to comment.