Skip to content

refactor: extract K8s and Containerfile templates to embedded files #75

Description

@pavelanni

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions