fn

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateFunctionImageURL

func ValidateFunctionImageURL(name string) error

ValidateFunctionImageURL validates the function name. According to Docker implementation https://github.com/docker/distribution/blob/master/reference/reference.go. A valid name definition is:

name                            := [domain '/'] path-component ['/' path-component]*
domain                          := domain-component ['.' domain-component]* [':' port-number]
domain-component                := /([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])/
port-number                     := /[0-9]+/
path-component                  := alpha-numeric [separator alpha-numeric]*
alpha-numeric                   := /[a-z0-9]+/
separator                       := /[_.]|__|[-]*/

https://github.com/GoogleContainerTools/kpt/blob/b197de30601072d7b8668dd41150f398a7f415f5/pkg/api/kptfile/v1/validation.go#L120-L150

Types

type Function

type Function struct {
	// `Image` specifies the function container image.
	//	image: gcr.io/kpt-fn/set-labels
	Image string `yaml:"image,omitempty" json:"image,omitempty"`

	// Exec specifies the function binary executable.
	// The executable can be fully qualified, or it must exist in the $PATH e.g:
	//
	// 	 exec: set-namespace
	// 	 exec: /usr/local/bin/my-custom-fn
	Exec string `yaml:"exec,omitempty" json:"exec,omitempty"`

	// `ConfigMap` is a convenient way to specify a function config of kind ConfigMap.
	ConfigMap map[string]string `yaml:"configMap,omitempty" json:"configMap,omitempty"`
}

Function specifies a KRM function to run.

type FunctionRunner added in v1.0.4

type FunctionRunner interface {
	Execute() (ResourceList, error)
}

type ResourceList added in v1.0.5

type ResourceList struct {
	// Items is the ResourceList.items input and output value.
	//
	// e.g. given the function input:
	//
	//    items:
	//    - kind: Deployment
	//      ...
	//    - kind: Service
	//      ...
	//
	// Items will be a slice containing the Deployment and Service resources
	// Mutating functions will alter this field during processing.
	// This field is required.
	Items []runtime.Object

	// Results is ResourceList.results output value.
	// Validating functions can optionally use this field to communicate structured
	// validation error data to downstream functions.
	Results framework.Results
}

func GetResourceList added in v1.0.5

func GetResourceList(content string, resultDir string) (ResourceList, error)

type Runner added in v1.0.4

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

func (Runner) Build added in v1.0.4

func (r Runner) Build() (FunctionRunner, error)

func (Runner) WhereExecWorkingDir added in v1.0.5

func (r Runner) WhereExecWorkingDir(dir string) RunnerBuilder

func (Runner) WithFunctions added in v1.0.4

func (r Runner) WithFunctions(function ...Function) RunnerBuilder

func (Runner) WithInput added in v1.0.4

func (r Runner) WithInput(bytes []byte) RunnerBuilder

func (Runner) WithInputs added in v1.0.5

func (r Runner) WithInputs(objects ...runtime.Object) RunnerBuilder

type RunnerBuilder added in v1.0.4

type RunnerBuilder interface {
	WithInput([]byte) RunnerBuilder
	WithInputs(...runtime.Object) RunnerBuilder
	WithFunctions(...Function) RunnerBuilder
	WhereExecWorkingDir(string) RunnerBuilder
	Build() (FunctionRunner, error)
}

func NewRunner added in v1.0.4

func NewRunner() RunnerBuilder

Jump to

Keyboard shortcuts

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