template

package
v1.12.2 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2021 License: Apache-2.0 Imports: 17 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 Engine

type Engine struct {
	FuncMap template.FuncMap
}

Engine is used to render Go text templates

func New

func New() *Engine

New creates a new template engine

func (*Engine) RenderHelmValue

func (e *Engine) RenderHelmValue(helmValue *redskyv1beta1.HelmValue, trial *redskyv1beta1.Trial) (string, error)

RenderHelmValue returns a rendered string of the supplied Helm value

func (*Engine) RenderMetricQueries

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

RenderMetricQueries returns the metric query and the metric error query

func (*Engine) RenderPatch

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

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

type MetricData

type MetricData struct {
	// Trial is a copy of the trial being evaluated.
	Trial *redskyv1beta1.Trial
	// Target is the object matched by the resource target of a Kubernetes metric.
	Target runtime.Object

	// 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]interface{}
}

MetricData represents a trial during metric evaluation

func (*MetricData) Pods

func (m *MetricData) Pods() runtime.Object

Pods returns the metric target if available. Deprecated: Templates should use the `.Target` pipeline instead of `.Pods`.

type PatchData

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

PatchData represents a trial during patch evaluation

Jump to

Keyboard shortcuts

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