context

package
v1.3.4-rc1 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2021 License: Apache-2.0 Imports: 10 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

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

Context stores the data resources as JSON

func NewContext

func NewContext(builtInVars ...string) *Context

NewContext returns a new context builtInVars is the list of known variables (e.g. serviceAccountName)

func (*Context) AddBuiltInVars added in v1.3.4

func (ctx *Context) AddBuiltInVars(pattern string)

AddBuiltInVars adds given pattern to the builtInVars

func (*Context) AddJSON

func (ctx *Context) AddJSON(dataRaw []byte) error

AddJSON merges json data

func (*Context) AddNamespace added in v1.3.4

func (ctx *Context) AddNamespace(namespace string) error

AddNamespace merges resource json under request.namespace

func (*Context) AddRequest added in v1.2.0

func (ctx *Context) AddRequest(request *v1beta1.AdmissionRequest) error

AddRequest adds an admission request to context

func (*Context) AddResource

func (ctx *Context) AddResource(dataRaw []byte) error

AddResource data at path: request.object

func (*Context) AddServiceAccount added in v1.3.0

func (ctx *Context) AddServiceAccount(userName string) error

AddServiceAccount removes prefix 'system:serviceaccount:' and namespace, then loads only SA name and SA namespace

func (*Context) AddUserInfo

func (ctx *Context) AddUserInfo(userRequestInfo kyverno.RequestInfo) error

AddUserInfo adds userInfo at path request.userInfo

func (*Context) Checkpoint added in v1.3.2

func (ctx *Context) Checkpoint()

Checkpoint creates a copy of the internal state. Prior checkpoints will be overridden.

func (*Context) Query

func (ctx *Context) Query(query string) (interface{}, error)

Query the JSON context with JMESPATH search path

func (*Context) Restore added in v1.3.2

func (ctx *Context) Restore()

Restore restores internal state from a prior checkpoint, if one exists. If a prior checkpoint does not exist, the state will not be changed.

type EvalInterface

type EvalInterface interface {
	Query(query string) (interface{}, error)
}

EvalInterface ... to evaluate

type Interface

type Interface interface {

	// AddJSON  merges the json with context
	AddJSON(dataRaw []byte) error

	// AddResource merges resource json under request.object
	AddResource(dataRaw []byte) error

	// AddUserInfo merges userInfo json under kyverno.userInfo
	AddUserInfo(userInfo kyverno.UserInfo) error

	// AddServiceAccount merges ServiceAccount types
	AddServiceAccount(userName string) error

	// AddNamespace merges resource json under request.namespace
	AddNamespace(namespace string) error

	EvalInterface
}

Interface to manage context operations

type InvalidVariableErr added in v1.3.4

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

InvalidVariableErr represents error for non-white-listed variables

func (InvalidVariableErr) Error added in v1.3.4

func (i InvalidVariableErr) Error() string

Jump to

Keyboard shortcuts

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