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

Inconsistent default namespace selection for Helm chart #1503

Closed
Tracked by #2847
pratheekrebala opened this issue Mar 22, 2021 · 1 comment
Closed
Tracked by #2847

Inconsistent default namespace selection for Helm chart #1503

pratheekrebala opened this issue Mar 22, 2021 · 1 comment
Assignees
Labels
area/helm kind/bug Some behavior is incorrect or out of spec mro2 Monica's list of 2st tier overlay related issues resolution/fixed This issue was fixed

Comments

@pratheekrebala
Copy link

pratheekrebala commented Mar 22, 2021

By default, if a helm chart is deployed without a namespace - it is deployed into the default namespace. This behavior is different from other resources in this provider which default to the namespace specified in the provider config (or in the kubectl context).

It would be ideal if the chart can be deployed into the namespace specified in the stack config. Alternatively, if this behavior is intentional it would be helpful if this could be documented and/or raise a warning.

Thank you!

Expected behavior

When no namespace is provided, the Helm chart resource should use the namespace specified in the provider selection logic specified here:

A namespace can be specified in multiple places, and the precedence is as follows:

  1. .metadata.namespace set on the resource.
  2. This namespace parameter.
  3. namespace set for the active context in the kubeconfig.

Current behavior

The default namespace is hard-coded to default. This behavior is programmed here:

https://github.com/pulumi/pulumi-kubernetes/blob/155b56cd0718c05fe46e50d5fdbcc2f9a27d9f8f/provider/pkg/provider/invoke_helm_template.go#L205:L208

Steps to reproduce

  1. Set default namespace in provider config: pulumi config set kubernetes:namespace not-default
  2. Create a helm chart without a namespace:
from pulumi_kubernetes.helm.v3 import Chart, LocalChartOpts

nginx_ingress = Chart(
    "nginx-ingress",
    LocalChartOpts(
        path="./nginx-ingress",
    ),
)
  1. Chart is not deployed in the not-default namespace as defined in the provider config: kubectl get all -n not-default
  2. Chart is deployed in the default namespace despite the provider config. kubectl get all -n default

Context (Environment)

I am using Pulumi to orchestrate a stack that involves a helm chart along with a few different Kubernetes resources. I was expecting that the behavior for namespace selection would be the same across the entire provider.

Affected feature

PR: #1323
Issue: #1321

@pratheekrebala pratheekrebala added the kind/bug Some behavior is incorrect or out of spec label Mar 22, 2021
@mnlumi mnlumi added the mro2 Monica's list of 2st tier overlay related issues label Mar 28, 2023
@lblackstone lblackstone removed their assignment Jul 14, 2023
@EronWright EronWright added the resolution/fixed This issue was fixed label May 14, 2024
@EronWright EronWright self-assigned this May 14, 2024
@EronWright
Copy link
Contributor

I've confirmed that this is fixed in the upcoming Chart v4 resource. The namespace is defaulted in this order, from lowest to highest priority:

  1. The kubecontext namespace
  2. The provider's namespace input property
  3. The Chart resource's namespace input property
  4. The object's .metadata.namespace field

I would hesitate the change the behavior of Chart v2/v3 because it could be considered a breaking change. I'm closing this as fixed in v4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/helm kind/bug Some behavior is incorrect or out of spec mro2 Monica's list of 2st tier overlay related issues resolution/fixed This issue was fixed
Projects
None yet
Development

No branches or pull requests

4 participants