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

Ensure that kctrl picks up status tail after secrets are updated #713

Merged
merged 2 commits into from
Jun 6, 2022

Conversation

100mik
Copy link
Contributor

@100mik 100mik commented May 31, 2022

What this PR does / why we need it:

It ensures that kctrl picks up on a reconciliation aftera secret is updated as kctrl might poll the resource and error out / exit successfully before the reconciliation due to a secret update might start

Which issue(s) this PR fixes:

Fixes #670

Does this PR introduce a user-facing change?

Enhanced how kctrl tails reconciliation progress after existing secrets are updated

Additional Notes for your reviewer:

Review Checklist:
  • Follows the developer guidelines
  • Relevant tests are added or updated
  • Relevant docs in this repo added or updated
  • Relevant carvel.dev docs added or updated in a separate PR and there's
    a link to that PR
  • Code is at least as readable and maintainable as it was before this
    change

Additional documentation e.g., Proposal, usage docs, etc.:


@@ -310,6 +312,20 @@ func (o CreateOrUpdateOptions) update(client kubernetes.Interface, kcClient kccl
return nil
}

// Pause reconciliation so that kctrl can tail status if an existing values secret is updated
reconciliationPaused := false
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This variable is not entirely necessary, we can chuck it out
I thought it improves readability but happy to remove it

}

if reconciliationPaused {
err = o.unpauseReconciliation(kcClient)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Pausing and unpausing if needed at the beginning and the end is the best way I could find. Maybe we should start logging pauses and unpauses, so that if things error out in the middle the user is aware that reconciliation is paused?
Not sure if it makes sense to defer a function which unpauses the app if paused :/

Copy link
Contributor

Choose a reason for hiding this comment

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

keeping it paused it probably good (since they may want to keep on reconfiguring packageinstall) but good thought on indicating that to the user.

@@ -743,6 +768,69 @@ func (o *CreateOrUpdateOptions) updateDataValuesSecret(client kubernetes.Interfa
return nil
}

func (o *CreateOrUpdateOptions) pauseReconciliation(client kcclient.Interface) (*kcpkgv1alpha1.PackageInstall, error) {
Copy link
Member

Choose a reason for hiding this comment

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

I think we should add a TODO item or create an issue to remove duplication.

@praveenrewar praveenrewar merged commit 526b10b into develop Jun 6, 2022
@neil-hickey neil-hickey deleted the kctrl-enhance-value-secret-updates branch June 29, 2022 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

kctrl : Trigger reconciliation when exisiting value secrets are updated
4 participants