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

feat(annotations): introduce enable-custom-http-errors annotation #8385

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

aslafy-z
Copy link
Contributor

@aslafy-z aslafy-z commented Mar 23, 2022

What this PR does / why we need it:

Allows setting an empty value to the custom-http-errors in order to disable them altogether.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation only

Which issue/s this PR fixes

fixes #8384
fixes #10066

How Has This Been Tested?

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I've read the CONTRIBUTION guide
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-priority labels Mar 23, 2022
@k8s-ci-robot
Copy link
Contributor

Hi @aslafy-z. 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.

@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Mar 23, 2022
@aslafy-z aslafy-z marked this pull request as draft March 23, 2022 11:47
@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 23, 2022
@aslafy-z aslafy-z marked this pull request as ready for review March 23, 2022 11:58
@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. area/docs and removed do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Mar 23, 2022
@strongjz strongjz self-assigned this Mar 29, 2022
@k8s-triage-robot
Copy link

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-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 27, 2022
@aslafy-z
Copy link
Contributor Author

/remove-lifecycle stale

@k8s-ci-robot k8s-ci-robot removed the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jun 27, 2022
@longwuyuan
Copy link
Contributor

@aslafy-z tht annotation is named aptly and does what it is names as.

If you are looking for a new feature to handle a case where no existing ingress rule matches a incoming http request and as a result instead of the default-backend of the project handling the response, you want your own behaviour, then I think the documented procedure is to create your own image and use that to create a backend to be configured as a default-backend.

Changing an existing annotation that is sort of not named after your desired behaviour does not seem like an improvement. There are several such changes made earlier that has led to unmaintained and unsupportable features and the project is now in a 6 month phase to clean up and stabilize the code.

This is my opinion so lets wait for other comments. But I vote for not doing this change you are proposing. I hope the project steers away from such changes that only one user benefits from and that is not deeply thought over and elaborated.

But I am not a developer so I could be wrong so lets hope there is enough info posted here about a deep dive analysis on how the change you propose is a improvement for a large number of users.

@aslafy-z aslafy-z force-pushed the patch-1 branch 2 times, most recently from 92a369f to 134cf3c Compare November 24, 2022 11:36
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 1, 2023
@r2DoesInc
Copy link

r2DoesInc commented Jul 7, 2024 via email

@longwuyuan
Copy link
Contributor

@r2DoesInc thanks for the update. It add info so it helps.

I have no intent to write off this feature-request. I am not even a developer.

The description for this feature seems first, the clusterWide defaults are changed (while installing) because the defaults are not acceptable. And then an exception to clusterWide defaults is force configured per ingress.

@r2DoesInc
Copy link

r2DoesInc commented Jul 7, 2024 via email

@Diaoul
Copy link

Diaoul commented Jul 7, 2024

Just to clarify, the problem is the following:

  • custom-http-errors: yes at the cluster level, e.g. 404
  • On ingresses for application X
    • / custom-http-errors: yes, e.g. 404, following the default cluster setting
    • /api custom-http-errors: no, because usually, HTTP statuses are transformed to render a pretty page which can break the API's expectations in where it expects 401 or 404 to act differently but always get 200 now.

Happy to provide examples of such applications.

👉 Currently, there is no easy way to disable custom-http-errors for /api unless setting it to a dummy HTTP status code: 418, 599, etc.

I don't know if the PR addresses the problem in the best way, there are many different ways to achieve this like with another annotation enable-custom-http-errors: true/false but it has the merit to work.

@longwuyuan
Copy link
Contributor

@Diaoul it seems like the fair & reasonable choice when you state the alternative of a new annotation. Precisely aiming at enabling/disabling custom-http-error-codes in one annotation and actually setting the error codes using the currently existing annotation sounds appropriate.

@k8s-ci-robot k8s-ci-robot added needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 7, 2024
@aslafy-z aslafy-z changed the title feat(annotations): allow disabling custom-http-errors for an ingress feat(annotations): introduce enable-custom-http-errors annotation Jul 7, 2024
@aslafy-z aslafy-z force-pushed the patch-1 branch 5 times, most recently from 644752f to bfe0e1c Compare July 7, 2024 14:09
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 7, 2024
Signed-off-by: GitHub <noreply@github.com>
@longwuyuan
Copy link
Contributor

@aslafy-z I see that you changed this to be a new dedicated annotation. thanks.

Can you please rebase and try to run the related e2e test with env var FOCUS locally https://kubernetes.github.io/ingress-nginx/developer-guide/getting-started/

@longwuyuan
Copy link
Contributor

You can also try make dev-env locally, from the rootdir of the local clone of your branch to get a interactive environ for looking at your new annotation

@aslafy-z
Copy link
Contributor Author

aslafy-z commented Jul 8, 2024

@longwuyuan I fixed tests

@HaveFun83
Copy link

any news here? We have a similar issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/docs cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. priority/backlog Higher priority than priority/awaiting-more-evidence. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
8 participants