Documentation ¶
Index ¶
- Constants
- func AddDefaultImagePathPrefix(image string) string
- func NewContainerEnvFromStringSlice(envStr []string) *runtimeutil.ContainerEnv
- func NewContainerRunner(ctx context.Context, f *kptfilev1.Function, pkgPath types.UniquePath, ...) (kio.Filter, error)
- func NewFunctionRunner(ctx context.Context, fltr *runtimeutil.FunctionFilter, ...) (kio.Filter, error)
- func SaveResults(resultsDir string, fnResults *fnresult.ResultList) (string, error)
- type ContainerFn
- type ContainerFnPermission
- type ContainerImageError
- type ExecError
- type ExecFn
- type FunctionRunner
- type ImagePullPolicy
Constants ¶
const ( FnExecErrorTruncateLines = 4 // FnExecErrorIndentation is the number of spaces at the beginning of each // line of function failure messages. FnExecErrorIndentation = 2 )
Variables ¶
This section is empty.
Functions ¶
func AddDefaultImagePathPrefix ¶
AddDefaultImagePathPrefix adds default gcr.io/kpt-fn/ path prefix to image if only image name is specified
func NewContainerEnvFromStringSlice ¶
func NewContainerEnvFromStringSlice(envStr []string) *runtimeutil.ContainerEnv
NewContainerEnvFromStringSlice returns a new ContainerEnv pointer with parsing input envStr. envStr example: ["foo=bar", "baz"] using this instead of runtimeutil.NewContainerEnvFromStringSlice() to avoid default envs LOG_TO_STDERR
func NewContainerRunner ¶
func NewContainerRunner( ctx context.Context, f *kptfilev1.Function, pkgPath types.UniquePath, fnResults *fnresult.ResultList, imagePullPolicy ImagePullPolicy) (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, pkgPath types.UniquePath, fnResult *fnresult.Result, fnResults *fnresult.ResultList, setPkgPathAnnotation bool) (kio.Filter, error)
NewFunctionRunner returns a kio.Filter given a specification of a function and it's config.
func SaveResults ¶
func SaveResults(resultsDir string, fnResults *fnresult.ResultList) (string, error)
SaveResults saves results gathered from running the pipeline at specified dir.
Types ¶
type ContainerFn ¶
type ContainerFn struct { Ctx context.Context Path types.UniquePath // Image is the container image to run Image string // ImagePullPolicy controls the image pulling behavior. ImagePullPolicy ImagePullPolicy // 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 // FnResult is used to store the information about the result from // the function. FnResult *fnresult.Result }
ContainerFn implements a KRMFn which run a containerized KRM function
type ContainerFnPermission ¶
ContainerFnPermission contains the permission of container function such as network access.
type ContainerImageError ¶
ContainerImageError is an error type which will be returned when the container run time cannot verify docker image.
func (*ContainerImageError) Error ¶
func (e *ContainerImageError) Error() string
type ExecError ¶
type ExecError struct { // OriginalErr is the original error returned from function runtime OriginalErr error // TruncateOutput indicates should error message be truncated TruncateOutput bool // Stderr is the content written to function stderr Stderr string `yaml:"stderr,omitempty"` // ExitCode is the exit code returned from function ExitCode int `yaml:"exitCode,omitempty"` }
ExecError implements an error type that stores information about function failure.
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 // FnResult is used to store the information about the result from // the function. FnResult *fnresult.Result }
type FunctionRunner ¶
type FunctionRunner struct {
// contains filtered or unexported fields
}
FunctionRunner wraps FunctionFilter and implements kio.Filter interface.
type ImagePullPolicy ¶
type ImagePullPolicy string
const ( AlwaysPull ImagePullPolicy = "always" IfNotPresentPull ImagePullPolicy = "ifNotPresent" NeverPull ImagePullPolicy = "never" )