render

package
v0.0.35 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package render handles ${VAR}-style substitution and YAML document splitting for templates rendered by `seictl bench up`.

Substitution uses os.Expand and is fail-closed: any unresolved ${VAR} in a template returns CatTemplateRender so the engineer sees the gap rather than an empty-string-laundered manifest.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Indent

func Indent(body, prefix string) string

Indent left-pads every line of body with prefix. Trailing whitespace and a single trailing newline are preserved as the input had them.

func Render

func Render(tmpl []byte, vars map[string]string) ([]byte, *clioutput.Error)

Render substitutes ${VAR} occurrences in tmpl with values from vars. Errors with the deduplicated, sorted list of missing keys.

func SplitYAML

func SplitYAML(data []byte) [][]byte

SplitYAML returns each non-empty document from a multi-doc YAML stream. The split happens on YAML document boundaries (a `---` line at column zero), preserving each document's original formatting. Comment-only documents (e.g., a provenance preamble at the top of a file before the first `---`) are filtered out — they carry no manifest data and would fail downstream Kind/Name extraction.

Types

type ManifestRef

type ManifestRef struct {
	Kind      string `json:"kind"`
	Name      string `json:"name"`
	Namespace string `json:"namespace"`
	Action    string `json:"action"`
}

ManifestRef is the minimal manifest metadata bench up emits per rendered document.

func ExtractRef

func ExtractRef(doc []byte) (ManifestRef, error)

ExtractRef pulls Kind / metadata.name / metadata.namespace from a rendered Kubernetes manifest. Action is filled in by the caller.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL