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: Enhanced Different TTLSecondsAfterFinished depending on if job is in Succeeded, Failed or Error, Fixes #1883

Merged
merged 22 commits into from
Jan 7, 2020

Conversation

NikeNano
Copy link
Contributor

Checklist:

I've created an enhancement proposal and discussed it with the community.

Comment: This PR is note done but I have added it in order to get some more specific feedback and discuss the implementation.

@claassistantio
Copy link

claassistantio commented Dec 20, 2019

CLA assistant check
All committers have signed the CLA.

@NikeNano NikeNano changed the title Different TTLSecondsAfterFinished depending on if job is in Succeeded, Failed or Error, Fixes #1827 feat: Enhanced Different TTLSecondsAfterFinished depending on if job is in Succeeded, Failed or Error, Fixes Dec 20, 2019
@NikeNano NikeNano changed the title feat: Enhanced Different TTLSecondsAfterFinished depending on if job is in Succeeded, Failed or Error, Fixes [feat: Enhanced Different TTLSecondsAfterFinished depending on if job is in Succeeded, Failed or Error, Fixes ](https://github.com/argoproj/argo/issues/1827) Dec 20, 2019
@NikeNano NikeNano changed the title [feat: Enhanced Different TTLSecondsAfterFinished depending on if job is in Succeeded, Failed or Error, Fixes ](https://github.com/argoproj/argo/issues/1827) [conventional](https://github.com/argoproj/argo/issues/1827) Dec 20, 2019
@NikeNano NikeNano changed the title [conventional](https://github.com/argoproj/argo/issues/1827) "fix(controller): Updates such and such. Fixes #1827" Dec 20, 2019
@NikeNano NikeNano changed the title "fix(controller): Updates such and such. Fixes #1827" fix(controller): Updates such and such. Fixes #1827 Dec 20, 2019
@NikeNano NikeNano changed the title fix(controller): Updates such and such. Fixes #1827 feat: Enhanced Different TTLSecondsAfterFinished depending on if job is in Succeeded, Failed or Error, Fixes Dec 20, 2019
@NikeNano
Copy link
Contributor Author

Hi @sarabala1979 I have now made an initial PR with the workflow spec setup. I would be great if you could give some initial feedback.

Thoughts:

  • I decided to leave TTLSecondsAfterFinished and added TTLStragety as :
type TTLStrategy struct {
	SecondsAfterSuccess *int32 `json:"SecondsAfterSuccess:,omitempty" protobuf:"bytes,18,opt,name=SecondsAfterSuccess:"`
	SecondsAfterFailed  *int32 `json:"SecondsAfterFailed,omitempty" protobuf:"bytes,18,opt,name=SecondsAfterFailed"`
} 

My thought was that now there is now no change to the current design of TTLSecondsAfterFinished which should improve backward compatibility.

  • I also added so that priority is given for SecondsAfterSuccess and SecondsAfterFailed. I updated with tests as well.

Concerning the configmap for the controller. I have started to look for it, is it correct that what you mean by configmap for the controller is (this)[https://github.com/argoproj/argo/blob/ce78227abe5a3c901e5b7a7dd823fb2551dff584/workflow/config/config.go#L10].

If so how do you think is the base way to pass the information from the configmap object to the ttlcontroller? Atm as I understand the configmap is not passed to the ttlcontroller.

Thanks for the feedback!

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.

Thanks for your PR @NikeNano! A couple of changes needed.

Also, I would suggest including TTLStrategy.SecondsAfterCompleted to replace TTLSecondsAfterFinished. This way, we can mark TTLSecondsAfterFinished as deprecated. To allow for backwards compatibility, we can automatically convert TTLSecondsAfterFinished to TTLStrategy.SecondsAfterCompleted during Workflow creation and provide a warning that it is being deprecated.

Thoughts on this? @sarabala1979 @alexec

pkg/apis/workflow/v1alpha1/workflow_types.go Outdated Show resolved Hide resolved
pkg/apis/workflow/v1alpha1/workflow_types.go Outdated Show resolved Hide resolved
pkg/apis/workflow/v1alpha1/workflow_types.go Outdated Show resolved Hide resolved
workflow/ttlcontroller/ttlcontroller.go Outdated Show resolved Hide resolved
pkg/apis/workflow/v1alpha1/workflow_types.go Outdated Show resolved Hide resolved
workflow/ttlcontroller/ttlcontroller.go Outdated Show resolved Hide resolved
@NikeNano
Copy link
Contributor Author

Thanks for the feedback @simster7 I Will update based upon your suggestions :)

Applied the suggestions from review.

Co-Authored-By: Simon Behar <simbeh7@gmail.com>
@NikeNano NikeNano closed this Dec 23, 2019
@NikeNano NikeNano reopened this Dec 23, 2019
@NikeNano
Copy link
Contributor Author

NikeNano commented Dec 23, 2019

FYI closed this by mistake, thus reopened it!

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.

Hi @NikeNano, thanks for the chagnes. There are two comments from the previous review that are still unresolved

pkg/apis/workflow/v1alpha1/workflow_types.go Outdated Show resolved Hide resolved
pkg/apis/workflow/v1alpha1/workflow_types.go Show resolved Hide resolved
@NikeNano
Copy link
Contributor Author

@simster7 I will fix it, havn't had time to look at it during Christmas:) Where in the code base is the workflow creation? I have looked around in the operation file but not really sure where the changes are needed in order to automatically convert TTLSecondsAfterFinished to TTLStrategy.SecondsAfterCompleted during Workflow creation?

Hope you had a great Christamas!

@NikeNano
Copy link
Contributor Author

NikeNano commented Jan 2, 2020

@simster7 I have now updated and the tests pass locally. However I have some issues understanding how to read the tests from the github action. The "default" gets me to a argo UI where I cant load the results. The Build error gives "No configuration was found in your project. "

@alexec
Copy link
Contributor

alexec commented Jan 2, 2020

You should be able to fix build we’re by syncing with master.

@alexec
Copy link
Contributor

alexec commented Jan 2, 2020

The other error maybe a test failure. Run “make test” to check.

@NikeNano
Copy link
Contributor Author

NikeNano commented Jan 2, 2020

The other error maybe a test failure. Run “make test” to check.

Thanks! I assume you mean locally :) Running it and checking

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.

Last change, otherwise LGTM!

pkg/apis/workflow/v1alpha1/workflow_types.go Show resolved Hide resolved
@NikeNano
Copy link
Contributor Author

NikeNano commented Jan 4, 2020

Last change, otherwise LGTM!

I updated with the tag

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.

Almost there! Some new changes are needed based on your last few commits.

Also you will need to update examples/gc-ttl.yaml to reflect these changes. Please make a note there of all the possible options in TTLStrategy

// Optional duration in seconds relative to the workflow start time which the workflow is
// allowed to run before the controller terminates the workflow. A value of zero is used to
// terminate a Running workflow
ActiveDeadlineSeconds *int64 `json:"activeDeadlineSeconds,omitempty" protobuf:"bytes,19,opt,name=activeDeadlineSeconds"`
ActiveDeadlineSeconds *int64 `json:"activeDeadlineSeconds,omitempty" protobuf:"bytes,20,opt,name=activeDeadlineSeconds"`
Copy link
Member

Choose a reason for hiding this comment

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

The protobuf index numbers are not supposed to change when being updated.

Updating A Message Type
If an existing message type no longer meets all your needs – for example, you'd like the message format to have an extra field – but you'd still like to use code created with the old format, don't worry! It's very simple to update message types without breaking any of your existing code. Just remember the following rules:

  • Don't change the field numbers for any existing fields.

Source

Please revert all of the field number changes to what they were and just change the one for ttlStrategy to the current max + 1 (I think it should be 30). It's okay if the definition is out of order.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ahh ok, will fix that!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated now, I might be wrong but I think is should be 28, based on that this is that last entry in

type WorkflowSpec struct {

https://github.com/argoproj/argo/blob/94449876f4a571ab279802d5ca4d5e938ca3d44d/pkg/apis/workflow/v1alpha1/workflow_types.go#L237 I am new to go and protobuff so not sure though :) Also thanks for all the feedback!

pkg/apis/workflow/v1alpha1/workflow_types.go Outdated Show resolved Hide resolved
pkg/apis/workflow/v1alpha1/workflow_types.go Outdated Show resolved Hide resolved
pkg/apis/workflow/v1alpha1/workflow_types.go Outdated Show resolved Hide resolved
Copy link
Contributor Author

@NikeNano NikeNano left a comment

Choose a reason for hiding this comment

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

Removed trailing ":" which will break the unmarshalling, updated after feeback.

Copy link
Contributor Author

@NikeNano NikeNano left a comment

Choose a reason for hiding this comment

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

Updated to remove trailing ":" after feedback. Will break the unmarshalling

@codecov
Copy link

codecov bot commented Jan 7, 2020

Codecov Report

❗ No coverage uploaded for pull request base (master@2b9f50e). Click here to learn what that means.
The diff coverage is 13.57%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #1883   +/-   ##
=========================================
  Coverage          ?   11.12%           
=========================================
  Files             ?       35           
  Lines             ?    23793           
  Branches          ?        0           
=========================================
  Hits              ?     2647           
  Misses            ?    20809           
  Partials          ?      337
Impacted Files Coverage Δ
pkg/apis/workflow/v1alpha1/openapi_generated.go 0% <0%> (ø)
workflow/controller/config_controller.go 12.26% <0%> (ø)
...kg/apis/workflow/v1alpha1/zz_generated.deepcopy.go 0% <0%> (ø)
pkg/apis/workflow/v1alpha1/generated.pb.go 0.45% <0.91%> (ø)
workflow/config/config.go 100% <100%> (ø)
workflow/controller/dag.go 50.8% <100%> (ø)
workflow/common/placeholder.go 100% <100%> (ø)
pkg/apis/workflow/v1alpha1/workflow_types.go 2.42% <100%> (ø)
workflow/controller/workflowpod.go 72.67% <100%> (ø)
workflow/controller/operator.go 56.4% <51.61%> (ø)
... and 1 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 2b9f50e...e78dc26. Read the comment docs.

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.

Thanks for all your work @NikeNano!

@simster7 simster7 merged commit de3ffd7 into argoproj:master Jan 7, 2020
@NikeNano
Copy link
Contributor Author

NikeNano commented Jan 8, 2020

Thanks for all your work @NikeNano!

Awesome! Thanks for all the help as well @simster7!

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.

4 participants