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

Extract part of logic from PlanExecutionController into function #608

Merged
merged 5 commits into from
Jul 23, 2019

Conversation

alenkacz
Copy link
Contributor

95% of this is just code moved around, I did not change any behavior nor did I intend to do so. My goal is to break down the current huge controller into smaller pieces with names and descriptions so that we can iteratively refactor this while adding tests.

The part I extracted in this PR is a big porting of code that was just taking plan definition from operator version and populating fields in PlanExecution before actually executing the plan.

Copy link
Member

@kensipe kensipe left a comment

Choose a reason for hiding this comment

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

generally I like this refactor... there's a nit I would like to have resolved but isn't a blocker.

}

// populatePlanExecutionFromActivePlanDefinition reads content of the Plan defined in operator version and populates PlanExecution with data from rendered templates
func populatePlanExecutionFromActivePlanDefinition(activePlan kudov1alpha1.Plan, planExecution *kudov1alpha1.PlanExecution, instance *kudov1alpha1.Instance, operatorVersion *kudov1alpha1.OperatorVersion, recorder record.EventRecorder) error {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
func populatePlanExecutionFromActivePlanDefinition(activePlan kudov1alpha1.Plan, planExecution *kudov1alpha1.PlanExecution, instance *kudov1alpha1.Instance, operatorVersion *kudov1alpha1.OperatorVersion, recorder record.EventRecorder) error {
func populatePlanExecution(plan kudov1alpha1.Plan, pe *kudov1alpha1.PlanExecution, instance *kudov1alpha1.Instance, ov *kudov1alpha1.OperatorVersion, recorder record.EventRecorder) error {

Do we plan to populate from another source? can the source be one of the params? this function name seems too long... also this line of code is 243 chars long...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

okay! makes sense

@alenkacz alenkacz merged commit 22d619c into master Jul 23, 2019
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.

3 participants