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

Added server alias to metrics #3620

merged 2 commits into from
Jan 4, 2019

Conversation

walkafwalka
Copy link
Contributor

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.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jan 2, 2019
@walkafwalka
Copy link
Contributor Author

/assign @aledbf

@walkafwalka
Copy link
Contributor Author

/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)
}
}
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.

@aledbf
Copy link
Member

aledbf commented Jan 4, 2019

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 4, 2019
@aledbf
Copy link
Member

aledbf commented Jan 4, 2019

@walkafwalka thanks!

@k8s-ci-robot
Copy link
Contributor

[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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 4, 2019
@k8s-ci-robot k8s-ci-robot merged commit 79bdfcb into kubernetes:master Jan 4, 2019
@walkafwalka walkafwalka deleted the server-alias-metrics branch January 6, 2019 19:52
@walkafwalka walkafwalka restored the server-alias-metrics branch January 14, 2019 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

nginx_ingress_controller_requests metric doesn't seem to be incremented with aliases
5 participants