template

package
v0.0.0-...-e5246a7 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 17 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Filter

func Filter(objs []runtime.RawExtension, filters ...FilterFunc) []runtime.RawExtension

Filter filters the given objs to return only those matching the given filters (if any)

func LoadObjectsFromEmbedFS

func LoadObjectsFromEmbedFS(efs *embed.FS, variables *Variables) ([]*unstructured.Unstructured, error)

LoadObjectsFromEmbedFS loads all the kubernetes objects from an embedded filesystem and returns a list of Unstructured objects that can be applied in the cluster. The function will return all the objects it finds starting from the root of the embedded filesystem.

Types

type FilterFunc

type FilterFunc func(runtime.RawExtension) bool

FilterFunc a function to retain an object or not

var (
	// RetainNamespaces a func to retain only namespaces
	RetainNamespaces FilterFunc = func(obj runtime.RawExtension) bool {
		gvk := obj.Object.GetObjectKind().GroupVersionKind()
		return gvk.Kind == "Namespace"
	}

	// RetainAllButNamespaces a func to retain all but namespaces
	RetainAllButNamespaces FilterFunc = func(obj runtime.RawExtension) bool {
		gvk := obj.Object.GetObjectKind().GroupVersionKind()
		return gvk.Kind != "Namespace"
	}
)

type Processor

type Processor struct {
	// contains filtered or unexported fields
}

Processor the tool that will process and apply a template with variables

func NewProcessor

func NewProcessor(scheme *runtime.Scheme) Processor

NewProcessor returns a new Processor

func (Processor) Process

func (p Processor) Process(tmpl *templatev1.Template, values map[string]string, filters ...FilterFunc) ([]runtimeclient.Object, error)

Process processes the template (ie, replaces the variables with their actual values) and optionally filters the result to return a subset of the template objects

type Variables

type Variables struct {
	Namespace string
}

Variables contains all the available variables that are supported by the templates

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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