Skip to content

feat(helm) add namespaceOverride#1711

Open
TheRealNoob wants to merge 4 commits into
kubernetes-sigs:masterfrom
TheRealNoob:namespace-override
Open

feat(helm) add namespaceOverride#1711
TheRealNoob wants to merge 4 commits into
kubernetes-sigs:masterfrom
TheRealNoob:namespace-override

Conversation

@TheRealNoob

Copy link
Copy Markdown

What this PR does / why we need it:
adds support for namespaceOverride in values file, useful if this chart is subcharted. For example, many people include myself probably subchart this as part of their "standard monitoring deployment" and want to direct metrics-server off to namespace=kube-system.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
none

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 27, 2025
@k8s-ci-robot k8s-ci-robot added the needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. label Aug 27, 2025
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

Welcome @TheRealNoob!

It looks like this is your first PR to kubernetes-sigs/metrics-server 🎉. 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/metrics-server 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 k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Aug 27, 2025
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

Hi @TheRealNoob. 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.

Details

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 k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Aug 27, 2025
@TheRealNoob TheRealNoob changed the title [helm] add namespace override feat(helm) add namespaceOverride Aug 28, 2025
@rexagod

rexagod commented Aug 30, 2025

Copy link
Copy Markdown
Member

/ok-to-test

@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. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Aug 30, 2025
@rexagod rexagod moved this to Needs Triage in SIG Instrumentation Aug 30, 2025
@TheRealNoob

Copy link
Copy Markdown
Author

so i see that one test failed, but i'm scratching my head wondering how that could be caused by my change here.....any pointers would be much appreciated

@stevehipwell

Copy link
Copy Markdown
Contributor

@TheRealNoob I'm not sure we want to go down this avenue, but I'm open to being convinced. My main concern is that Helm doesn't have sub-charts, it has dependencies but these charts are just flattened to create a single "chart". Could you please explain what benefit you get from this pattern and why it's worth the implicit downsides? It seems to me that you're attempting to solve an issue in the layers above the chart by modifying the chart causing a leaking abstraction.

@TheRealNoob

Copy link
Copy Markdown
Author

One of the most popular use-cases for namespaceOverride is creating an umbrella chart and then selectively changing the namespace for specific subcharts. For example, creating a chart that rolls together all of your monitoring tools into one release. You would probably pull together kube-prometheus-stack, prometheus-operator-admission-webhook, prometheus-operator-crds, metrics-server, another example exporter, etc. helm install monitoring-stack umbrella/chart -n monitoring would force all of these subcharts to that namespace, but metrics-server typically goes to namespace=kube-system, which could be overridden with this PR.

I can understand your hesitation to think I'm setting up some unique scenario but it is quite common

I see metrics-server as a staple of every monitoring stack, so I'm a bit surprised this hasn't been added before now to be honest

@TheRealNoob

Copy link
Copy Markdown
Author

@stevehipwell could i get a re-review please

@stevehipwell

Copy link
Copy Markdown
Contributor

@TheRealNoob I'm familiar with the umbrella chart principal and why you might want to do this, but as a general rule of thumb it's not the kind of pattern that you want to be using for something as important as Metrics Server.

@TheRealNoob

Copy link
Copy Markdown
Author

but as a general rule of thumb it's not the kind of pattern that you want to be using

It sounds like this is the crux of where we're not seeing eye to eye. Could I ask you to elaborate on why you see this as an unappealing implementation/solution?

@TheRealNoob

Copy link
Copy Markdown
Author

@stevehipwell I would really like to keep moving this PR forward with your support. I have looked into each SIG-instrumentation managed project and found that all of them which support helm charts already implement namespaceOverride, leaving metrics-server as the outlier which this PR addresses:

In addition to the above projects which already implement namespaceOverride, I have found several other kubernetes-sig projects that do:

Because metrics-server is a staple of every monitoring stack, it should support the standard patterns operators use to deploy them. This is a purely opt-in feature with zero impact when unset -- the rendered output is identical to today's behavior. Lacking namespaceOverride doesn't make metrics-server safer -- it just forces users to manage it outside their unified deployment or deploy it to the wrong namespace.

I'd welcome any specific technical concerns about this approach.

@stevehipwell

Copy link
Copy Markdown
Contributor

@TheRealNoob do the charts you've linked to above have a governance process or are they free contribution? Free contribution charts generally tend towards exposing the the whole KRM API via the Helm chart values. This chart is explicitly opinionated with the aim to be the "correct" way to deploy Metrics Server with Helm. This change is not aligned with the aim of this Helm chart.

@aw-talos

Copy link
Copy Markdown

@stevehipwell Where is the aim of the Helm chart documented?

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Feb 27, 2026
@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 1, 2026
@TheRealNoob

TheRealNoob commented Mar 3, 2026

Copy link
Copy Markdown
Author

I understand your concern about exposing too much of the KRM API. However in this case, the user already has the ability to control the namespace via built-in Helm capabilities helm install -n NAMESPACE. This PR only offers an alternative way to control it. It adds no security risk, doesn't change anything for existing users (unless they opt-in), and doesn't encroach across the KRM API at all. I have also demonstrated that this feature is an accepted standard by many organizations including prometheus-community, kubernetes (sig-scheduling, sig-node, sig-ui, sig-cloud-provider), and others.

I'd also like to understand what you mean by this chart being "explicitly opinionated". If there's a documented design philosophy for this chart, I'd like to review it so I can align this PR accordingly. If it's an informal position, I think it's worth reconsidering given how broadly this pattern is accepted across the Kubernetes ecosystem. Ultimately, the other projects I've listed implemented namespaceOverride because their users asked for it -- the same is true here. An opinionated chart should still align with the expectations of the ecosystem it serves.

@rexagod

rexagod commented Mar 20, 2026

Copy link
Copy Markdown
Member

/assign @stevehipwell
/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Mar 20, 2026
@rexagod

rexagod commented Mar 20, 2026

Copy link
Copy Markdown
Member

/cc @skl

@k8s-ci-robot k8s-ci-robot requested a review from skl March 20, 2026 15:50
@TheRealNoob

Copy link
Copy Markdown
Author

@stevehipwell If you could spare some time to review please? I really don't want to see this sit several months again with no progress.

@stevehipwell stevehipwell left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@TheRealNoob just a minor change.

Comment thread charts/metrics-server/templates/_helpers.tpl
@github-project-automation github-project-automation Bot moved this from Needs Triage to In Progress in SIG Instrumentation May 15, 2026
@k8s-ci-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: TheRealNoob
Once this PR has been reviewed and has the lgtm label, please ask for approval from stevehipwell. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details 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

compact helper logic

Co-authored-by: Steve Hipwell <steve.hipwell@gmail.com>
@skl

skl commented May 18, 2026

Copy link
Copy Markdown
Member

/retest

@skl

skl commented May 18, 2026

Copy link
Copy Markdown
Member

@TheRealNoob ci failed a couple of times, I wonder if you need another rebase?

@TheRealNoob

TheRealNoob commented May 30, 2026

Copy link
Copy Markdown
Author

I merged main. I had a look at the failing test and I suspect it's just flaky. at the very least it's not related to this change since the test case is metrics-server's exposing CPU metrics; a e2e test. i saw this same error when i first opened the PR then later on it went away. perhaps run the test a few times until it passes? or I can add blank commits to trigger it? I'll wait for your thoughts.

@TheRealNoob

Copy link
Copy Markdown
Author

I see that the helm installed succeeded. log lines 243 - 260 show it installed to namespace=kube-system

@skl

skl commented Jun 19, 2026

Copy link
Copy Markdown
Member

/retest-required

@skl skl left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Also suggest adding namespaceOverride to README.md.


- Add chart options to secure the connection between Metrics Server and the Kubernetes API Server. ([#1288](https://github.com/kubernetes-sigs/metrics-server/pull/1288)) _@mkilchhofer_
- Add `unhealthyPodEvictionPolicy` to the Metrics Server PDB as a user enabled feature. ([#1574](https://github.com/kubernetes-sigs/metrics-server/pull/1574)) @peterabarr
- Add `namespaceOverride` which allows deploying to a namespace other than `.Release.namespace`. ([#1710](https://github.com/kubernetes-sigs/metrics-server/pull/1710)) @TheRealNoob

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
- Add `namespaceOverride` which allows deploying to a namespace other than `.Release.namespace`. ([#1710](https://github.com/kubernetes-sigs/metrics-server/pull/1710)) @TheRealNoob
- Add `namespaceOverride` which allows deploying to a namespace other than `.Release.namespace`. ([#1711](https://github.com/kubernetes-sigs/metrics-server/pull/1711)) @TheRealNoob

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

6 participants