score

package
v1.0.54 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ControlScoreWeights

type ControlScoreWeights struct {
	BaseScore                    float32 `json:"baseScore"`
	RuntimeImprovementMultiplier float32 `json:"improvementRatio"`
}

type ScoreUtil

type ScoreUtil struct {
	ResourceTypeScores map[string]float32
	FrameworksScore    map[string]map[string]ControlScoreWeights
	K8SApoObj          *k8sinterface.KubernetesApi
	// contains filtered or unexported fields
}

func NewScore

func NewScore(k8sapiobj *k8sinterface.KubernetesApi, configPath string) *ScoreUtil

func (*ScoreUtil) Calculate

func (su *ScoreUtil) Calculate(frameworksReports []opapolicy.FrameworkReport) error

func (*ScoreUtil) CalculateFrameworkScore

func (su *ScoreUtil) CalculateFrameworkScore(framework *opapolicy.FrameworkReport) error

func (*ScoreUtil) ControlScore

func (su *ScoreUtil) ControlScore(ctrlReport *opapolicy.ControlReport, frameworkName string) float32

ControlScore: @input: ctrlReport - opapolicy.ControlReport object, must contain down the line the Input resources and the output resources frameworkName - calculate this control according to a given framework weights

ctrl.score = baseScore * SUM_resource (resourceWeight*min(#replicas*replicaweight,1)(nodes if daemonset)

returns control score ***for the input resources***

Jump to

Keyboard shortcuts

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