template

package
v1.2.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FuncMap

func FuncMap() template.FuncMap

FuncMap returns the functions used for template evaluation

Types

type MetricData

type MetricData struct {
	// Trial metadata
	Trial metav1.ObjectMeta
	// The time at which the trial run started (possibly adjusted)
	StartTime time.Time
	// The time at which the trial run completed
	CompletionTime time.Time
	// The duration of the trial run expressed as a Prometheus range value
	Range string
	// Trial assignments
	Values map[string]int64
	// List of pods from the trial namespace (only available for "pods" type metrics)
	Pods *corev1.PodList
}

MetricData represents a trial during metric evaluation

func NewMetricData

func NewMetricData(t *redskyv1alpha1.Trial, target runtime.Object) *MetricData

type PatchData

type PatchData struct {
	// Trial metadata
	Trial metav1.ObjectMeta
	// Trial assignments
	Values map[string]int64
}

PatchData represents a trial during patch evaluation

func NewPatchData

func NewPatchData(t *redskyv1alpha1.Trial) *PatchData

type TemplateEngine

type TemplateEngine struct {
	FuncMap template.FuncMap
}

func NewTemplateEngine

func NewTemplateEngine() *TemplateEngine

func (*TemplateEngine) RenderHelmValue

func (e *TemplateEngine) RenderHelmValue(helmValue *redskyv1alpha1.HelmValue, trial *redskyv1alpha1.Trial) (string, error)

RenderHelmValue returns a rendered string of the supplied Helm value

func (*TemplateEngine) RenderMetricQueries

func (e *TemplateEngine) RenderMetricQueries(metric *redskyv1alpha1.Metric, trial *redskyv1alpha1.Trial, target runtime.Object) (string, string, error)

RenderMetricQueries returns the metric query and the metric error query

func (*TemplateEngine) RenderPatch

func (e *TemplateEngine) RenderPatch(patch *redskyv1alpha1.PatchTemplate, trial *redskyv1alpha1.Trial) ([]byte, error)

RenderPatch returns the JSON representation of the supplied patch template (input can be a Go template that produces YAML)

Jump to

Keyboard shortcuts

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