container

package
v0.10.17 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2021 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter

type Filter struct {
	runtimeutil.ContainerSpec `json:",inline" yaml:",inline"`

	Exec runtimeexec.Filter

	UIDGID string
}

Filter filters Resources using a container image. The container must start a process that reads the list of input Resources from stdin, reads the Configuration from the env API_CONFIG, and writes the filtered Resources to stdout. If there is a error or validation failure, the process must exit non-zero. The full set of environment variables from the parent process are passed to the container.

Function Scoping: Filter applies the function only to Resources to which it is scoped.

Resources are scoped to a function if any of the following are true:

  • the Resource were read from the same directory as the function config
  • the Resource were read from a subdirectory of the function config directory
  • the function config is in a directory named "functions" and they were read from a subdirectory of "functions" parent
  • the function config doesn't have a path annotation (considered globally scoped)
  • the Filter has GlobalScope == true

In Scope Examples:

Example 1: deployment.yaml and service.yaml in function.yaml scope

       same directory as the function config directory
.
├── function.yaml
├── deployment.yaml
└── service.yaml

Example 2: apps/deployment.yaml and apps/service.yaml in function.yaml scope

       subdirectory of the function config directory
.
├── function.yaml
└── apps
    ├── deployment.yaml
    └── service.yaml

Example 3: apps/deployment.yaml and apps/service.yaml in functions/function.yaml scope

       function config is in a directory named "functions"
.
├── functions
│   └── function.yaml
└── apps
    ├── deployment.yaml
    └── service.yaml

Out of Scope Examples:

Example 1: apps/deployment.yaml and apps/service.yaml NOT in stuff/function.yaml scope

.
├── stuff
│   └── function.yaml
└── apps
    ├── deployment.yaml
    └── service.yaml

Example 2: apps/deployment.yaml and apps/service.yaml NOT in stuff/functions/function.yaml scope

   .
   ├── stuff
   │   └── functions
   │       └── function.yaml
   └── apps
       ├── deployment.yaml
       └── service.yaml

Default Paths: Resources emitted by functions will have default path applied as annotations if none is present. The default path will be the function-dir/ (or parent directory in the case of "functions") + function-file-name/ + namespace/ + kind_name.yaml

Example 1: Given a function in fn.yaml that produces a Deployment name foo and a Service named bar

dir
└── fn.yaml

Would default newly generated Resources to:

dir
├── fn.yaml
└── fn
    ├── deployment_foo.yaml
    └── service_bar.yaml

Example 2: Given a function in functions/fn.yaml that produces a Deployment name foo and a Service named bar

dir
└── fn.yaml

Would default newly generated Resources to:

dir
├── functions
│   └── fn.yaml
└── fn
    ├── deployment_foo.yaml
    └── service_bar.yaml

Example 3: Given a function in fn.yaml that produces a Deployment name foo, namespace baz and a Service named bar namespace baz

dir
└── fn.yaml

Would default newly generated Resources to:

dir
├── fn.yaml
└── fn
    └── baz
        ├── deployment_foo.yaml
        └── service_bar.yaml

func NewContainer added in v0.7.0

func NewContainer(spec runtimeutil.ContainerSpec, uidgid string) Filter

NewContainer returns a new container filter

func (*Filter) Filter

func (c *Filter) Filter(nodes []*yaml.RNode) ([]*yaml.RNode, error)

func (Filter) GetExit

func (c Filter) GetExit() error

func (Filter) String

func (c Filter) String() string

Jump to

Keyboard shortcuts

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