-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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(cli): Add cost optimization nudges for Argo CLI #5168
Conversation
5e20696
to
50bb8af
Compare
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.
Great! Thanks for submitting this. This looks great so far. Two things:
- Users should be able to turn off nudges. I now see that our CLI does not store any state anywhere. Not sure that we would want to add a CLI config/data store (e.g. in
~/.argo/config
) just for this, but that is a possibility. Do you have any other ideas for this? - We have another nudge in our UI:
argo-workflows/ui/src/app/workflows/components/workflow-details/workflow-details.tsx
Lines 121 to 123 in 4b78a7e
if (!execSpec(workflow).securityContext) { return <SecurityNudge>This workflow does not have security context set. It maybe possible to set this to run it more securely.</SecurityNudge>; }
Could we add that as well?
util/printer/workflow-printer.go
Outdated
completed, incomplete := countCompletedWorkflows(wfList) | ||
if completed > 100 || incomplete > 100 { | ||
_, _ = fmt.Fprint(w, "\n") | ||
fmt.Fprintf(w, "You have at least ") |
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.
Should this also disregard returned values for consistency?
fmt.Fprintf(w, "You have at least ") | |
_, _ = fmt.Fprintf(w, "You have at least ") |
Thanks for the review @simster7!
I'm happy to implement this. However, a config data store feels like an overkill for this nudges use case unless we have other use cases that can benefit from it as well. Another option is that we can add a Let me know what you think. Thanks! |
fa3e497
to
7a67690
Compare
Signed-off-by: Peixuan Ding <dingpeixuan911@gmail.com>
Signed-off-by: Peixuan Ding <dingpeixuan911@gmail.com>
Signed-off-by: Peixuan Ding <dingpeixuan911@gmail.com>
Signed-off-by: Peixuan Ding <dingpeixuan911@gmail.com>
7a67690
to
c610490
Compare
Hi @simster7, Thanks for the review! I made some changes based on your feedback.
Let me know your thoughts. Thanks! |
Signed-off-by: Peixuan Ding <dingpeixuan911@gmail.com>
510a373
to
6cfa596
Compare
Signed-off-by: Peixuan Ding <dingpeixuan911@gmail.com>
519b8bd
to
0827ccc
Compare
My thoughts on this:
|
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 LGTM, I'd like @alexec to also take a look since he wrote the initial nudges
I think security nudges are already implemented.
Exec spec is only generated and kept in the controller... this is all CLI code |
util/printer/workflow-printer.go
Outdated
_, _ = fmt.Fprintf(w, "%d completed ", completed) | ||
} | ||
_, _ = fmt.Fprint(w, "workflows. Reducing the total number of workflows will reduce your costs.\n") | ||
_, _ = fmt.Fprint(w, "Learn more at https://argoproj.github.io/argo-workflows/cost-optimisation/\n") |
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.
can we move the security nudge code here please?
util/printer/workflow-printer.go
Outdated
if completed > 100 { | ||
_, _ = fmt.Fprintf(w, "%d completed ", completed) | ||
} | ||
_, _ = fmt.Fprint(w, "workflows. Reducing the total number of workflows will reduce your costs.\n") |
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 - could you use Fprintln
?
… pkg Signed-off-by: Peixuan Ding <dingpeixuan911@gmail.com>
fa8c644
to
983c51e
Compare
Hi guys, this one closes #4548
Demo:
This is my first contribution to Argo. Would❤️ to hear some feedback. Thanks!
Checklist: