ingress-nginx icon indicating copy to clipboard operation
ingress-nginx copied to clipboard

Allows allows-access-logs to set 'access_log on'

Open vanny96 opened this issue 1 year ago • 12 comments

What this PR does / why we need it:

Turned the enable-access-log annotation from bool to string in order to allow 3 possible values: true, false and default

Expected behaviour

  • true -> Sets access_log on;
  • false -> Sets access_log off;
  • default -> Sets nothing, keeps outer scope configuration

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)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [ ] Documentation only

Which issue/s this PR fixes

fixes #12078

How Has This Been Tested?

Not tested

Checklist:

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

vanny96 avatar Oct 02 '24 09:10 vanny96

CLA Signed

The committers listed above are authorized under a signed CLA.

  • :white_check_mark: login: vanny96 / name: Giovanni Barbaro (6b9522f3a4e0163d6322bf66ff473572d49ff5c7, fe8e7989f97cdde685e07ae2d47d6a58f44b83dd, b81608dcb8d4e506452728359fa425fb1e2081d9)

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: vanny96 Once this PR has been reviewed and has the lgtm label, please assign tao12345666333 for approval. 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 Oct 02 '24 09:10 k8s-ci-robot

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-sigs/prow repository.

k8s-ci-robot avatar Oct 02 '24 09:10 k8s-ci-robot

Welcome @vanny96!

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:

k8s-ci-robot avatar Oct 02 '24 09:10 k8s-ci-robot

Hi @vanny96. 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-sigs/prow repository.

k8s-ci-robot avatar Oct 02 '24 09:10 k8s-ci-robot

Deploy Preview for kubernetes-ingress-nginx canceled.

Name Link
Latest commit fe8e7989f97cdde685e07ae2d47d6a58f44b83dd
Latest deploy log https://app.netlify.com/sites/kubernetes-ingress-nginx/deploys/671f9be053679200082cffd9

netlify[bot] avatar Oct 02 '24 09:10 netlify[bot]

Ciao @vanny96!

Thank you very much for your contributions! Some first notes:

Could you please not commit the go.work.sum as long as you haven't changed anything on the go.work or go.mod file?

Do you think there would be a way to only set this option if it differs from the global default? If I understand your change correctly, you're trying to achieve that one can disable logging globally and only enable it for specific locations, right?

If so, this totally makes sense to me. But I think we can achieve this without changing the type of the configuration option, which would be a breaking change.

Mille grazie Marco

Gacko avatar Oct 04 '24 09:10 Gacko

/hold

Please do not proceed with any nginx.tmpl change until we can finish the crossplane migration.

Thanks!

rikatz avatar Oct 10 '24 15:10 rikatz

Hey @Gacko,

First of all, I'm sorry for the go.sum, Goland likes to shuffle things around and I didn't pay enough attention! I'll fix it now!

My intention was exactly what you mentioned! Being able to disable access_log globally and re-enable it locally would be the idea! I tried to think of all the edge cases and couldn't come up with a way to support it without changing it (while still keeping back compatibility)

End goal:

  • enable-access-log: true -> always sets access_log on;
  • enable-access-log: false -> always sets access_log off;
  • enable-access-log is unset -> follows the previous behaviour

Things I tried:

  • Writing logic with only "true" and "false": This unfortunately didn't give us enough info as from the template we cannot identify if a variable is true/false or unset.
  • Turning the configuration from a bool to a *bool: This is honestly the one that would make most sense, but I struggled quite a bit to handle the nil scenario in the template as it would constantly throw dereference errors

Maybe I can spend some more time on this second approach, but otherwise do you have any other possible ideas to explore?

vanny96 avatar Oct 11 '24 09:10 vanny96

Hey @Gacko, did you have a chance to take a look at this?

vanny96 avatar Oct 28 '24 14:10 vanny96

This is stale, but we won't close it automatically, just bare in mind the maintainers may be busy with other tasks and will reach your issue ASAP. If you have any question or request to prioritize this, please reach #ingress-nginx-dev on Kubernetes Slack.

github-actions[bot] avatar Jan 31 '25 02:01 github-actions[bot]

The lifecycle/frozen label can not be applied to PRs.

This bot removes lifecycle/frozen from PRs because:

  • Commenting /lifecycle frozen on a PR has not worked since March 2021
  • PRs that remain open for >150 days are unlikely to be easily rebased

You can:

  • Rebase this PR and attempt to get it merged
  • Close this PR with /close

Please send feedback to sig-contributor-experience at kubernetes/community.

/remove-lifecycle frozen

k8s-triage-robot avatar Jan 31 '25 04:01 k8s-triage-robot