Documentation ¶
Index ¶
- func ConvertLuaResultInto(luaResult lua.LValue, obj interface{}) error
- func ConvertLuaResultToBool(luaResult lua.LValue) (bool, error)
- func ConvertLuaResultToInt(luaResult lua.LValue) (int32, error)
- func NewWithContext(ctx context.Context) (*lua.LState, error)
- type VM
- func (vm *VM) AggregateStatus(object *unstructured.Unstructured, items []workv1alpha2.AggregatedStatusItem, ...) (*unstructured.Unstructured, error)
- func (vm *VM) GetDependencies(object *unstructured.Unstructured, script string) (dependencies []configv1alpha1.DependentObjectReference, err error)
- func (vm *VM) GetReplicas(obj *unstructured.Unstructured, script string) (replica int32, requires *workv1alpha2.ReplicaRequirements, err error)
- func (vm *VM) InterpretHealth(object *unstructured.Unstructured, script string) (bool, error)
- func (vm *VM) NewLuaState() (*lua.LState, error)
- func (vm *VM) ReflectStatus(object *unstructured.Unstructured, script string) (status *runtime.RawExtension, err error)
- func (vm *VM) Retain(desired *unstructured.Unstructured, observed *unstructured.Unstructured, ...) (retained *unstructured.Unstructured, err error)
- func (vm *VM) ReviseReplica(object *unstructured.Unstructured, replica int64, script string) (*unstructured.Unstructured, error)
- func (vm *VM) RunScript(script string, fnName string, nRets int, args ...interface{}) ([]lua.LValue, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertLuaResultInto ¶
ConvertLuaResultInto convert lua result to obj
func ConvertLuaResultToBool ¶
ConvertLuaResultToBool convert lua result to bool.
func ConvertLuaResultToInt ¶
ConvertLuaResultToInt convert lua result to int.
Types ¶
type VM ¶
type VM struct { // UseOpenLibs flag to enable open libraries. Libraries are disabled by default while running, but enabled during testing to allow the use of print statements. UseOpenLibs bool Pool *fixedpool.FixedPool }
VM Defines a struct that implements the luaVM.
func (*VM) AggregateStatus ¶
func (vm *VM) AggregateStatus(object *unstructured.Unstructured, items []workv1alpha2.AggregatedStatusItem, script string) (*unstructured.Unstructured, error)
AggregateStatus returns the objects that based on the 'object' but with status aggregated by lua.
func (*VM) GetDependencies ¶
func (vm *VM) GetDependencies(object *unstructured.Unstructured, script string) (dependencies []configv1alpha1.DependentObjectReference, err error)
GetDependencies returns the dependent resources of the given object by lua.
func (*VM) GetReplicas ¶
func (vm *VM) GetReplicas(obj *unstructured.Unstructured, script string) (replica int32, requires *workv1alpha2.ReplicaRequirements, err error)
GetReplicas returns the desired replicas of the object as well as the requirements of each replica by lua script.
func (*VM) InterpretHealth ¶
func (vm *VM) InterpretHealth(object *unstructured.Unstructured, script string) (bool, error)
InterpretHealth returns the health state of the object by lua.
func (*VM) NewLuaState ¶
NewLuaState creates a new lua state.
func (*VM) ReflectStatus ¶
func (vm *VM) ReflectStatus(object *unstructured.Unstructured, script string) (status *runtime.RawExtension, err error)
ReflectStatus returns the status of the object by lua.
func (*VM) Retain ¶
func (vm *VM) Retain(desired *unstructured.Unstructured, observed *unstructured.Unstructured, script string) (retained *unstructured.Unstructured, err error)
Retain returns the objects that based on the "desired" object but with values retained from the "observed" object by lua.
func (*VM) ReviseReplica ¶
func (vm *VM) ReviseReplica(object *unstructured.Unstructured, replica int64, script string) (*unstructured.Unstructured, error)
ReviseReplica revises the replica of the given object by lua.