Deprecate Namespace Resource in Helm Chart in favour of helms --creat… #214
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Creating namespaces within Helm charts can introduce significant issues related to security, deployment consistency, and best practices.
Assumptions About the Default Namespace
When a Helm chart dynamically creates a namespace, it often assumes that the chart itself is running in the default namespace. This is problematic because best practices dictate avoiding the default namespace for deployments to maintain a clean and organized cluster. This assumption can lead to resources being created from within the default namespace, which is not a secure or scalable practice.
Complications with Namespace Management
If the chart is not run from the default namespace, this approach forces the creation of a new namespace from an existing one, potentially leading to an unnecessary proliferation of namespaces. For instance, if you deploy the Helm chart from a dedicated namespace, it would create yet another namespace, resulting in a cluttered environment with multiple namespaces—one for the Helm chart and another for the deployed resources.
Security Concerns
Allowing Helm charts to create namespaces can bypass security controls, especially in environments where developers and operators lack permissions to create namespaces. This can lead to unauthorized changes and the creation of unintended or insecure environments.
Deployment to Specific Namespaces
Deploying to specific, predetermined namespaces ensures resources are placed in the correct environment, such as staging or production. Dynamically creating namespaces risks deploying resources into unexpected namespaces, leading to misconfigurations and operational overhead.
Avoiding the Default Namespace
Using dynamic namespaces can result in deployments ending up in the default namespace, which is discouraged. The default namespace can become cluttered, pose security risks, and complicate resource management, particularly in environments with multiple applications or teams.
Best Practices
Best practices suggest managing namespaces separately from Helm charts, specifying the target namespace during deployment. This approach ensures resources are deployed consistently and securely within existing, approved namespaces, avoiding the pitfalls of dynamic namespace creation.