redhat-et / redhat-et/docsclaw

refactor: extract K8s and Containerfile templates to embedded files

Open
#75 0 comments 0 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.