Summary
The K8s manifest templates (ConfigMap, Deployment, Service, ServiceAccount, Secret) and the Containerfile template are currently hardcoded as Go template strings in pkg/manifest/k8s.go and pkg/manifest/containerfile.go.
These should be extracted to separate template files and loaded via go:embed for:
- Readability — templates are easier to edit as standalone files with proper syntax highlighting
- Maintainability — changes to YAML structure don't require modifying Go code
- Customization — users could override templates by providing their own (future)
Files to change
| Current |
Proposed |
pkg/manifest/k8s.go (inline templates) |
pkg/manifest/templates/configmap.yaml.tmpl |
|
pkg/manifest/templates/deployment.yaml.tmpl |
|
pkg/manifest/templates/service.yaml.tmpl |
|
pkg/manifest/templates/serviceaccount.yaml.tmpl |
|
pkg/manifest/templates/secret.yaml.tmpl |
pkg/manifest/containerfile.go (inline template) |
pkg/manifest/templates/Containerfile.tmpl |
Use //go:embed templates/*.tmpl to load them at compile time.
Context
From PR #74 code review. Deferred to keep the PR focused on the agent manifest feature.
Summary
The K8s manifest templates (ConfigMap, Deployment, Service, ServiceAccount, Secret) and the Containerfile template are currently hardcoded as Go template strings in
pkg/manifest/k8s.goandpkg/manifest/containerfile.go.These should be extracted to separate template files and loaded via
go:embedfor:Files to change
pkg/manifest/k8s.go(inline templates)pkg/manifest/templates/configmap.yaml.tmplpkg/manifest/templates/deployment.yaml.tmplpkg/manifest/templates/service.yaml.tmplpkg/manifest/templates/serviceaccount.yaml.tmplpkg/manifest/templates/secret.yaml.tmplpkg/manifest/containerfile.go(inline template)pkg/manifest/templates/Containerfile.tmplUse
//go:embed templates/*.tmplto load them at compile time.Context
From PR #74 code review. Deferred to keep the PR focused on the agent manifest feature.