fix: Resolve duplicate volume mounts for custom plugins sharing same ConfigMap #879
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.
Fix: Resolve duplicate volume mounts for custom plugins sharing same ConfigMap
Problem
When multiple APISIX custom plugins reference the same ConfigMap, the Helm chart creates duplicate volume mounts, causing deployment failures. This occurs because the chart template generates a volume for each plugin individually, without checking if multiple plugins share the same ConfigMap.
Example:
Solution
This PR introduces a helper function that deduplicates ConfigMap references across custom plugins, ensuring only one volume is created per unique ConfigMap while preserving all individual plugin file mounts.
Changes Made
Added helper function in
templates/_helpers.tpl:apisix.uniqueConfigMaps: Collects and returns unique ConfigMap names from all custom pluginsModified deployment template in
templates/deployment.yaml:Before vs After
Before (Broken):
Result: Duplicate volume mount error
After (Fixed):
Benefits
Testing
This fix resolves the deployment issue while maintaining the clean, intuitive configuration format for custom plugins.