aws-load-balancer-controller
aws-load-balancer-controller copied to clipboard
Ignoring ingresses in the group with invalid conditions in the annotation
Issue
#2042
Description
Earlier if at least 1 ingress in the group has an invalid annotation the rest of the ingresses in the group aren't took into account during building listener rules.
I've handled the condition validation error separately to prevent the termination of the process of the building listener rules for valid ingresses if such an error occurs.
Checklist
- [x] Added tests that cover your change (if possible)
- [ ] Added/modified documentation as required (such as the
README.md, or thedocsdirectory) - [x] Manually tested
- [x] Made sure the title of the PR is a good description that can go into the release notes
BONUS POINTS checklist: complete for good vibes and maybe prizes?! :exploding_head:
- [ ] Backfilled missing tests for code in same general area :tada:
- [ ] Refactored something and made the world a better place :star2:
The committers listed above are authorized under a signed CLA.
- :white_check_mark: login: r-erema / name: Roma Erema (c3cf11f973f16c81703cda5549dcc766c484f7d0)
Welcome @r-erema!
It looks like this is your first PR to kubernetes-sigs/aws-load-balancer-controller 🎉. 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-sigs/aws-load-balancer-controller 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 @r-erema. Thanks for your PR.
I'm waiting for a kubernetes-sigs 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: r-erema
Once this PR has been reviewed and has the lgtm label, please assign m00nf1sh for approval by writing /assign @m00nf1sh in a comment. 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
/assign @M00nF1sh
@M00nF1sh @kishorj Hi, kindly reminder about PR. Please, estimate when it can get to the review. Thanks!
The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closed
You can:
- Mark this issue or PR as fresh with
/remove-lifecycle stale - Mark this issue or PR as rotten with
/lifecycle rotten - Close this issue or PR with
/close - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle stale
The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.
This bot triages issues and PRs according to the following rules:
- After 90d of inactivity,
lifecycle/staleis applied - After 30d of inactivity since
lifecycle/stalewas applied,lifecycle/rottenis applied - After 30d of inactivity since
lifecycle/rottenwas applied, the issue is closed
You can:
- Mark this issue or PR as fresh with
/remove-lifecycle rotten - Close this issue or PR with
/close - Offer to help out with Issue Triage
Please send feedback to sig-contributor-experience at kubernetes/community.
/lifecycle rotten
/remove-lifecycle
/ok-to-test
Would it be possible to put these checks in the validating admission webhook so such ingresses don't get created in the first place?
If you want to explore the validating admission webhook path, the code is in webhooks/networking/ingress_validator.go.
Although the existing ingress_validator code uses generic errors, it would be better to return API validation errors from apimachinery. Examples of this can be found in my PR #2945.
Would it be possible to put these checks in the validating admission webhook so such ingresses don't get created in the first place?
@johngmyers Do we need replace existed validation flow, i.e. take validation from here https://github.com/kubernetes-sigs/aws-load-balancer-controller/blob/c94ffd3055892235c77a4024817367207bc6f94c/pkg/ingress/enhanced_backend_builder.go#L167-L171 and put to the validating admission webhook?
Or just add the same validation to the validating admission webhook, i.e. we will have same validation in 2 places
I think it would be fine just being in the webhook.
Putting the checks in both places would cover cases where the webhook wasn't able to act, likely because it wasn't configured when the Ingress was created. I don't think the added complexity would be worth it.
Would it be possible to put these checks in the validating admission webhook so such ingresses don't get created in the first place?
@johngmyers I thought 1 thing - do we actually desire to reject the whole ingress in case of at least 1 bad condition?
Or do we just want to reject the path related to the invalid condition but keep the ingress with the rest of the good conditions? If so, I guess we need to involve mutation to exclude paths with the wrong condition from the ingress request. Or it will be overhead, and it's not worth making such complexity and just rejecting the whole ingress is ok? :-)
Rejecting the entire ingress is the desired behavior. It will fail the deployment and thus get noticed early and the owner will get what they had before, not some novel, untested combination of settings.
@johngmyers PR has been updated: validation is shifted to the validation webhook.
One question: I have the failed job "pull-aws-load-balancer-controller-unit-test"
with error:
vet: webhooks/networking/ingress_validator_test.go:895:41: NullLogger not declared by package log
Maybe you're familiar with the problem? Locally tests are passed fine, I suspect it's somehow related to github or prow(not so familiar with that tool) environment. Otherwise I will dig in it by my myself
You should change the title of the PR. Something like "Validate Ingress condition annotations".
You should change the title of the PR. Something like "Validate Ingress condition annotations".
@johngmyers Done
I have the failed job "pull-aws-load-balancer-controller-unit-test"
Fixed as well
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: kishorj, r-erema
The full list of commands accepted by this bot can be found here.
The pull request process is described here
- ~~OWNERS~~ [kishorj]
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
/lgtm