Skip to content
This repository has been archived by the owner on Feb 22, 2022. It is now read-only.

[stable/metrics-server] cannot accept a namespace when templating #17909

Closed
alexellis opened this issue Oct 11, 2019 · 8 comments
Closed

[stable/metrics-server] cannot accept a namespace when templating #17909

alexellis opened this issue Oct 11, 2019 · 8 comments
Labels
lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@alexellis
Copy link

Describe the bug
A clear and concise description of what the bug is.

I would expect to be able to download and render this chart into YAML files and then apply them into the namespace given when rendering.

helm template metrics-server --name metrics-server --output-dir metrics-server/rendered --values metrics-server/values.yaml  --namespace kube-system

I didn't see kube-system in the Deployment, but I do see it there when running helm install with tiller

metrics-server/rendered/metrics-server/templates/metrics-server-deployment.yaml
---
# Source: metrics-server/templates/metrics-server-deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: metrics-server
  labels:
    app: metrics-server
    chart: metrics-server-2.8.8
    release: metrics-server
    heritage: Tiller

For the OpenFaaS chart, we include the namespace in the templates to cover this scenario.

Version of Helm and Kubernetes:

space-mini:charts alex$ kubectl version
Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.6", GitCommit:"96fac5cd13a5dc064f7d9f4f23030a6aeface6cc", Git
TreeState:"clean", BuildDate:"2019-08-19T11:13:49Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.6-k3s.1", GitCommit:"4cd85f14854d942e9016cc15f399785c103242e9
", GitTreeState:"clean", BuildDate:"2019-08-19T16:12+00:00Z", GoVersion:"go1.12.9", Compiler:"gc", Platform:"linux/amd64"}

space-mini:charts alex$ helm version -c
Client: &version.Version{SemVer:"v2.14.1", GitCommit:"5270352a09c7e8b6e8c9593002a73535276507c0", GitTreeState:"clean"}

The following questions are mentioned above, free-form. Hope that is OK.

Which chart:

What happened:

What you expected to happen:

How to reproduce it (as minimally and precisely as possible):

Anything else we need to know:

I would see the template changing:

From:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ template "metrics-server.fullname" . }}
  labels:
    app: {{ template "metrics-server.name" . }}
    chart: {{ template "metrics-server.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}

To something like:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: {{ template "metrics-server.fullname" . }}
  namespace: {{ .Release.Namespace }}
  labels:
    app: {{ template "metrics-server.name" . }}
    chart: {{ template "metrics-server.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}

Please could someone provide input?

@alexellis
Copy link
Author

@mcristina422 + @bblenard I saw you in the git blame, could you have a look please?

@alexellis
Copy link
Author

alexellis added a commit to alexellis/k3sup that referenced this issue Oct 11, 2019
The chart doesn't support templating of the namespace yet

helm/charts#17909

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
@mcristina422
Copy link
Contributor

@alexellis taking a look at all the charts in this repo it seems like most resources do not specify the namespace

I guess a workaround is kubectl apply -n kube-system -f metrics-server/rendered

@alexellis
Copy link
Author

Thank you for the workaround, I'll try it.

I know cert-manager does this, at least in their upstream.

@alexellis alexellis reopened this Oct 11, 2019
@alexellis
Copy link
Author

@munnerz

@bblenard
Copy link
Contributor

@alexellis I also checked around the repo for charts that specify namespace but didn't see any. I'm not sure if makes sense to be able to specify namespace in the values file. Does @mcristina422's suggestion not work for your use case?

alexellis added a commit to alexellis/k3sup that referenced this issue Oct 15, 2019
The chart doesn't support templating of the namespace yet

helm/charts#17909

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
@stale
Copy link

stale bot commented Nov 11, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any further update will cause the issue/pull request to no longer be considered stale. Thank you for your contributions.

@stale stale bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Nov 11, 2019
@stale
Copy link

stale bot commented Nov 25, 2019

This issue is being automatically closed due to inactivity.

@stale stale bot closed this as completed Nov 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

No branches or pull requests

3 participants