Skip to content

Add namespace metadata option in templates #247

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

MannerMan
Copy link

This sets the namespace key in metadata for all kubernetes manifests. The .Release.Namespace is a built-in variable in helm, that can be passed with --namespace on install or template step. If not set it defaults to default.

Why?

When using helm install with the --namespace argument the templates are applied into the chosen namespace.

When using helm only as a template engine, in combination with GitOps tools like Flux, the namespace property must be set in the rendered manifests to be applied. For --namespace to have an effect when using helm template, it must be present like this in the templates.

This change should not have any effect/change for helm install approach as far as I know.

Pull Request

Related issue

Possibly a fix for #230

What does this PR do?

  • Sets the namespace key in metadata for all kubernetes manifests

PR checklist

Please check if your PR fulfills the following requirements:

  • [ x ] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
  • [ x ] Have you read the contributing guidelines?
  • [ x ] Have you made sure that the title is accurate and descriptive of the changes?

This sets the namespace key in metadata for all kubernetes manifests.
The `.Release.Namespace` is a built-in variable in helm, that can be
passed with` --namespace` on `install` or `template` step. If not set
it defaults to `default`.

*Why?*

When using `helm install` with the `--namespace` argument the templates
are applied into the chosen namespace.

When using helm only as a template engine, in combination with GitOps
tools like Flux, the namespace property must be set in the rendered
manifests to be applied. For `--namespace` to have an effect when using
`helm template`, it must be present like this in the templates.

This change should not have any effect/change for `helm install`
approach as far as I know.
@curquiza curquiza requested a review from brunoocasali January 29, 2025 13:56
@brunoocasali
Copy link
Member

@meilisearch sync-manifest

Copy link
Member

@brunoocasali brunoocasali left a comment

Choose a reason for hiding this comment

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

bors merge

Thanks for this improvement @MannerMan :)

@brunoocasali brunoocasali added the enhancement New feature or request label Feb 17, 2025
meili-bors bot added a commit that referenced this pull request Feb 17, 2025
247: Add namespace metadata option in templates r=brunoocasali a=MannerMan

This sets the namespace key in metadata for all kubernetes manifests. The `.Release.Namespace` is a built-in variable in helm, that can be passed with `--namespace` on `install` or `template` step. If not set it defaults to `default`.

**Why?**

When using `helm install` with the `--namespace` argument the templates are applied into the chosen namespace.

When using helm only as a template engine, in combination with GitOps tools like Flux, the namespace property must be set in the rendered manifests to be applied. For `--namespace` to have an effect when using `helm template`, it must be present like this in the templates.

This change should not have any effect/change for `helm install` approach as far as I know.

# Pull Request

## Related issue
Possibly a fix for #230

## What does this PR do?
- Sets the namespace key in metadata for all kubernetes manifests

## PR checklist
Please check if your PR fulfills the following requirements:
- [ x ] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)?
- [ x ] Have you read the contributing guidelines?
- [ x ] Have you made sure that the title is accurate and descriptive of the changes?



Co-authored-by: Oscar <[email protected]>
Co-authored-by: Bruno Casali <[email protected]>
Co-authored-by: brunoocasali <[email protected]>
Copy link
Contributor

meili-bors bot commented Feb 17, 2025

Build failed:

@curquiza
Copy link
Member

@brunoocasali or @MannerMan can you fix the conflict please? sorry for that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants