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

ZEP-0017: Chart Namespace Overrides #18

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

Conversation

Racer159
Copy link
Contributor

@Racer159 Racer159 commented Feb 4, 2025

  • One-line PR description: Add chart namespace overrides for Zarf packages to be deployed to the same cluster multiple times.
  • Other comments:

@Racer159
Copy link
Contributor Author

Racer159 commented Feb 4, 2025

Leaving as a draft for initial feedback before filling additional sections.


### Non-Goals

- Move away from the declarative nature of Zarf packages
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like a non goal here is to allow dynamic configuration of namespaces? If so, it would be worth discussing in the motivation why we'd want this feature for charts and not manifests. Given that manifests and charts can have the same name, if we decide to add dynamically configured namespaces for manifests in the future it'd be a breaking change.


**As** Jacquline **I want** to be able to set namespace overrides **so that** I can install the same package with different configurations in different namespaces.

##### Option 1 (Flatter Namespaces)
Copy link
Contributor

Choose a reason for hiding this comment

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

I like option 1 the best, I feel namespaces should be a first class citizen

Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we want to treat namespace specially from any other variable?

Copy link
Contributor

Choose a reason for hiding this comment

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

Zarf variables are templated into manifests, values-files, and helm-charts. For example, if you had the variable ###ZARF_VAR_MY_IMAGE_TAG### in your values file and the value was set to v0.0.1, when Zarf deploys that manifest it will change the value to v0.0.1. My worry is if we also make variables a way to define namespaces based on the name of the variable, it will feel magical.

@Racer159 Racer159 force-pushed the 0017-chart-namespace-overrides branch from c0a9bc6 to dd70769 Compare February 5, 2025 20:14
Signed-off-by: Wayne Starr <[email protected]>
@Racer159
Copy link
Contributor Author

Racer159 commented Feb 6, 2025

Option 5 could also be adapted to the ### package template syntax or another syntax


**As** Jacquline **I want** to be able to set namespace overrides **so that** I can install the same package with different configurations in different namespaces.

##### Option 1 (Flatter Namespaces)
Copy link

@mjnagel mjnagel Feb 12, 2025

Choose a reason for hiding this comment

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

I generally like option 1 the best, but wonder if "configurable-namespaces" should be a toggle in the package at create time? With some packages there's absolutely a desire/need to make the namespace flexible but others might struggle a lot with namespace flexibility (thinking of uds-core for example). Having the package author explicitly allow or not allow configuring namespaces might be also align with keeping the declarative nature of zarf packages even more.

Tangentially related - if templates within a zarf package/helm chart needed to access the namespace (outside of the normal metadata.namespace usage) would this override be available as a zarf var or other value? EDIT: Just read below and connected dots - .Release.Namespace could be used anywhere so this is a non-issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

A feature like .metadata.configurable-namespaces that defaults to true would make sense to solve that. For my understanding could you give a situation where allowing a user to configure their namespace might break a package?

Copy link

Choose a reason for hiding this comment

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

UDS Core is probably the best example I can provide. When you have multiple helm charts in a single zarf package (in this case 10+) and each needs to be aware of the namespace that the other lives in so that things like networkpolicies are properly created (or even if there were svc -> svc connections across namespaces), making sure that all works would be pretty messy since .Release.Namespace is only available within the context of the single chart. Chart A couldn't auto-detect the namespace that Chart B is deployed in, so you'd have to add another mechanism to pass chart names for "siblings" around. I think it could over-complicate a package in a way that the package maintainer doesn't want to support 😄.

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes perfect sense, thanks for the explanation!

Copy link
Contributor

Choose a reason for hiding this comment

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

In general I'm fine with option 1, but I gotta ask: what if a helm chart or other artifact wants to deploy into more than a single namespace? Will we warn about using --namespace in that case or at least discourage in the docs or maybe that's not even possible today?

Copy link
Contributor

@soltysh soltysh left a comment

Choose a reason for hiding this comment

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

See my last question and all the TODO are needed to be resolved before this is good to go.


**As** Jacquline **I want** to be able to set namespace overrides **so that** I can install the same package with different configurations in different namespaces.

##### Option 1 (Flatter Namespaces)
Copy link
Contributor

Choose a reason for hiding this comment

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

In general I'm fine with option 1, but I gotta ask: what if a helm chart or other artifact wants to deploy into more than a single namespace? Will we warn about using --namespace in that case or at least discourage in the docs or maybe that's not even possible today?

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

Successfully merging this pull request may close these issues.

4 participants