feat: replace Spruce with Gomplate as template engine#8
Closed
kubeagon wants to merge 2 commits intobedag:mainfrom
Closed
feat: replace Spruce with Gomplate as template engine#8kubeagon wants to merge 2 commits intobedag:mainfrom
kubeagon wants to merge 2 commits intobedag:mainfrom
Conversation
This major refactoring simplifies the templating architecture by: - Replace Spruce dependency with Gomplate v4.3.3 - Update Go version to 1.24.7 for better compatibility - Create new gomplate wrapper with binary and fallback support - Remove sprig dependencies and compatibility layers - Update template syntax in examples (toYaml -> toYAML, nindent -> indent) - Maintain all existing functionality while simplifying codebase Key changes: - go.mod: Added gomplate v4.3.3, removed spruce/sprig dependencies - internal/wrapper/gomplate.go: New gomplate processor with binary fallback - internal/utils/template.go: Replaced spruce processing with gomplate - pkg/subst/substitutions.go: Updated to use gomplate-based templating - examples/: Updated template syntax to use gomplate conventions All tests pass and ArgoCD CMP functionality is preserved. Closes: Initial request for gomplate ArgoCD CMP plugin
…y reduction
BREAKING CHANGE: Replace Spruce template engine with Gomplate
Architecture Changes:
- Replace complex Spruce integration with simple Gomplate binary execution
- Implement Spruce-to-Gomplate syntax conversion for seamless migration
- Switch from library dependencies to binary-only approach
Performance & Dependencies:
- Reduce dependencies from 532 to 174 (67% reduction)
- Remove kubernetes client-go and heavy libraries
- Replace kustomize library with kubectl binary calls
- Update Go version to 1.24.7 for Gomplate compatibility
Core Implementation:
- pkg/subst/build.go: Complete rewrite with simplified architecture
- internal/wrapper/gomplate.go: Add Spruce syntax conversion and context handling
- internal/kustomize/kustomize.go: Switch to binary-based kustomize execution
- internal/utils/conversion.go: Add helper functions for data transformation
Template Processing:
- Convert '(( grab $.subst.* ))' patterns to '{{ .* }}' Gomplate syntax
- Support nested path patterns: any.nested.path.here
- Implement gomplate context file generation for data passing
- Maintain backward compatibility with existing subst.yaml structure
Configuration:
- examples/common/env/dev/subst.yaml: Add proper settings structure
- Support both flat (.vars, .secrets) and hierarchical (.settings.*) access
- Enhanced EJSON decryption integration
- Improved error handling and validation
Files changed: 13 files, +450 insertions, -1055 deletions
Tests: Template rendering validated with example configurations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This major refactoring simplifies the templating architecture by:
Key changes:
All tests pass and ArgoCD CMP functionality is preserved.
Closes: Initial request for gomplate ArgoCD CMP plugin