templated

package
v0.0.0-...-a38f29d Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TemplateHook = func(tc *Container, data interface{}) kube.Hook {
	return func(c kube.Container) (err error) {
		for _, kind := range c.Kinds() {
			if err = ExecuteTemplate(tc, kind, data); err != nil {
				return
			}
		}
		return
	}
}

TemplateHook executes templates with given data

View Source
var TemplateHooks = func(tc *Container, data interface{}) kube.Hooks {
	return kube.Hooks{
		kube.PreGet:    {TemplateHook(tc, data)},
		kube.PreCreate: {TemplateHook(tc, data)},
		kube.PreDelete: {TemplateHook(tc, data)},
	}
}

TemplateHooks are registered by default, they execute templates before each step

Functions

func ExecuteTemplate

func ExecuteTemplate(tc *Container, k kube.Kind, d interface{}) (err error)

Types

type Container

type Container struct {
	kube.Container
	// contains filtered or unexported fields
}

Container implements kube.Container using templates to manipulate kube.Resource's

func NewContainer

func NewContainer(path string, kinds ...kube.Kind) *Container

NewContainer creates Container parsing templates and executing them - making sure they won't panic at runtime by default provided path is parsed, and if patter matches no files we parse relative path `templates/*.yaml` - this handles case when Container is used by tests in the package itself

func (*Container) Copy

func (tc *Container) Copy() kube.Container

func (*Container) Self

func (tc *Container) Self() kube.Container

func (*Container) Templates

func (tc *Container) Templates() *template.Template

type Controller

type Controller struct {
	kube.Controller
	// contains filtered or unexported fields
}

func NewController

func NewController(container *Container, data interface{}, opts ...kube.Option) *Controller

NewController creates Controller

Jump to

Keyboard shortcuts

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