-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Added server alias to metrics #3620
Conversation
/assign @aledbf |
/cc @ElvinEfendi |
@@ -130,6 +130,9 @@ func (n *NGINXController) syncIngress(interface{}) error { | |||
for _, server := range servers { | |||
if !hosts.Has(server.Hostname) { | |||
hosts.Insert(server.Hostname) | |||
if server.Alias != "" { | |||
hosts.Insert(server.Alias) | |||
} | |||
} |
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 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)
}
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.
Updated.
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.
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.
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.
@startnow65 thank you for noticing that error.
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.
Good catch @startnow65!
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.
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?
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.
@walkafwalka no, I already fixed this in another PR.
/lgtm |
@walkafwalka thanks! |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: aledbf, walkafwalka The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What this PR does / why we need it: Adds hosts specified via server alias to be added to them
Which issue this PR fixes fixes #3485
Special notes for your reviewer:
This PR is a resubmission of #3496.