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

Chart: Make controller.config templatable. #11181

Merged
merged 6 commits into from
Apr 4, 2024

Conversation

TheRealNoob
Copy link
Contributor

What this PR does / why we need it:

Allows templating of controller.config

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • 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

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 unit and/or e2e tests to cover my changes.
  • All new and existing tests passed.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Mar 30, 2024
@k8s-ci-robot k8s-ci-robot added needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. area/helm Issues or PRs related to helm charts needs-kind Indicates a PR lacks a `kind/foo` label and requires one. labels Mar 30, 2024
@k8s-ci-robot
Copy link
Contributor

Welcome @TheRealNoob!

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

@k8s-ci-robot
Copy link
Contributor

Hi @TheRealNoob. 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 needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-priority size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 30, 2024
Copy link

netlify bot commented Mar 30, 2024

Deploy Preview for kubernetes-ingress-nginx canceled.

Name Link
🔨 Latest commit 3d30894
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-ingress-nginx/deploys/660ae6dda42d6c0008b2789d

@longwuyuan
Copy link
Contributor

@TheRealNoob , any chance you can create a issue first and describe the current problem with the chart ?

  • Improvements are always welcome but there is ambiguity here as to what problem is currently faced by users
  • Please link the issue you create to this PR
  • I request that you kindly post the complete detailed deug info like
    • your kind cluster where you test this details of creation and config
    • your complete and exact install prcess along with the values file and the resulting resources created like the configMap shown as outputs of commands like kubectl describe
    • How you used the templated config to host your app in K8S showing how it was not possible before this change

@TheRealNoob
Copy link
Contributor Author

I can create an issue describing the value add of this PR. As for the testing I added a unittest for it. To be honest I felt it was a little unnecessary as it's a simple tpl, but I could go either way. Do you still want me to detail how I did my testing locally?

@longwuyuan
Copy link
Contributor

@TheRealNoob thank you for the contribution, really helps

For a normal user reader, the difference between a template for the config and a manually contructed typed content in the values file (indents and all etc), is elaborate with a issue describing what is not possible without a template or what becomes better with a template.

We may have to add explaining/docs text the values file for improved experience. So I asked. Please dont feel I insisted.

Also wait for other comments as others may also opine that this is enough to move forward.

Thank you

@Gacko
Copy link
Member

Gacko commented Apr 1, 2024

/retitle Chart: Make controller.config templatable.
/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Apr 1, 2024
@k8s-ci-robot k8s-ci-robot changed the title [helm] pass controller.config through tpl Chart: Make controller.config templatable. Apr 1, 2024
@Gacko
Copy link
Member

Gacko commented Apr 1, 2024

/kind feature
/priority backlog

@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. priority/backlog Higher priority than priority/awaiting-more-evidence. and removed needs-kind Indicates a PR lacks a `kind/foo` label and requires one. needs-priority labels Apr 1, 2024
Copy link
Member

@Gacko Gacko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some suggestions. In general I'm not sure if this changes brings more risks than it improves the way users can customize Ingress NGINX to their needs.

You in your case seem to request this change because you're deploying Ingress NGINX in many different namespaces, maybe even as a sub chart.

We should take care not to implement logic that should be handled by users' CI instead, especially if it could weaken type safety like this proposal.

charts/ingress-nginx/values.yaml Outdated Show resolved Hide resolved
charts/ingress-nginx/tests/controller-configmap_test.yaml Outdated Show resolved Hide resolved
charts/ingress-nginx/README.md Outdated Show resolved Hide resolved
@TheRealNoob
Copy link
Contributor Author

TheRealNoob commented Apr 1, 2024

@Gacko

Added some suggestions. In general I'm not sure if this changes brings more risks than it improves the way users can customize Ingress NGINX to their needs.

I considered that this might be interpreted as a security risk but dismissed it after realizing that this would only be possible if someone added something to the values file and re-deployed. The act of deploying would require the same level of permissions as editing the object directly, so it's not a security risk from a nefarious actor point of view. The only thing that leaves is the possibility that an administrator intends to deploy one thing, but mistakenly deploys another enabled by this change. Ultimately I concluded that it's a low risk that they'd use double brackets without knowing their special meaning in Helm.

We should take care not to implement logic that should be handled by users' CI instead

Sorry I don't quote follow your train of thought here, perhaps you could elaborate?

especially if it could weaken type safety like this proposal.

I also considered this but also dismissed this concern since it's already going through the quote function. I went through several iterations of this response adding additional light and elaborating on edge cases, also considering removing the quote function as it causes issues in some cases whereas toString does not, but figured others here would prefer keeping it for the users that define unquoted lines with spaces.

@Gacko
Copy link
Member

Gacko commented Apr 3, 2024

The risks I am talking of are mainly about maintaining the chart and supporting users. Some changes might make that harder as they are making the behavior of the chart unpredictable while users are still expecting us to support them in case they are having issues with using what we deliver.

So in the end we always consider if a change is really required by more than just one user and still easy to understand and maintain in the future.

@Gacko
Copy link
Member

Gacko commented Apr 3, 2024

Anyways, I'll give that PR another look by tomorrow (hopefully) and LGTM it asap.

@Gacko
Copy link
Member

Gacko commented Apr 4, 2024

/label tide/merge-method-squash

@k8s-ci-robot k8s-ci-robot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Apr 4, 2024
@Gacko
Copy link
Member

Gacko commented Apr 4, 2024

/assign

@Gacko
Copy link
Member

Gacko commented Apr 4, 2024

/ok-to-test
/triage accepted
/unhold
/lgtm

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. triage/accepted Indicates an issue or PR is ready to be actively worked on. lgtm "Looks good to me", indicates that a PR is ready to be merged. and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Apr 4, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Gacko, TheRealNoob

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 k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 4, 2024
@k8s-ci-robot k8s-ci-robot merged commit ad274ab into kubernetes:main Apr 4, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/helm Issues or PRs related to helm charts 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. lgtm "Looks good to me", indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. priority/backlog Higher priority than priority/awaiting-more-evidence. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants