Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: argument of PodName function (fixes #7315) #7316

Merged
merged 3 commits into from
Dec 8, 2021

Conversation

mikutas
Copy link
Contributor

@mikutas mikutas commented Dec 1, 2021

node has TemplateRef.Template field rather than TemplateName field

fixes #7315

Signed-off-by: mikutas 23391543+mikutas@users.noreply.github.com

Don't bother creating a PR until you've done this:

  • Run make pre-commit -B to fix codegen, lint, and commit message problems.

Create your PR as a draft.

  • Your PR needs to pass the required checks before it can be approved. If the check is not required (e.g. E2E tests) it
    does not need to pass.
  • Once required tests have passed, you can make it "Ready for review".
  • Say how how you tested your changes. If you changed the UI, attach screenshots.

Tips:

  • If changes were requested, and you've made them, then dismiss the review to get it looked at again.
  • Add you organization to USERS.md if you like.
  • You can ask for help!

@mikutas mikutas marked this pull request as draft December 1, 2021 11:12
node has TemplateRef.Template field rather than TemplateName field
if using WorkflowTemplate

Signed-off-by: mikutas <23391543+mikutas@users.noreply.github.com>
@mikutas mikutas marked this pull request as ready for review December 1, 2021 11:42
Copy link
Member

@simster7 simster7 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs tests

@@ -814,7 +814,13 @@ func retryWorkflow(ctx context.Context, kubeClient kubernetes.Interface, hydrato
return nil, errors.InternalErrorf("Workflow cannot be retried with node %s in %s phase", node.Name, node.Phase)
}
if node.Type == wfv1.NodeTypePod {
podName := PodName(wf.Name, node.Name, node.TemplateName, node.ID)
var templateName string
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see similar code here, but the template name format is different in the case of TemplateRef. Are we sure this is correct?

templateName := ""
if node.TemplateRef != nil {
templateName = fmt.Sprintf("%s/%s", node.TemplateRef.Name, node.TemplateRef.Template)
} else if node.TemplateName != "" {
templateName = node.TemplateName
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v2 pod name doesn't contain WorkflowTemplate's name (=TemplateRef.name).

image

It consists of [workflow name]-[template name]-[hash] .


Workflow
image

WorkflowTemplates
image

each full manifest is in #7315

Copy link
Member

@JPZ13 JPZ13 Dec 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @mikutas - I'd recommend using a utility function for getting the template name like: https://github.com/argoproj/argo-workflows/blob/master/ui/src/app/shared/pod-name.ts#L49

That utility function could use a test though. Feel free to add one in this PR

address review feedback

Signed-off-by: mikutas <23391543+mikutas@users.noreply.github.com>
} else {
templateName = node.TemplateName
}
podName := PodName(wf.Name, node.Name, templateName, node.ID)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could do with a test.

@alexec
Copy link
Contributor

alexec commented Dec 1, 2021

@JPZ13 could I ask you to own the review?

@JPZ13
Copy link
Member

JPZ13 commented Dec 1, 2021

@alexec Happy to. I'll give it a look this afternoon. Thanks for finding the bug and turning around a fix @mikutas

@simster7 simster7 dismissed their stale review December 1, 2021 22:33

In favor of @JPZ13's review

Signed-off-by: mikutas <23391543+mikutas@users.noreply.github.com>
@@ -866,6 +867,13 @@ func retryWorkflow(ctx context.Context, kubeClient kubernetes.Interface, hydrato
return wfClient.Update(ctx, newWF, metav1.UpdateOptions{})
}

func getTemplateFromNode(node wfv1.NodeStatus) string {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Could you add a test? In the meantime, I'll run it locally to test it out

@JPZ13
Copy link
Member

JPZ13 commented Dec 2, 2021

I've confirmed this fix works when running locally. I'll approve once there's a unit test for getTemplateFromNode

Copy link
Member

@JPZ13 JPZ13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

@mikutas mikutas requested a review from alexec December 7, 2021 00:08
@alexec
Copy link
Contributor

alexec commented Dec 8, 2021

This will need back porting to v3.2

@alexec alexec merged commit 8bd7f39 into argoproj:master Dec 8, 2021
@sarabala1979 sarabala1979 mentioned this pull request Dec 15, 2021
73 tasks
sarabala1979 pushed a commit that referenced this pull request Dec 15, 2021
Signed-off-by: mikutas <23391543+mikutas@users.noreply.github.com>
@sarabala1979 sarabala1979 mentioned this pull request Mar 1, 2022
@mikutas mikutas deleted the fix_podname_input branch September 18, 2023 02:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants