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: try to use controller-runtime's ObjectReconciler #73

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Chever-John
Copy link

to simplify code in reconcilers.

first refactor the BlueGreenReconciler.

What this PR does / why we need it:

Which issue this PR fixes

Fixes #

Special notes for your reviewer:

PR Readiness Checklist:

Complete these before marking the PR as ready to review:

  • the CHANGELOG.md release notes have been updated to reflect significant changes

 to simplify code in reconcilers.

first refactor the BlueGreenReconciler.
@Chever-John
Copy link
Author

Chever-John commented Mar 30, 2024

In my attempt to optimize the GreenBlue Controller's code based on the suggestions from issue #46, I realized that the modifications I implemented were excessively substantial. Consequently, I am exploring ways to streamline the code, and I am in search of appropriate design patterns that could facilitate this simplification. Should you have any valuable suggestions, please do not hesitate to share.

@pmalek
Copy link
Member

pmalek commented Apr 2, 2024

Hi @Chever-John

Thanks for your PR. I believe you were trying to tackle #46, correct?

I that's the case we'd rather see a small PR changing concrete pieces of code rather than introduce a whole new file.

You might want to try looking into changing the signature of the Reconcile() func and then using it like so

builder.ControllerManagedBy(manager).
	For(&corev1.ConfigMap{}).
	Complete(reconcile.AsReconciler(client, &MyObjectReconciler{}))

If you still need a hand don't hesitate to ask.

@Chever-John
Copy link
Author

Hi @Chever-John

Thanks for your PR. I believe you were trying to tackle #46, correct?

I that's the case we'd rather see a small PR changing concrete pieces of code rather than introduce a whole new file.

You might want to try looking into changing the signature of the Reconcile() func and then using it like so

builder.ControllerManagedBy(manager).
	For(&corev1.ConfigMap{}).
	Complete(reconcile.AsReconciler(client, &MyObjectReconciler{}))

If you still need a hand don't hesitate to ask.

Got it~
Let me try it again:)

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.

2 participants