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

[deps][breaking] Upgrade controller-runtime to v0.20.1 #11

Merged
merged 17 commits into from
Jan 27, 2025

Conversation

shadialtarsha
Copy link
Contributor

@shadialtarsha shadialtarsha commented Jan 12, 2025

Closes #12

💸 TL;DR

  • Updating controller-runtime to version v.0.20.1
  • Removing WatchesRawResource - breaking change.

📜 Details

Due to the recent breaking PRs on controller-runtime kubernetes-sigs/controller-runtime#2799 and kubernetes-sigs/controller-runtime#2783, I had to make some decisions and I would appreciate your inputs on it:

  1. Replace WatchesRawSource with two new builder functions: WatchesChannel and WatchesKind because you cannot create a raw source.Source anymore.
  2. Thus, we cannot do WatchesRawResource anymore because we cannot wrap the handler with our own observer.
  3. Switch all the RateLimiter functions to be typed.

🧪 Testing Steps / Validation

I replaced the SDK on my Ingress Controller and things look like they are working. I will do more tests as well to make sure we are good.

✅ Checks

  • CI tests (if present) are passing
  • Adheres to code style for repo
  • Contributor License Agreement (CLA) completed if not a Reddit employee

@shadialtarsha shadialtarsha changed the title [Not Ready] An attempt to update controller-runtime to v0.19 An attempt to update controller-runtime to v0.19 Jan 19, 2025
@shadialtarsha shadialtarsha marked this pull request as ready for review January 19, 2025 14:01
@shadialtarsha shadialtarsha requested a review from a team as a code owner January 19, 2025 14:01
Copy link
Collaborator

@harveyxia harveyxia left a comment

Choose a reason for hiding this comment

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

Some minor comments + we should think about reworking the WithChannels builder option because channel sources' value is that the events could originate from anything, not just Kubernetes object events, so we should avoid constraining the channel to client.Object.

One possible approach is to generify WithChannels to WithSources and allow callers to pass in arbitrary sources. Illustrative code here

pkg/fsm/builder.go Outdated Show resolved Hide resolved
pkg/fsm/claim_builder.go Outdated Show resolved Hide resolved
// NewZeroDelayManagedRateLimiter returns a rate limiter that takes the
// maximum delay between the passed provider and a per-item exponential backoff
// limiter. The exponential backoff limiter has a base delay of 0s and a maximum of 60s.
func NewZeroDelayManagedRateLimiter(provider workqueue.TypedRateLimiter[reconcile.Request]) workqueue.TypedRateLimiter[reconcile.Request] {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Out of curiosity, why was this introduced? Is 1s too long of a base delay for certain use cases?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Check this out

assert.Equal(t, queue.Len(), len(tc.expectedLogs))

The current in production workqueue.DefaultControllerRateLimiter() has no delays what so ever, so tests were passing. However, the new DefaultControllerRateLimiter has an initial delay causing the tests to fail
https://github.com/kubernetes/client-go/blob/97f3d2697cceec0c57cdac5744d7f6ce34c1991d/util/workqueue/default_rate_limiters.go#L50

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does that make sense?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Makes sense, thanks

Copy link
Collaborator

@harveyxia harveyxia Jan 24, 2025

Choose a reason for hiding this comment

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

On review, I'm still not sure I understand this change—where is NewZeroDelayManagedRateLimiter being used?

Prior to this upgrade, this repo uses client-go v0.29.3` whose rate limiting logic appears to be identical to the upgraded version, with the exception of the type constraint.

@shadialtarsha
Copy link
Contributor Author

shadialtarsha commented Jan 24, 2025

@harveyxia I opened a PR on our internal ingress controller and pointed to replace github.com/reddit/achilles-sdk => github.com/shadialtarsha/achilles-sdk v0.0.0-20250124125809-a035e576b822

This would be a good way to test it in staging before merging this PR.

Wanna report that the Ingress Controller e2e tests, unit tests and integration tests are all passed successfully

@harveyxia harveyxia changed the title An attempt to update controller-runtime to v0.19 [deps][breaking] Upgrade controller-runtime to v0.19.4 Jan 24, 2025
@shadialtarsha shadialtarsha changed the title [deps][breaking] Upgrade controller-runtime to v0.19.4 [deps][breaking] Upgrade controller-runtime to v0.20.1 Jan 24, 2025
pkg/ratelimiter/ratelimit.go Show resolved Hide resolved
@shadialtarsha shadialtarsha merged commit 89f7ce8 into reddit:main Jan 27, 2025
1 check passed
@shadialtarsha shadialtarsha deleted the update-controller-runtime branch January 27, 2025 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Update controller-runtime to v0.19.4
2 participants