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

controllers/portforward: portforwards are run by the reconciler, reading off the engine state [ch11908] #4523

Merged
merged 12 commits into from
May 7, 2021

Conversation

maiamcc
Copy link
Contributor

@maiamcc maiamcc commented May 6, 2021

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.

@maiamcc maiamcc requested review from milas and nicks May 6, 2021 15:27
Copy link
Member

@nicks nicks left a 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) {
Copy link
Member

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

Copy link
Contributor Author

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() {
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 your summary already has the list of PortForward names that have changed? can narrow this to len(summary.PortForwards) == 0

Copy link
Contributor Author

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{
Copy link
Member

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

Copy link
Contributor Author

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.

@maiamcc maiamcc merged commit cae72de into master May 7, 2021
@maiamcc maiamcc deleted the maiamcc/pf-reconciler branch May 7, 2021 18:53
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.

None yet

2 participants