aws-load-balancer-controller icon indicating copy to clipboard operation
aws-load-balancer-controller copied to clipboard

Ignoring ingresses in the group with invalid conditions in the annotation

Open r-erema opened this issue 3 years ago • 6 comments

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 the docs directory)
  • [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:

r-erema avatar Jul 24 '22 13:07 r-erema

CLA Signed

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:

k8s-ci-robot avatar Jul 24 '22 13:07 k8s-ci-robot

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.

k8s-ci-robot avatar Jul 24 '22 13:07 k8s-ci-robot

[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.

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 avatar Jul 24 '22 13:07 k8s-ci-robot

/assign @M00nF1sh

r-erema avatar Jul 26 '22 06:07 r-erema

@M00nF1sh @kishorj Hi, kindly reminder about PR. Please, estimate when it can get to the review. Thanks!

r-erema avatar Sep 08 '22 19:09 r-erema

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/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was 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

k8s-triage-robot avatar Dec 07 '22 19:12 k8s-triage-robot

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/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was 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

k8s-triage-robot avatar Jan 06 '23 20:01 k8s-triage-robot

/remove-lifecycle

r-erema avatar Jan 07 '23 03:01 r-erema

/ok-to-test

johngmyers avatar Jan 10 '23 06:01 johngmyers

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 avatar Jan 10 '23 07:01 johngmyers

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.

johngmyers avatar Jan 20 '23 06:01 johngmyers

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

r-erema avatar Jan 25 '23 05:01 r-erema

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.

johngmyers avatar Jan 25 '23 06:01 johngmyers

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? :-)

r-erema avatar Jan 26 '23 06:01 r-erema

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 avatar Jan 26 '23 15:01 johngmyers

@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" Screenshot from 2023-01-28 08-47-28 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

r-erema avatar Jan 28 '23 05:01 r-erema

You should change the title of the PR. Something like "Validate Ingress condition annotations".

johngmyers avatar Jan 28 '23 06:01 johngmyers

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

r-erema avatar Jan 28 '23 10:01 r-erema

[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

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 avatar Feb 20 '23 22:02 k8s-ci-robot

/lgtm

kishorj avatar Feb 20 '23 22:02 kishorj