-
Notifications
You must be signed in to change notification settings - Fork 661
Suppress "Not forwarding …" messages when forwarding has been disabled #2600
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -214,6 +214,7 @@ type Proto = string | |
|
||
const ( | ||
TCP Proto = "tcp" | ||
UDP Proto = "udp" | ||
) | ||
|
||
type PortForward struct { | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Are these really info level messages? They are usefull only for debugging your configuration - so debug level.
What if you don't specify rule.Proto? we consider this as ignore both or not ignore any?
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 don't have strong opinions on this, but in some way all the info messages are only useful for debugging your configuration. The only one that will be left is:
I would prefer to keep this at the info level, just so that if somebody puts the block to ignore port forwarding in their
default.yaml
oroverride.yaml
files, and then forgets about it, they will have a reminder in the info log of what they have done.lima/pkg/limayaml/defaults.go
Lines 809 to 811 in 52f5ad3
So you would need to add another rule to ignore with this PR:
We probably should have support for
proto: all
and default to that.You will notice that support for UDP and IPv6 is not fully considered in the port forwarding implementation and needs to be improved. Note that support for UDP port forwarding was only added to Lima last week in #2411.
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.
Another issue - this works on single rule level. If you have:
This is pretty clear, but if you have:
This code will treat the second rule as disabling port forwarding, while the purpose of the rule is to disable anything else port 80. In this case the user may want to see the Not forwarding message for port 80.
We can fix this by adding check for
len(y.PortForwards) == 1
(hopefully lima append the any port forwading rule later).This could be much simpler if we have a simple switch to disable this feature. Maybe to keep the simple structrue, add something like:
With this you can keep your complex configuration as is, and enable/disable it with one change in the features map.
Another way is to make portForwards structure more flexible:
It is little bit more complex but much more flexible. And it models exactly nicely the actual thing: port forwarding rules.
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.
And they will:
Note how the
else { break }
part will exit the loop as soon as it encounters a rule that doesn't ignore all ports. SoignoreTCP
andignoreUDP
are only set if there are no other rules in front of them.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 don't see how this is simpler than
(once we make the default work for UDP as well).
Adding redundant syntactic sugar for functionality that is already available is just adding complexity.
And this additional "feature" is much more limited: what if the users only wants to disable UDP. Or only disable IPv6? You are just adding a special case for the one configuration that you personally are interested in, while adding to the cognitive load of everybody else who wants to wrap their head around how this can be configured.
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.
This is debugging why it did not work as expected, so debug level.
What can be useful in info level, is message like:
Port forwarding is overridden by overides.yaml
And if we think that using non-default default.yaml is useful, we can log about that also. But I'm not sure about that, it depends if users had problems with such configuration.
If you configured port forwarding, info level message about forwarded port confirms that the system is operating as expected. This is also a change affecting the host, so it is import event - info level.
The messages about "waiting for retirement", "requirement satisfied" are helping the user to get some feedback about the progress. These are also useful when another program is running limactl for reporting progress. Provisioning k8s cluster takes hare about 3 minutes and having no feedback from the tool for 3 minutes is not good user experience.
Maybe the right thing is to log everything to a file, so you always have all the info, and show a nice progress with only high level info for the user.
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.
Now, if you want to argue that the documentation should be improved beyond having a bunch of samples in
default.yaml
, then I will wholeheartedly agree.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.
We do log everything to files (
ha.stderr.log
andha.stdout.log
) in the instance directory.Personally I wouldn't mind hiding most everything until it starts waiting for requirements. Everything before is rarely useful unless you are debugging a failure:
But I think this should be a separate discussion from dropping individual
Not forwarding …
messages from the hostagent.