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

Added server alias to metrics #3620

Merged
merged 2 commits into from
Jan 4, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions internal/ingress/controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ func (n *NGINXController) syncIngress(interface{}) error {
if !hosts.Has(server.Hostname) {
hosts.Insert(server.Hostname)
}
if server.Alias != "" && !hosts.Has(server.Hostname) {
hosts.Insert(server.Alias)
}
Copy link
Member

Choose a reason for hiding this comment

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

This can result in duplicate server.Alias's in hosts collection. I think this if should be out of if !hosts.Has(server.Hostname) { and similar to that, like:

		if !hosts.Has(server.Hostname) {
			hosts.Insert(server.Hostname)
		}
		if server.Alias != "" && !hosts.Has(server.Alias) {
			hosts.Insert(server.Alias)
		}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

Copy link

@startnow65 startnow65 Jan 14, 2019

Choose a reason for hiding this comment

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

Hi, seems you missed this part.
The code still has if server.Alias != "" && !hosts.Has(server.Hostname) { instead of if server.Alias != "" && !hosts.Has(server.Alias) {

Currently, the alias would not be added to the hosts list because server.Hostname would be added in the previous line and !host.Has(server.Hostname) would always be false.

Copy link
Member

Choose a reason for hiding this comment

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

@startnow65 thank you for noticing that error.

Copy link
Member

Choose a reason for hiding this comment

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

Good catch @startnow65!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops. Sorry about that.

I have never had to add a commit to a branch that was already merged.
I added the fix but I do not see the update here. Do I need to create a new PR?

Copy link
Member

Choose a reason for hiding this comment

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

@walkafwalka no, I already fixed this in another PR.


if !server.SSLPassthrough {
continue
Expand Down