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

feat: Add template node to pod name. Fixes #1319 #6712

Merged
merged 15 commits into from
Sep 15, 2021

Conversation

JPZ13
Copy link
Member

@JPZ13 JPZ13 commented Sep 12, 2021

This PR is a continuation of Alex's PoC #6647 that fixes #1319. It:

  • Sets pod names to a concatenation of the wf name, template name, and hash
  • Allows for an override of the pod name to the node id if the env USE_LEGACY_POD_NAMES is set to true
  • Stores the node id as an annotation on the pod

Sample terminal output:

$ kubectl get pods -n argo
NAME                                   READY   STATUS      RESTARTS   AGE
minio-786d5cbc44-c9ppg                 1/1     Running     7          19h
retry-test-p7jzr-whalesay-2308805457   0/2     Completed   0          13h
retry-test-p7jzr-whalesay-2378053249   0/2     Completed   0          13h

alexec and others added 7 commits September 1, 2021 11:06
Signed-off-by: Alex Collins <alex_collins@intuit.com>
Signed-off-by: J.P. Zivalich <j.p.zivalich@gmail.com>
Signed-off-by: J.P. Zivalich <j.p.zivalich@gmail.com>
Signed-off-by: J.P. Zivalich <j.p.zivalich@gmail.com>
Signed-off-by: J.P. Zivalich <j.p.zivalich@gmail.com>
Signed-off-by: J.P. Zivalich <j.p.zivalich@gmail.com>
Signed-off-by: J.P. Zivalich <j.p.zivalich@gmail.com>
@codecov
Copy link

codecov bot commented Sep 12, 2021

Codecov Report

Merging #6712 (8119b0b) into master (6d46fd9) will increase coverage by 0.10%.
The diff coverage is 42.99%.

❗ Current head 8119b0b differs from pull request most recent head a78d98b. Consider uploading reports for the commit a78d98b to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6712      +/-   ##
==========================================
+ Coverage   48.57%   48.67%   +0.10%     
==========================================
  Files         262      264       +2     
  Lines       18991    19080      +89     
==========================================
+ Hits         9224     9287      +63     
- Misses       8739     8750      +11     
- Partials     1028     1043      +15     
Impacted Files Coverage Δ
cmd/argo/commands/client/conn.go 15.09% <0.00%> (ø)
cmd/argo/commands/clustertemplate/create.go 13.72% <0.00%> (ø)
cmd/argo/commands/clustertemplate/delete.go 0.00% <0.00%> (ø)
cmd/argo/commands/clustertemplate/get.go 0.00% <0.00%> (ø)
cmd/argo/commands/clustertemplate/lint.go 0.00% <0.00%> (ø)
cmd/argo/commands/clustertemplate/list.go 0.00% <0.00%> (ø)
cmd/argo/commands/cron/create.go 0.00% <0.00%> (ø)
cmd/argo/commands/cron/delete.go 0.00% <0.00%> (ø)
cmd/argo/commands/cron/get.go 23.18% <0.00%> (ø)
cmd/argo/commands/cron/lint.go 0.00% <0.00%> (ø)
... and 58 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6d46fd9...a78d98b. Read the comment docs.

Signed-off-by: J.P. Zivalich <j.p.zivalich@gmail.com>
Signed-off-by: J.P. Zivalich <j.p.zivalich@gmail.com>
Signed-off-by: J.P. Zivalich <j.p.zivalich@gmail.com>
Signed-off-by: J.P. Zivalich <j.p.zivalich@gmail.com>
Signed-off-by: J.P. Zivalich <j.p.zivalich@gmail.com>
Signed-off-by: J.P. Zivalich <j.p.zivalich@gmail.com>
Signed-off-by: J.P. Zivalich <j.p.zivalich@gmail.com>
@JPZ13 JPZ13 marked this pull request as ready for review September 13, 2021 15:23
@@ -32,6 +32,7 @@ Note that these environment variables may be removed at any time.
| `RETRY_BACKOFF_STEPS` | `int` | `5` | The retry backoff steps when retrying API calls. |
| `RETRY_HOST_NAME_LABEL_KEY` | `string` | `kubernetes.io/hostname` | The label key for host name used when retrying templates. |
| `TRANSIENT_ERROR_PATTERN` | `string` | `""` | The regular expression that represents additional patterns for transient errors. |
| `USE_LEGACY_POD_NAMES` | `bool` | `false` | Whether to have pod names contain the template name (false) or be the node id (true). |
Copy link
Contributor

Choose a reason for hiding this comment

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

how about POD_NAMES=v1 default is v2

testNodePodExists(t, woc)
}

func testNodePodExists(t *testing.T, woc *wfOperationCtx) {
Copy link
Contributor

Choose a reason for hiding this comment

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

should be Test uppercase T

Namespace: woc.wf.ObjectMeta.Namespace,
Labels: map[string]string{
common.LabelKeyWorkflow: woc.wf.ObjectMeta.Name, // Allows filtering by pods related to specific workflow
common.LabelKeyCompleted: "false", // Allows filtering by incomplete workflow pods
},
Annotations: map[string]string{
common.AnnotationKeyNodeName: nodeName,
common.AnnotationKeyNodeID: nodeID, // TODO - test annotation is applied
Copy link
Contributor

Choose a reason for hiding this comment

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

TODO

@@ -1054,3 +1061,31 @@ func GetNodeType(tmpl *wfv1.Template) wfv1.NodeType {
}
return ""
}

// PodName return a deterministic pod name
func PodName(workflowName, nodeName, templateName, nodeID string) string {
Copy link
Contributor

Choose a reason for hiding this comment

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

please put this func into own file

@@ -839,3 +840,34 @@ func TestToUnstructured(t *testing.T) {
assert.Equal(t, workflow.Version, gv.Version)
}
}

func TestPodName(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

own file

Copy link
Contributor

@alexec alexec left a comment

Choose a reason for hiding this comment

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

some small changes

Signed-off-by: J.P. Zivalich <j.p.zivalich@gmail.com>
@alexec
Copy link
Contributor

alexec commented Sep 13, 2021

LGTM. Passing to @sarabala1979 for him to review.

@alexec
Copy link
Contributor

alexec commented Sep 15, 2021

@sarabala1979 I'm going to assume you're lack of reply means you are not able to review this. I'll merge.

@alexec alexec merged commit e5b131a into argoproj:master Sep 15, 2021
@sarabala1979 sarabala1979 mentioned this pull request Sep 28, 2021
36 tasks
alexec added a commit that referenced this pull request Oct 20, 2021
alexec added a commit that referenced this pull request Oct 20, 2021
@sarabala1979 sarabala1979 mentioned this pull request Oct 21, 2021
24 tasks
kriti-sc pushed a commit to kriti-sc/argo-workflows that referenced this pull request Oct 24, 2021
Signed-off-by: J.P. Zivalich <j.p.zivalich@gmail.com>
Signed-off-by: kriti-sc <kathuriakriti1@gmail.com>
kriti-sc pushed a commit to kriti-sc/argo-workflows that referenced this pull request Oct 24, 2021
Signed-off-by: kriti-sc <kathuriakriti1@gmail.com>
@vivekthangathurai
Copy link

I am using v3.2.8 and not seeing this behaviour.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add taskname to the workflow pod's name
3 participants