render

package
v0.2.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2026 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const ProducerAnnotation = "fmp.tobiash.github.io/producer"

Variables

This section is empty.

Functions

func MatchGVK

func MatchGVK(resGvk, target resid.Gvk) bool

MatchGVK reports true if the resource's GVK matches the target by group and kind. Version is ignored because Flux resources exist in multiple API versions.

func ValidateLocalKustomization

func ValidateLocalKustomization(fs filesys.FileSystem, root, path string) error

ValidateLocalKustomization checks every supported read reference before krusty can interpret it as a URL. Custom generators/transformers/validators and Helm generators are deliberately unsupported; external plugins remain disabled.

func ValidateLocalPath

func ValidateLocalPath(fs filesys.FileSystem, root, path string) error

ValidateLocalPath requires an existing path inside root, resolving symlinks. It validates references, not concurrent filesystem mutations or OS isolation.

Types

type Provenance

type Provenance struct {
	Kind      string
	Name      string
	Namespace string
	Path      string
	Text      string
}

Provenance identifies the Flux rendering source that produced a resource.

func HelmReleaseProvenance

func HelmReleaseProvenance(namespace, name string) Provenance

HelmReleaseProvenance describes resources rendered from a Flux HelmRelease.

func PathProvenance

func PathProvenance(path string) Provenance

PathProvenance describes resources rendered from an explicit path.

func TextProvenance

func TextProvenance(text string) Provenance

TextProvenance preserves existing producer strings while centralizing provenance storage.

func (Provenance) String

func (p Provenance) String() string

String returns the stable display form used by reports and policy checks.

type Render

type Render struct {
	resmap.ResMap
	// contains filtered or unexported fields
}

Render holds a set of rendered Kubernetes YAML resources.

func NewDefaultRender

func NewDefaultRender(log logr.Logger) *Render

NewDefaultRender creates a passive collection of rendered resources.

func (*Render) AbsorbAll

func (r *Render) AbsorbAll(src resmap.ResMap) error

AbsorbAll merges resources into the render, replacing duplicates and recording warnings.

func (*Render) AbsorbWithProducer

func (r *Render) AbsorbWithProducer(source, producer string, src resmap.ResMap) error

AbsorbWithProducer merges already-built resources with source context for duplicate diagnostics. It performs no filesystem reads or rendering.

func (*Render) ApplyNamespaceToNew

func (r *Render) ApplyNamespaceToNew(count int, namespace string) error

ApplyNamespaceToNew sets the namespace on all namespace-scoped resources added after the given count. This is used to apply Flux Kustomization spec.targetNamespace to newly rendered resources.

func (*Render) ApplySubstitutionsToNew

func (r *Render) ApplySubstitutionsToNew(count int, producer string, substitutions map[string]string) error

ApplySubstitutionsToNew applies Flux postBuild inline substitutions to resources added after count. Missing variables are intentionally preserved so the report still shows unresolved substituteFrom or strict-mode inputs.

func (*Render) AsJSON

func (r *Render) AsJSON() ([]byte, error)

AsJSON returns the rendered resources as a Kubernetes List envelope.

func (*Render) FilterByLabel

func (r *Render) FilterByLabel(key, value string)

FilterByLabel removes all resources that do not have the given label key set to the given value. Resources without the label are removed.

func (*Render) FilterCRDs

func (r *Render) FilterCRDs()

FilterCRDs removes all CustomResourceDefinition resources from the render.

func (*Render) MarkProvenanceToNew

func (r *Render) MarkProvenanceToNew(count int, producer string)

MarkProvenanceToNew records producer metadata for resources added after count.

func (*Render) ProvenanceForID

func (r *Render) ProvenanceForID(id resid.ResId) Provenance

ProvenanceForID returns the structured provenance for a resource ID.

func (*Render) ResourceViewForID

func (r *Render) ResourceViewForID(id resid.ResId) (ResourceView, bool)

ResourceViewForID returns a rendered resource and its fmp metadata.

func (*Render) SetProvenance

func (r *Render) SetProvenance(id resid.ResId, p Provenance)

SetProvenance stores exact structured origin metadata without modifying YAML.

func (*Render) Sort

func (r *Render) Sort()

Sort orders resources by (kind, namespace, name) for deterministic output. This is critical for diff stability across runs.

func (*Render) Warnings

func (r *Render) Warnings() []error

Warnings returns non-fatal issues encountered while building the resource set.

type ResourceView

type ResourceView struct {
	ID         resid.ResId
	Kind       string
	Name       string
	Namespace  string
	Provenance Provenance
	Producer   string
	Object     map[string]any
	YAML       string
}

ResourceView is the domain view of a rendered Kubernetes resource plus fmp metadata.

Jump to

Keyboard shortcuts

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