controlplane

package
v0.1.2-rc.2 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2022 License: AGPL-3.0 Imports: 40 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Module added in v0.1.2

func Module() fx.Option

Module - Controller can be initialized by passing options from Module() to fx app.

func NewComponentAndOptions

func NewComponentAndOptions(
	componentProto *policylangv1.Component,
	componentIndex int,
	policyReadAPI iface.Policy,
) (runtime.CompiledComponent, []runtime.CompiledComponent, fx.Option, error)

NewComponentAndOptions creates component and its fx options.

Types

type CMFileValidator

type CMFileValidator struct{}

CMFileValidator Policy implementation of CMFileValidator interface.

func (*CMFileValidator) CheckCMName

func (v *CMFileValidator) CheckCMName(name string) bool

CheckCMName checks configmap name is equals to "policies"

returns: * true when config is policies * false when config is not policies.

func (*CMFileValidator) ValidateFile

func (v *CMFileValidator) ValidateFile(
	ctx context.Context,
	name string,
	yamlSrc []byte,
) (bool, string, error)

ValidateFile checks the validity of a single Policy as yaml file

returns: * true, "", nil when config is valid * false, message, nil when config is invalid and * false, "", err on other errors.

ValidateConfig checks the syntax, validity of extractors, and validity of rego modules (by attempting to compile them).

type CompiledCircuit

type CompiledCircuit []*CompiledComponent

CompiledCircuit is a list of CompiledComponent(s).

func CompilePolicy

func CompilePolicy(policyMessage *policylangv1.Policy) (CompiledCircuit, error)

CompilePolicy takes policyMessage and returns a compiled policy. This is a helper method for standalone consumption of policy compiler.

type CompiledComponent

type CompiledComponent struct {
	runtime.CompiledComponentAndPorts
	ComponentID       string
	ParentComponentID string
}

CompiledComponent is composed of runtime.CompiledComponent, ComponentID and ParentComponentID.

type Policy

type Policy struct {
	iface.PolicyBase
	// contains filtered or unexported fields
}

Policy invokes the Circuit runtime at tick frequency.

func (*Policy) GetEvaluationInterval

func (policy *Policy) GetEvaluationInterval() time.Duration

GetEvaluationInterval returns the ID of the policy.

Jump to

Keyboard shortcuts

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