template

package
v0.51.0 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package template provides a factory pattern design of instantiating a new "templater" in kapp-controller some examples include cue, helm, and ytt

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdditionalDownwardAPIValues added in v0.41.0

type AdditionalDownwardAPIValues struct {
	KappControllerVersion func() (string, error)
	KubernetesVersion     func() (string, error)
	KubernetesAPIs        func() ([]string, error)
}

AdditionalDownwardAPIValues holds values that are not computed discoverable on the resource itself

type AppContext added in v0.39.0

type AppContext struct {
	Name      string
	Namespace string
	Metadata  PartialObjectMetadata
}

AppContext carries App information used across API boundaries. Primarily used in a context when templating with values

type DownwardAPIValues added in v0.39.0

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

DownwardAPIValues produces multiple key-values based on the DownwardAPI config queried against the object metadata

func (DownwardAPIValues) AsYAMLs added in v0.39.0

func (a DownwardAPIValues) AsYAMLs() ([][]byte, error)

AsYAMLs returns many key-values queried (using jsonpath) against an object metadata provided, and use additionalValues.

type Factory

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

Factory allows to build various templaters e.g. ytt, cue.

func NewFactory

func NewFactory(coreClient kubernetes.Interface, fetchFactory fetch.Factory,
	kbldAllowBuild bool, cmdRunner exec.CmdRunner) Factory

NewFactory returns template factory.

func (Factory) NewCue added in v0.30.3

func (f Factory) NewCue(opts v1alpha1.AppTemplateCue, appContext AppContext, additionalValues AdditionalDownwardAPIValues) Template

NewCue returns a Cue templater

func (Factory) NewHelmTemplate

func (f Factory) NewHelmTemplate(
	opts v1alpha1.AppTemplateHelmTemplate, appContext AppContext, additionalValues AdditionalDownwardAPIValues) *HelmTemplate

NewHelmTemplate returns helm template.

func (Factory) NewKbld

func (f Factory) NewKbld(opts v1alpha1.AppTemplateKbld, appContext AppContext) *Kbld

NewKbld returns kbld template.

func (Factory) NewSops added in v0.13.0

func (f Factory) NewSops(
	opts v1alpha1.AppTemplateSops, appContext AppContext) *Sops

func (Factory) NewYtt

func (f Factory) NewYtt(opts v1alpha1.AppTemplateYtt, appContext AppContext, additionalValues AdditionalDownwardAPIValues) *Ytt

NewYtt returns ytt template.

type HelmTemplate

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

func NewHelmTemplate

func NewHelmTemplate(opts v1alpha1.AppTemplateHelmTemplate, appContext AppContext, coreClient kubernetes.Interface,
	cmdRunner exec.CmdRunner, additionalValues AdditionalDownwardAPIValues) *HelmTemplate

NewHelmTemplate returns a HelmTemplate

func (*HelmTemplate) TemplateDir

func (t *HelmTemplate) TemplateDir(dirPath string) (exec.CmdRunResult, bool)

TemplateDir runs helm template against a directory of files

func (*HelmTemplate) TemplateStream

func (t *HelmTemplate) TemplateStream(stream io.Reader, dirPath string) exec.CmdRunResult

TemplateStream works on a stream returning templating result. dirPath is provided for context from which to reference additional inputs.

type HelmTemplateCmdArgs added in v0.19.0

type HelmTemplateCmdArgs struct {
	BinaryName string
	Args       []string
}

HelmTemplateCmdArgs represents the binary and arguments used during templating

type Kbld

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

Kbld executes kbld tool.

func NewKbld

func NewKbld(opts v1alpha1.AppTemplateKbld,
	appContext AppContext, additionalOpts KbldOpts,
	cmdRunner exec.CmdRunner) *Kbld

NewKbld returns kbld.

func (*Kbld) TemplateDir

func (t *Kbld) TemplateDir(dirPath string) (exec.CmdRunResult, bool)

func (*Kbld) TemplateStream

func (t *Kbld) TemplateStream(input io.Reader, dirPath string) exec.CmdRunResult

type KbldOpts added in v0.37.0

type KbldOpts struct {
	// Do not want to allow building within kapp-controller pod
	AllowBuild bool
}

KbldOpts allows to configure kbld execution.

type ObjectMeta added in v0.39.0

type ObjectMeta struct {
	Name        string            `json:"name,omitempty"`
	Namespace   string            `json:"namespace,omitempty"`
	UID         types.UID         `json:"uid,omitempty"`
	Labels      map[string]string `json:"labels,omitempty"`
	Annotations map[string]string `json:"annotations,omitempty"`
}

ObjectMeta represents a subset of v1.ObjectMetadata fields

type PartialObjectMetadata added in v0.39.0

type PartialObjectMetadata struct {
	metav1.TypeMeta `json:",inline"`
	ObjectMeta      `json:"metadata,omitempty"`
}

PartialObjectMetadata represents an v1alpha1.App with a subset of Metadata fields exposed. Used to control which metadata fields an operator can query (using jsonpath) to provide as a Value when templating

type Sops added in v0.13.0

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

Sops executes sops tool to decrypt configuration. Currently supports age and gpg as its decryption backends.

func NewSops added in v0.13.0

func NewSops(opts v1alpha1.AppTemplateSops, appContext AppContext,
	coreClient kubernetes.Interface, cmdRunner exec.CmdRunner) *Sops

NewSops returns sops.

func (*Sops) TemplateDir added in v0.13.0

func (t *Sops) TemplateDir(dirPath string) (exec.CmdRunResult, bool)

func (*Sops) TemplateStream added in v0.13.0

func (t *Sops) TemplateStream(input io.Reader, dirPath string) exec.CmdRunResult

type Template

type Template interface {
	// TemplateDir works on directory returning templating result,
	// and boolean indicating whether subsequent operations
	// should operate on result, or continue operating on the directory
	TemplateDir(dirPath string) (exec.CmdRunResult, bool)
	// TemplateStream works on a stream returning templating result.
	// dirPath is provided for context from which to reference additional inputs.
	TemplateStream(stream io.Reader, dirPath string) exec.CmdRunResult
}

type Values added in v0.20.0

type Values struct {
	ValuesFrom       []v1alpha1.AppTemplateValuesSource
	AdditionalValues AdditionalDownwardAPIValues
	// contains filtered or unexported fields
}

func (Values) AsPaths added in v0.20.0

func (t Values) AsPaths(dirPath string) ([]string, func(), error)

type Ytt

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

func NewYtt

func NewYtt(opts v1alpha1.AppTemplateYtt, appContext AppContext,
	coreClient kubernetes.Interface, fetchFactory fetch.Factory, cmdRunner exec.CmdRunner, additionalValues AdditionalDownwardAPIValues) *Ytt

NewYtt returns ytt template.

func (*Ytt) TemplateDir

func (t *Ytt) TemplateDir(dirPath string) (exec.CmdRunResult, bool)

func (*Ytt) TemplateStream

func (t *Ytt) TemplateStream(input io.Reader, dirPath string) exec.CmdRunResult

Jump to

Keyboard shortcuts

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