opa

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: May 23, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Up = prometheus.NewDesc(
		prometheus.BuildFQName(namespace, "", "up"),
		"Was the last OPA scorecard query successful.",
		nil, nil,
	)
	ConstraintViolation = prometheus.NewDesc(
		prometheus.BuildFQName(namespace, "", "constraint_violations"),
		"OPA violations for all constraints",
		[]string{"kind", "name", "violating_kind", "violating_name", "violating_namespace", "violation_msg", "violation_enforcement"}, nil,
	)
	ConstraintInformation = prometheus.NewDesc(
		prometheus.BuildFQName(namespace, "", "constraint_information"),
		"Some general information of all constraints",
		[]string{"kind", "name", "enforcementAction", "totalViolations"}, nil,
	)
)

Functions

func ExportConstraintInformation

func ExportConstraintInformation(constraints []Constraint) []prometheus.Metric

func ExportViolations

func ExportViolations(constraints []Constraint) []prometheus.Metric

Types

type Constraint

type Constraint struct {
	Meta   ConstraintMeta
	Spec   ConstraintSpec
	Status ConstraintStatus
}

Constraint

func GetConstraints

func GetConstraints(inCluster *bool) ([]Constraint, error)

GetConstraints returns a list of all OPA constraints

type ConstraintMeta

type ConstraintMeta struct {
	Kind string
	Name string
}

ConstraintMeta represents meta information of a constraint

type ConstraintSpec

type ConstraintSpec struct {
	EnforcementAction string `json:"enforcementAction"`
}

ConstraintSpec collect general information about the overall constraints applied to the cluster

type ConstraintStatus

type ConstraintStatus struct {
	TotalViolations float64 `json:"totalViolations,omitempty"`
	Violations      []*Violation
}

type Violation

type Violation struct {
	Kind              string `json:"kind"`
	Name              string `json:"name"`
	Namespace         string `json:"namespace,omitempty"`
	Message           string `json:"message"`
	EnforcementAction string `json:"enforcementAction"`
}

Violation represents each constraintViolation under status

Jump to

Keyboard shortcuts

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