return multiple IPs for nodes when reporting ingress status
What this PR does / why we need it:
When reporting a node's IP into an Ingress' status, currently ingress-nginx only reports the first IP. In particular, this makes it impossible to report dual IPv4/IPv6 addresses.
This PR updates behaviour to report all matching (internal vs external) addresses instead of just the first.
First two commits are small refactors to make the actual change commit easier to read.
Third commit is the meat.
Final commit is probably needed in some form but I need to look into it more: when shutting down syncStatus, looks like len(addrs) == 1 is considered a special case, this is no longer an appropriate assumption to make but I need to look more deeply into what's going on here.
Types of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [x] New feature (non-breaking change which adds functionality)
- [ ] CVE Report (Scanner found CVE and adding report)
- [x] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Documentation only
Which issue/s this PR fixes
fixes #10756 .
How Has This Been Tested?
unit tests updated as per commits.. I will do integration testing tomorrow.
Checklist:
- [?] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I've read the CONTRIBUTION guide
- [ ] I have added unit and/or e2e tests to cover my changes.
- [x] All new and existing tests passed.
The committers listed above are authorized under a signed CLA.
- :white_check_mark: login: akdor1154 / name: Jarrad Whitaker (6df8b2a828439ee1ebabd0565db18959c3b173e7, 5f939ee97c45aa9d0d9a01ac0ca4614b5b014adf, e518ae45c7bd986cfafa0c00083d95ec9fda2ed5, 89b8125739adc33c3f1821d62cd719a8e276de0f)
Deploy Preview for kubernetes-ingress-nginx canceled.
| Name | Link |
|---|---|
| Latest commit | 89b8125739adc33c3f1821d62cd719a8e276de0f |
| Latest deploy log | https://app.netlify.com/sites/kubernetes-ingress-nginx/deploys/657a4aa2ccf99400081efc7d |
This issue is currently awaiting triage.
If Ingress contributors determines this is a relevant issue, they will accept it by applying the triage/accepted label and provide further guidance.
The triage/accepted label can be added by org members by writing /triage accepted in a comment.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
Welcome @akdor1154!
It looks like this is your first PR to kubernetes/ingress-nginx 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.
You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.
You can also check if kubernetes/ingress-nginx has its own contribution guidelines.
You may want to refer to our testing guide if you run into trouble with your tests not passing.
If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!
Thank you, and welcome to Kubernetes. :smiley:
Hi @akdor1154. Thanks for your PR.
I'm waiting for a kubernetes member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.
Once the patch is verified, the new status will be reflected by the ok-to-test label.
I understand the commands that are listed here.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.
[APPROVALNOTIFIER] This PR is NOT APPROVED
This pull-request has been approved by: akdor1154 Once this PR has been reviewed and has the lgtm label, please assign rikatz for approval. For more information see the Kubernetes Code Review Process.
The full list of commands accepted by this bot can be found here.
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
reading into the final shutdown len(addrs)>1 change a bit more - my interpretation is (could be way off)
len(addrs) > 1
- is intended to mean "given I'm leader, are there any other candidates around which will gain leader status once I'm gone?"
- in which case skipping cleanup makes sense.
If this interpretation is right, then I think just removing that block is justified, as the next check seems to be checking the same thing ("are their other candidates around who will update for me after I'm gone"?).
I'll play around and test a bit, but as said, I'm now a bit more confident that my approach to shutdown behaviour is justified.
initial testing looks OK. I've published a public image:
# values.yaml
controller:
image:
registry: ghcr.io
image: akdor1154/ingress-nginx/controller
tag: "v1.9.4"
digest: "sha256:3b15d2cb572389e9ac131ac3218a11b54b3c1a68ba95e39a085957ef64a7420b"
With that image, my ingresses get marked with all relevant node IPs, both internal and external.
I don't think I'm able to test this with the e2e tests in a sensible way sorry - the e2e kind config is set to ipv4 only (by default). Setting it to dual stack seems to work here, but I suspect it will break things for mac/windows devs. As such I'm marking this ready for review.
@akdor1154 it looks good, can you double check the e2e test and add one with node with both ipv4 and 6 address.
/ok-to-test
https://github.com/kubernetes/ingress-nginx/blob/main/test/e2e/framework/deployment.go
I dont know if we have ipv6 tests, looking at the deployment and others, I don't really see it. That might make this a little harder to get in.
looks like it can be added here in status https://github.com/kubernetes/ingress-nginx/blob/main/test/e2e/status/update.go
PR needs rebase.
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.