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: Upgrade Decision engine incorporated into reconciliation logic #270

Merged
merged 72 commits into from
Sep 23, 2024

Conversation

juliev0
Copy link
Collaborator

@juliev0 juliev0 commented Sep 16, 2024

Fixes #228, #239

Modifications

From PipelineRollout Reconciler, if user has set a preference for PPND, we determine which strategy we need to do based on 1. whether/which fields changed, 2. was there an external request to pause from NumaflowController or ISBService? If so, we put ourselves in the PPND InProgressStrategy and set that value in memory and in the Rollout Status.

From NumaflowControllerRO Reconciler and ISBServiceRO reconciler, if user has set a preference for PPND, we perform the PPND strategy always (later we will make it dependent on which isbsvc fields changed).

Verification

Added unit test for PPND to PipelineRollout, testing many different cases, including whether the InProgressStrategy is set correctly.

Enhanced e2e test to include verification of InProgressStrategy, and also now includes verification of the cases of:

  1. user sets desiredPhase=Paused
  2. user sets desiredPhase=Running when it was previously paused

To Do

  1. perhaps e2e test could be updated to include an actual user config
  2. address any TODOs in the code
  3. Would like to move PPND specific functions into a separate file

Signed-off-by: Julie Vogelman <[email protected]>
Signed-off-by: Julie Vogelman <[email protected]>
Signed-off-by: Julie Vogelman <[email protected]>
Signed-off-by: Julie Vogelman <[email protected]>
Signed-off-by: Julie Vogelman <[email protected]>
Signed-off-by: Julie Vogelman <[email protected]>
Signed-off-by: Julie Vogelman <[email protected]>
Signed-off-by: Julie Vogelman <[email protected]>
Signed-off-by: Julie Vogelman <[email protected]>
Signed-off-by: Julie Vogelman <[email protected]>
Signed-off-by: Julie Vogelman <[email protected]>
Signed-off-by: Julie Vogelman <[email protected]>
Signed-off-by: Julie Vogelman <[email protected]>
Signed-off-by: Julie Vogelman <[email protected]>
Signed-off-by: Julie Vogelman <[email protected]>
@juliev0 juliev0 changed the title Decision engine feat: Upgrade Decision engine incorporated into reconciliation logic Sep 17, 2024
Signed-off-by: Julie Vogelman <[email protected]>
Signed-off-by: Julie Vogelman <[email protected]>
Signed-off-by: Julie Vogelman <[email protected]>
Signed-off-by: Julie Vogelman <[email protected]>
Signed-off-by: Julie Vogelman <[email protected]>
Signed-off-by: Julie Vogelman <[email protected]>
Signed-off-by: Julie Vogelman <[email protected]>
Signed-off-by: Julie Vogelman <[email protected]>
if err != nil {
return err
}
return nil
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

by calling UpdateCR() here, we get the latest pipeline with the revised ResourceVersion from K8S, so any subsequent call to do an update within this reconcile call will use the latest ResourceVersion and won't result in a conflict error.

Signed-off-by: Julie Vogelman <[email protected]>
@juliev0 juliev0 marked this pull request as ready for review September 19, 2024 22:40
DataLossPrevention bool `json:"dataLossPrevention" mapstructure:"dataLossPrevention"`
// If user's config doesn't exist or doesn't specify strategy, this is the default
// TODO: should we put this here or in usde config?
DefaultUpgradeStrategy USDEUserStrategy `json:"defaultUpgradeStrategy" mapstructure:"defaultUpgradeStrategy"`
Copy link
Contributor

Choose a reason for hiding this comment

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

yeah, it is better to move to USDE config so that we have all upgrade related config in one place

verifyPipelineRolloutDeployed(pipelineRolloutName)

// Give it a little while to get to Paused and then verify that it stays that way
// TODO: add back after Numaflow fixes this to not go from Paused to Pausing
Copy link
Contributor

Choose a reason for hiding this comment

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

which numaflow issue is tracking the bug?

Copy link
Collaborator Author

@juliev0 juliev0 Sep 20, 2024

Choose a reason for hiding this comment

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

Sidhant actually fixed it here - I just need for us to incorporate it, which I will do shortly so as to get a few fixes at once

Comment on lines +77 to +78
case config.NoStrategyID:
return true, apiv1.UpgradeStrategyApply, nil
Copy link
Contributor

Choose a reason for hiding this comment

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

This block of code according to the comment at L59 should only return PPND or Progressive?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good catch that that's a mismatch. I am going to change the comment. Perhaps in the future, those would be the only strategies allowed, but for now "no strategy" is also allowed.

if err := json.Unmarshal(existingPipelineDef.Spec.Raw, &existingPipelineSpec); err != nil {
return fmt.Errorf("failed to convert existing Pipeline spec %q into PipelineSpec type, err=%v", string(existingPipelineDef.Spec.Raw), err)
// what is the preferred strategy for this namespace?
userPreferredStrategy, err := usde.GetUserStrategy(ctx, newPipelineDef.Namespace)
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel the logic from L443 to L528 to determine which strategy to be used is too interleaved between code blocks and be further condensed. But I'm good to leave it to a follow up.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

can you clarify what you mean by "interleaved between code blocks"?

I specifically wanted to design the overall flow as:

  1. figure out what "In progress strategy" should be and set it if it's not set
  2. Do whatever the "In progress strategy" is

Do you disagree with that approach?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Feel free to refactor if you see a potential improvement

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Okay, I thought about this a little more, and I can kind of see what you're saying. I think I can see keep the PPND logic collocated, and keep the Progressive logic collocated.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

On second thought, I started to do this and it didn't seem to be better with what I was doing so I decided not to spend time on it. But do feel free to refactor it if you want to. :)

Signed-off-by: Julie Vogelman <[email protected]>
@juliev0 juliev0 merged commit 84b8c74 into main Sep 23, 2024
7 checks passed
@juliev0 juliev0 deleted the decision-engine branch September 23, 2024 22:00
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.

Integrate USDE logic into Rollout controllers to support PPND - perform selected strategy for Pipeline fields
2 participants