Documentation
¶
Overview ¶
Package render holds the CUE template helpers shared by the workload/trait render engine and by source resolution.
It exists because those two are separate packages that need the same four functions. Go's internal rules put a package under pkg/cue/definition out of reach of a sibling, so the shared parts live one level up rather than being duplicated - which is how they would drift.
Index ¶
Constants ¶
const ErrsFieldName = "errs"
ErrsFieldName is the field a template writes authored errors to.
const MaxAnnotationValueLen = 4096
MaxAnnotationValueLen is the budget for everything recorded on one object.
Kubernetes allows 256KB across all annotations on an object; these are diagnostic, so they take a small slice and leave the rest to whatever else annotates the entry. Contrast MaxPropertyValueLen, which caps one value within this budget.
const MaxPropertyValueLen = 512
MaxPropertyValueLen caps one property within that budget, so a single large value cannot crowd out every other property.
Variables ¶
This section is empty.
Functions ¶
func ContextLabels ¶
ContextLabels renders the identity's context values as labels, so entries can be selected on them.
A value is emitted only when both halves are legal: the field name (with any index folded in) must be a valid label key, and the value a valid label value. Neither is guaranteed - an index like "example.org/service-name" would put a second slash in the key. Whatever is skipped is still recorded whole in AnnotationSourceContext, so only selectability is lost.
func Properties ¶
Properties marshals a binding's properties for the annotation, replacing any value too large to record with a placeholder.
Clamping happens per value rather than on the finished JSON, because clipping a JSON document mid-string leaves something no reader can parse - and an annotation that has to be parsed to be useful is worth keeping valid. The placeholder keeps the shape intact and says what was dropped, so a reader still learns which properties distinguish this entry from its neighbours.
func Template ¶
Template closes a definition's CUE over the fields a render supplies, so it compiles on its own.
`context` and `parameter` are open here rather than declared: the caller unifies real values in afterwards, and declaring shapes this package cannot know would reject templates it has no business judging.
func UserErrors ¶
UserErrors reads the authored `errs:` field from a compiled CUE value and returns its non-empty entries.
A definition uses `errs:` to say why it refused, in its own words, rather than leaving a reader to infer it from a unification failure. A malformed field is logged and treated as empty, so a mistake in error reporting never masks the result it was reporting on.
Types ¶
This section is empty.