admission

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JsaInit     = "jsa_init"
	JsaMutate   = "jsa_mutate"
	JsaValidate = "jsa_validate"
	JsaCreated  = "jsa_created"
	JsaUpdated  = "jsa_updated"
	JsaDeleted  = "jsa_deleted"
)

Variables

This section is empty.

Functions

func ToGojaObject added in v1.0.4

func ToGojaObject(r *goja.Runtime, value any) goja.Value

func ToMap

func ToMap(obj interface{}) map[string]interface{}

func ToUnstructured

func ToUnstructured(obj interface{}) *unstructured.Unstructured

Types

type Admission

type Admission struct {
	Namespace  string
	Name       string
	Resources  []string
	Javascript string
	Timeout    int
}

func (*Admission) FullName added in v1.1.0

func (a *Admission) FullName() string

type AdmissionCode

type AdmissionCode struct {
	Admission *Admission
	Context   *JsContext
	IsValid   bool
}

func (*AdmissionCode) Created

func (c *AdmissionCode) Created(obj *unstructured.Unstructured) error

func (*AdmissionCode) Deleted

func (c *AdmissionCode) Deleted(obj *unstructured.Unstructured) error

func (*AdmissionCode) Init

func (c *AdmissionCode) Init() error

func (*AdmissionCode) Mutate

func (*AdmissionCode) Updated

func (*AdmissionCode) Validate

type AdmissionList

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

type Admissions

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

func NewAdmissions

func NewAdmissions() *Admissions

func (*Admissions) Find

func (a *Admissions) Find(resource string, namespace string) []*AdmissionCode

Find returns admissions for current namespace and cluster if namespace != "".

For a namespace resource (like pods), all admissions for this namespace and for the cluster are returned. For a cluster resource (like clusterroles), only admissions for the cluster are returned.

func (*Admissions) Remove

func (a *Admissions) Remove(namespace string, name string)

func (*Admissions) Upsert

func (a *Admissions) Upsert(adm *Admission) (*AdmissionCode, error)

type JsContext

type JsContext struct {
	State map[string]interface{}
	// contains filtered or unexported fields
}

func NewJsContext

func NewJsContext(name string, js string, timeout int) (*JsContext, error)

func (*JsContext) Call

func (c *JsContext) Call(method string, forceSync bool, values map[string]interface{}) (goja.Value, error)

type JsFunction

type JsFunction struct {
	Func   goja.Callable
	Params map[string]int
}

type JsRuntime added in v1.0.4

type JsRuntime struct {
	Runtime *goja.Runtime
	Methods map[string]*JsFunction
}

Jump to

Keyboard shortcuts

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