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

use reflector for egress labeling #476

Closed
wants to merge 3 commits into from

Conversation

evanharmon
Copy link
Contributor

Motivation

If the EIP operator pod is unavailable when an egress node rolls, there is a chance the new node will fail to get the egress-gateway.materialize.cloud/ready-status: true label.

Use a reflector instead of a watch for egress labeling. These changes ensure the labeler runs on eip operator startup, on eip changes, and every 5 minutes. Running on a timer ensures if an EIP event is missed, the new node will get the required egress label.

Notes for reviewer

Works in my development environment. I let it run over the weekend with nodes rolling every 6 hours.

@evanharmon evanharmon self-assigned this Oct 14, 2024
@evanharmon evanharmon requested a review from a team as a code owner October 14, 2024 15:39
let repeating_timer = IntervalStream::new(interval).map(|_| ()).boxed();
// run once at startup, every 5 minutes, and every time an EIP changes
let mut stream = select_all([
once(async {}).boxed(),
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't believe this is needed, eip_notifications should have a queue based on the initial LIST operation

// This allows the egress node to be re-labeled even if a new EIP event is missed
let interval = time::interval(Duration::from_secs(300));
// timer needs to emit a `()` value for the select_all below
let repeating_timer = IntervalStream::new(interval).map(|_| ()).boxed();
Copy link
Contributor

Choose a reason for hiding this comment

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

at the point we're writing our own time-based reconciler + reflector, it now feels like we've reinvented the kube-rs Controller, where we can return a requeue event for each Eip resource after it's reconciled to reschedule it for the future. I don't think we need our k8s-operator wrapper here that adds in finalizers, but I wonder if a plain Controller would work here?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder if we should make the finalizer an Option. This isn't the first time that I've wanted controller-style reconciliations, but without the finalizer added.

@evanharmon
Copy link
Contributor Author

Closing as this work is no longer necessary.

@evanharmon evanharmon closed this Oct 17, 2024
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.

3 participants