Skip to content

Conversation

@kubeagon
Copy link

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

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
@kubeagon kubeagon requested a review from a team as a code owner September 21, 2025 16:22
…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
@kubeagon kubeagon closed this Sep 21, 2025
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.

1 participant