renderer

package
v0.8.0-pre.3 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2019 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func YamlToObject

func YamlToObject(yaml string) (objs []runtime.Object, err error)

YamlToObject parses a list of runtime.Objects from the provided yaml If the type is not known in the scheme, it tries to parse it as Unstructured TODO(av) could we use something else than a global scheme here? Should we somehow inject it?

Types

type Engine

type Engine struct {
	FuncMap template.FuncMap
}

Engine is the control struct for parsing and templating Kubernetes resources in an ordered fashion

func New

func New() *Engine

New creates an engine with a default function map, using a modified Sprig func map. Because these templates are rendered by the operator, we delete any functions that potentially access the environment the controller is running in.

func (*Engine) Render

func (e *Engine) Render(tpl string, vals map[string]interface{}) (string, error)

Render creates a fully rendered template based on a set of values. It parses these in strict mode, returning errors when keys are missing.

type Enhancer

type Enhancer interface {
	Apply(templates map[string]string, metadata Metadata) ([]runtime.Object, error)
}

Enhancer takes your kubernetes template and kudo related Metadata and applies them to all resources in form of labels and annotations it also takes care of setting an owner of all the resources to the provided object

type KustomizeEnhancer

type KustomizeEnhancer struct {
	Scheme *runtime.Scheme
}

KustomizeEnhancer is implementation of Enhancer that uses kustomize to apply the defined conventions

func (*KustomizeEnhancer) Apply

func (k *KustomizeEnhancer) Apply(templates map[string]string, metadata Metadata) (objsToAdd []runtime.Object, err error)

Apply accepts templates to be rendered in kubernetes and enhances them with our own KUDO conventions These include the way we name our objects and what labels we apply to them

type Metadata

type Metadata struct {
	engine.Metadata

	PlanName  string
	PlanUID   types.UID
	PhaseName string
	StepName  string
	TaskName  string
}

Metadata contains Metadata along with specific fields associated with current plan being executed like current plan, phase, step or task names.

Jump to

Keyboard shortcuts

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