redhat-et / redhat-et/docsclaw
refactor: extract K8s and Containerfile templates to embedded files
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 2
- Forks
- 1
- Avg merge
- 6h 9m
- Merged PRs (30d)
- 1
Description
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the inline templates in pkg/manifest/k8s.go and pkg/manifest/containerfile.go, then review how the manifest package currently renders them. Extract the named Kubernetes and Containerfile templates into pkg/manifest/templates/ and load them with go:embed; done means the package renders the same templates from those files.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, go, kubernetes
- Domain
- devops, infrastructure
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100