rego

package
v0.0.0-...-79d0544 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: Apache-2.0 Imports: 9 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetInsightsInfoFunction

func GetInsightsInfoFunction(insightsInfo *InsightsInfo) func(rego.BuiltinContext, *ast.Term) (*ast.Term, error)

GetInsightsInfoFunction returns a function that is called from a rego policy, to provide Insights information to the policy depending on the function parameter.

func GetRegoQuery

func GetRegoQuery(body string, dataFn KubeDataFunction, insightsInfo *InsightsInfo) *rego.Rego

func RunRegoForItem

func RunRegoForItem(ctx context.Context, regoStr string, params map[string]interface{}, obj map[string]interface{}, dataFn KubeDataFunction, insightsInfo *InsightsInfo) ([]interface{}, error)

func RunRegoForItemV2

func RunRegoForItemV2(ctx context.Context, regoStr string, obj map[string]interface{}, dataFn KubeDataFunction, insightsInfo *InsightsInfo) ([]interface{}, error)

func RunRegoForItemV2 evaluates rego against a Kube object. IT replaces RunRegoForItemV() and supports v2 of Insights OPACustomChecks.

Types

type InsightsInfo

type InsightsInfo struct {
	InsightsContext  string
	Cluster          string
	Repository       string
	AdmissionRequest *admission.Request
}

InsightsInfo exposes Insights perspective, for consideration in rego policies. FOr example, the context rego has been executed - Continuous Integration, Admission Controller, or the Insights Agent.

type KubeDataFunction

type KubeDataFunction interface {
	GetData(context.Context, string, string) ([]interface{}, error)
}

type NilDataFunction

type NilDataFunction struct{}

func (NilDataFunction) GetData

func (n NilDataFunction) GetData(ctx context.Context, group, kind string) ([]interface{}, error)

Jump to

Keyboard shortcuts

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