-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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: Add pod name format annotation. Fixes #6962 and #6989 #6982
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6982 +/- ##
==========================================
- Coverage 48.55% 48.52% -0.04%
==========================================
Files 265 265
Lines 19329 19367 +38
==========================================
+ Hits 9386 9398 +12
- Misses 8892 8914 +22
- Partials 1051 1055 +4
Continue to review full report at Codecov.
|
@tczhao I validated that the default v2 logs are showing up properly. I have some other obligations to attend to this evening and can't validate the v1 path until tomorrow. In the meantime, are you free to review? |
Thanks @JPZ13, will take a look in my afternoon |
|
||
// setWfPodNamesAnnotation sets an annotation on a workflow with the pod naming | ||
// convention version | ||
func setWfPodNamesAnnotation(wf *wfv1.Workflow) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe need a test for this function, the rest looks good
workflow/controller/operator.go
Outdated
@@ -142,6 +142,8 @@ func newWorkflowOperationCtx(wf *wfv1.Workflow, wfc *WorkflowController) *wfOper | |||
// You can use DeepCopy() to make a deep copy of original object and modify this copy | |||
// Or create a copy manually for better performance | |||
wfCopy := wf.DeepCopyObject().(*wfv1.Workflow) | |||
setWfPodNamesAnnotation(wfCopy) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm thinking perhaps if we should annotate at pod level instead?
so that in rolling upgrade (podname v1->v2), we won't end up having a workflow that has first n pods using v1 but get annotated as v2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense. @tczhao can you help me with these two questions to clarify my mental model?:
- Does
newWorkflowOperationCtx
get invoked in the case of a rolling upgrade? If so, when and where? - Are pod annotations persisted when the workflow is archived? If so, where can I get them from?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I think
newWorkflowOperationCtx
get invoked at least every time when there's a workflow update e.g. pod finished - good point, pod annotation doesn't persist in workflow crd
I wonder if we can only add annotation for new workflow
or just accept this as a caveat
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to support rolling upgrades. In that case, workflows are either:
- Complete, not annotated - v1.
- Already running, not annotated - therefore v1.
- New (
status.pending=""
) - annotate with pod name version from config. - Already running, annotated - use annotation.
I think that means we can be confident of which format we are using.
There is a specific block of code which sets up new workflows:
https://github.com/argoproj/argo-workflows/blob/master/workflow/controller/operator.go#L264
That's the place to add the annotation.
Hi @JPZ13 , I think we need to modify this argo-workflows/ui/src/app/shared/services/workflows-service.ts Lines 192 to 207 in c5b1533
to have the live log uses podname and the archive log uses nodeId backend: this should solve #6947 |
Thanks for the heads up on that @tczhao! I'm hopefully gonna get this PR wrapped up this weekend. Can I get your eyes on it once complete? |
LGTM |
ui/package.json
Outdated
@@ -12,6 +12,7 @@ | |||
"test": "jest" | |||
}, | |||
"dependencies": { | |||
"@types/lodash": "^4.14.175", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this library has security vulns, can we avoid it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For sure!
ui/src/app/shared/pod-name.ts
Outdated
return workflowName; | ||
} | ||
|
||
let prefix = `${workflowName}-${templateName}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor - inline
ui/src/app/shared/pod-name.ts
Outdated
return node.templateName; | ||
} | ||
|
||
const name = get(node, 'templateRef.template'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor - inline
workflow/controller/operator.go
Outdated
@@ -142,6 +142,8 @@ func newWorkflowOperationCtx(wf *wfv1.Workflow, wfc *WorkflowController) *wfOper | |||
// You can use DeepCopy() to make a deep copy of original object and modify this copy | |||
// Or create a copy manually for better performance | |||
wfCopy := wf.DeepCopyObject().(*wfv1.Workflow) | |||
setWfPodNamesAnnotation(wfCopy) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want to support rolling upgrades. In that case, workflows are either:
- Complete, not annotated - v1.
- Already running, not annotated - therefore v1.
- New (
status.pending=""
) - annotate with pod name version from config. - Already running, annotated - use annotation.
I think that means we can be confident of which format we are using.
There is a specific block of code which sets up new workflows:
https://github.com/argoproj/argo-workflows/blob/master/workflow/controller/operator.go#L264
That's the place to add the annotation.
Signed-off-by: J.P. Zivalich <jp@pipekit.io> Add annotation reading to ui Signed-off-by: J.P. Zivalich <jp@pipekit.io> Refactor get annotations Signed-off-by: J.P. Zivalich <jp@pipekit.io> Fix lint error Signed-off-by: J.P. Zivalich <jp@pipekit.io> Fix template names for template refs Signed-off-by: J.P. Zivalich <jp@pipekit.io> Fix linting errors Signed-off-by: J.P. Zivalich <jp@pipekit.io> Fix live logs vs archived logs Signed-off-by: J.P. Zivalich <jp@pipekit.io> Fix failing unit test Signed-off-by: J.P. Zivalich <jp@pipekit.io> Add test Signed-off-by: J.P. Zivalich <jp@pipekit.io> Change wf marking location Signed-off-by: J.P. Zivalich <jp@pipekit.io> Update ui Signed-off-by: J.P. Zivalich <jp@pipekit.io> Remove lodash Signed-off-by: J.P. Zivalich <jp@pipekit.io>
Updated for your changes @alexec |
Signed-off-by: J.P. Zivalich <jp@pipekit.io>
workflow/util/pod_name.go
Outdated
const ( | ||
// PodNameVersion1 is the v1 name that uses node ids for pod names | ||
PodNameVersion1 PodNameVersion = "v1" | ||
// PodNameVersion2 is the v2 name that uses workflow name combined with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
um, nodeID + templateName?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor PodNameV1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see minor comments
Signed-off-by: J.P. Zivalich <jp@pipekit.io>
Signed-off-by: J.P. Zivalich jp@pipekit.io
This PR:
Fixes #6962 and #6989