Improve namespacing of templates to prevent conflicts between charts #343
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.
Currently, some templates are defined in multiple charts under the same name, but with different implementations. Sometimes these implementations are completely incompatible, such as the
neo4j.nodeSelector
template being incompatible between theneo4j
andneo4j-admin
charts.This is a problem because it is often desirable to maintain these charts together as subcharts of a common parent chart. For example, I'm trying to use this
Chart.yaml
alongside an appropriatevalues.yaml
to manage a database and its associated backup infrastructure in a single chart as part of a larger application:This currently errors out due to the conflicting definitions of some templates.
The solution used here is to namespace all of the templates by the specific chart that they are a part of rather than by simply
neo4j
. For example, the fullname template inneo4j-admin
is renamed fromneo4j.fullname
toneo4jAdmin.fullname
to prevent a potential conflict with the mainneo4j
chart. The actual method of doing this was just a find-replace of(?<=define |template )"neo4j.([^"]*)"
for"<chartname>.$1"
within each chart.A note on testing: I only tested this so far as making sure it worked for my
neo4j
+neo4j-admin
setup. I couldn't figure out how to run the tests locally, but I'm assuming they should run on this PR and catch any cases I might have missed.