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

Fix comparing parameter values on Instance Spec updates #348

Merged
merged 1 commit into from
Jun 19, 2019

Conversation

zen-dog
Copy link
Contributor

@zen-dog zen-dog commented Jun 18, 2019

Summary:
previously we would only recognize Instance Spec parameter updates and fail to detect an update if a parameter would be added or removed. This is fixed now.

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line:

/component generator
/component kudoctl
/component operator
/kind api-change

/kind bug

/kind cleanup
/kind design
/kind documentation
/kind feature
/kind enhancement
/kind infrastructure
/kind kep

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #216

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Previously we would only recognize Instance Spec parameter updates and fail to detect an update if a parameter would be added or removed. This is fixed now.

Summary:
previously we would only recognize Instance Spec parameter updates and fail to detect an update if a parameter would be added or removed. This is fixed now.

Issue: #216
planName = param.Trigger
ok = true
}
for k := range parameterDifference(old.Spec.Parameters, new.Spec.Parameters) {
Copy link
Member

Choose a reason for hiding this comment

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

Will this run 2 PlanExecutions if we change 2 different parameters?n . I think that might be problematic.

Copy link
Contributor Author

@zen-dog zen-dog Jun 18, 2019

Choose a reason for hiding this comment

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

Yep, this is what I wanted to discuss in this PR. Keep in mind that this part of the logic hasn't changed so we have this problem with current master. Actually, there are two questions:

  1. If the user removes a parameter, do we still trigger the original param.Trigger plan? Do we trigger anything?
  2. With multiple changes, multiple plans might be triggered - do we take first/last/random or do we forbid such changes?

Thoughts? /cc @gerred

Copy link
Contributor

Choose a reason for hiding this comment

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

I think always one plan is triggered, but which one is it is decided by the last parameter change :/

Copy link
Member

Choose a reason for hiding this comment

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

I need to think about this, I'll weigh in today.

Copy link
Member

Choose a reason for hiding this comment

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

Keep in mind that this part of the logic hasn't changed

You're right, currently the value of planName gets used later, sothe "last" element that gets changed is the one that runs.

Copy link
Member

@runyontr runyontr Jun 18, 2019

Choose a reason for hiding this comment

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

If the user removes a parameter, do we still trigger the original param.Trigger plan? Do we trigger anything?

I think we would run the plan associated to the parameter taht was "changed" e.g. present -> not present, unless the default value for the parameter was the same as the value that existed

Copy link
Contributor

Choose a reason for hiding this comment

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

We probably don't need to fix this here though. Would be good to have issue tracking this though. I think the current thinking is to add validation that will disallow changing parameters that would end up triggering different plans

Copy link
Member

Choose a reason for hiding this comment

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

Agreed. We separate this out from this PR.

// Fetch the Framework instance
instance := &kudov1alpha1.Framework{}
err := r.Get(context.TODO(), request.NamespacedName, instance)
// Fetch the framework
Copy link
Contributor

Choose a reason for hiding this comment

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

hehe I smell copy-paste here :D nice 👍

planName = param.Trigger
ok = true
}
for k := range parameterDifference(old.Spec.Parameters, new.Spec.Parameters) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think always one plan is triggered, but which one is it is decided by the last parameter change :/

Copy link
Contributor

@alenkacz alenkacz left a comment

Choose a reason for hiding this comment

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

🚢

planName = param.Trigger
ok = true
}
for k := range parameterDifference(old.Spec.Parameters, new.Spec.Parameters) {
Copy link
Member

Choose a reason for hiding this comment

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

Agreed. We separate this out from this PR.

@zen-dog
Copy link
Contributor Author

zen-dog commented Jun 19, 2019

I think always one plan is triggered, but which one is it is decided by the last parameter change :/

Strictly speaking, its the first parameter change right now.

@zen-dog zen-dog merged commit 39ea396 into master Jun 19, 2019
@zen-dog zen-dog deleted the ad/fix-parameter-diffing branch June 19, 2019 14:19
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.

Cannot update parameters if the older instance didn't use the parameters before
4 participants