-
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: Allow for setting default configurations for workflows, Fixes #1923, #2044 #2331
Conversation
Updated the naming and added comment
Co-Authored-By: Bot from GolangCI <42910462+golangcibot@users.noreply.github.com>
Codecov Report
@@ Coverage Diff @@
## master #2331 +/- ##
=========================================
+ Coverage 13.38% 13.4% +0.01%
=========================================
Files 70 70
Lines 24232 24254 +22
=========================================
+ Hits 3244 3251 +7
- Misses 20579 20590 +11
- Partials 409 413 +4
Continue to review full report at Codecov.
|
workflow/config/config.go
Outdated
|
||
// Workflow defaults | ||
//[TODO] fix the representation | ||
WorkflowDefaults *wfv1.WorkflowSpec `json:"workflowDefaults,omitempty"` |
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 we should call this defautWorkflowSpec
.
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 it be capital "d" to keep it consistent? DefautWorkflowSpec
Will uppdate based upon your comments! |
Working on adding more test and fixing the current issues. Hope to have it done during the weekend. |
Looks good. Did you want to add some docs for this? Maybe an example? |
It could be quite useful for this to support default exit handlers |
Where can I find more info/examples on this @mark9white ? |
We have a generic handler like this that applies to all our workflows:
Though thinking about it an alternative solution would be to have a way to provide a templateRef to onExit and just onExit would need to be provided in the default workflow configuration. |
@alexec I would be happy do to an example but I suggest to make that a separate PR. I am kind of happy with the test now. Would you like me to add some more test cases? Added some short documentation as well. |
LGTM |
@mark9white I dont really understand if this is suited here or not(because my lack of knowledge). Do you have an opinion about it @alexec ? |
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.
Very minor comments! Two minutes too late... @NikeNano Could you open a separate PR and address these?
@@ -64,6 +64,8 @@ type WorkflowControllerConfig struct { | |||
|
|||
// Config customized Docker Sock path | |||
DockerSockPath string `json:"dockerSockPath,omitempty"` | |||
|
|||
DefautWorkflowSpec *wfv1.WorkflowSpec `json:"workflowDefaults,omitempty"` |
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.
Please add a docstring above this, like the rest of the configs
// workflowController. Values in the workflow will be given the upper hand over the defaults. | ||
// The defaults for the workflow controller is set in the WorkflowController.Config.DefautWorkflowSpec | ||
func (wfc *WorkflowController) addingWorkflowDefaultValueIfValueNotExist(wf *wfv1.Workflow) error { | ||
//var workflowSpec *wfv1.WorkflowSpec = &wf.Spec |
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.
Remove this unused line?
if err != nil { | ||
return err | ||
} | ||
// https://github.com/kubernetes/apimachinery/blob/2373d029717c4d169463414a6127cd1d0d12680e/pkg/util/strategicpatch/patch.go#L94 |
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.
Link to the docs directly? https://godoc.org/k8s.io/apimachinery/pkg/util/strategicpatch#StrategicMergePatch
This is a work in progress but would be happy for some initial feedback.
This is a bug fix for issue which is also discussed here. This PR aims to allow for having default values set for workflows. Which would allow for easier configurations of Arog workflows and also help for admin of jobs.
This is implemented after suggestions from @zhujl1991