-
Notifications
You must be signed in to change notification settings - Fork 288
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
controllers/portforward: portforwards are run by the reconciler, reading off the engine state [ch11908] #4523
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
existing, isActive := r.activeForwards[name] | ||
if isActive { | ||
// We're already running this PortForward -- do we need to do anything further? | ||
if equality.Semantic.DeepEqual(existing.Spec, desired.Spec) && equality.Semantic.DeepEqual(existing.ObjectMeta, desired.ObjectMeta) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comparing the ObjectMeta like this isn't right...it's going to compare things you don't expect, like ResourceVersion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm fair. so the one thing i need to make sure stays the same is the ManifestName annotation -- would it be too weird to compare that directly? or should i duplicate that data on the state? or?
return | ||
} | ||
|
||
if summary.IsLogOnly() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think your summary already has the list of PortForward names that have changed? can narrow this to len(summary.PortForwards) == 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep will do that after I'm changing state via events (right now i'm just setting the PortForwards directly on the state for tests)
|
||
for _, entry := range toStart { | ||
// Treat port-forwarding errors as part of the pod log | ||
ctx := logger.CtxWithLogHandler(entry.ctx, PodLogActionWriter{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should probably use ObjectLogHandler instead of a custom one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol I just lifted this straight from the original code. will do.
I've moved the "actually run the port forwards" logic into the PortForwardReconciler (reading desired PortForwards off the EngineState). This shouldn't be touched in prod yet -- will make a separate PR to remove the "actually run the port forwards" logic from the subscriber.