fnruntime

package
v1.0.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: May 6, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewContainerRunner

func NewContainerRunner(ctx context.Context, f *kptfilev1alpha2.Function, pkgPath types.UniquePath) (kio.Filter, error)

NewContainerRunner returns a kio.Filter given a specification of a container function and it's config.

func NewFunctionRunner

func NewFunctionRunner(ctx context.Context, fltr *runtimeutil.FunctionFilter, name string, disableOutput bool) (kio.Filter, error)

NewFunctionRunner returns a kio.Filter given a specification of a function and it's config.

Types

type ContainerFn

type ContainerFn struct {
	Ctx  context.Context
	Path types.UniquePath
	// Image is the container image to run
	Image string
	// Container function will be killed after this timeour.
	// The default value is 5 minutes.
	Timeout time.Duration
	Perm    ContainerFnPermission
	// UIDGID is the os User ID and Group ID that will be
	// used to run the container in format userId:groupId.
	// If it's empty, "nobody" will be used.
	UIDGID string
	// StorageMounts are the storage or directories to mount
	// into the container
	StorageMounts []runtimeutil.StorageMount
	// Env is a slice of env string that will be exposed to container
	Env []string
}

ContainerFn implements a KRMFn which run a containerized KRM function

func (*ContainerFn) Run

func (f *ContainerFn) Run(reader io.Reader, writer io.Writer) error

Run runs the container function using docker runtime. It reads the input from the given reader and writes the output to the provided writer.

type ContainerFnPermission

type ContainerFnPermission struct {
	AllowNetwork bool
	AllowMount   bool
}

ContainerFnPermission contains the permission of container function such as network access.

type ExecFn

type ExecFn struct {
	// Path is the os specific path to the executable
	// file. It can be relative or absolute.
	Path string
	// Args are the arguments to the executable
	Args []string
	// Container function will be killed after this timeour.
	// The default value is 5 minutes.
	Timeout time.Duration
}

func (*ExecFn) Run

func (f *ExecFn) Run(r io.Reader, w io.Writer) error

Run runs the executable file which reads the input from r and writes the output to w.

type FunctionRunner

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

FunctionRunner wraps FunctionFilter and implements kio.Filter interface.

func (*FunctionRunner) Filter

func (fr *FunctionRunner) Filter(input []*yaml.RNode) (output []*yaml.RNode, err error)

Jump to

Keyboard shortcuts

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