score

package
v0.0.211 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2022 License: Apache-2.0 Imports: 13 Imported by: 2

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(allResources map[string]workloadinterface.IMetadata) *ScoreUtil

func (*ScoreUtil) Calculate

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

func (*ScoreUtil) CalculateFrameworkScore

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

func (*ScoreUtil) CalculatePostureReportV2

func (su *ScoreUtil) CalculatePostureReportV2(report *v2.PostureReport) error

func (*ScoreUtil) ControlScore

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

ControlScore: @input: ctrlReport - reporthandling.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 wcsscore,ctrlscore(unnormalized)

func (*ScoreUtil) ControlV2Score

func (su *ScoreUtil) ControlV2Score(ctrl reportsummary.IControlSummary, frameworkName string) (ctrlScore float32, unormalizedScore float32, wcsScore float32)

*/

func (*ScoreUtil) ControlsSummariesScore

func (su *ScoreUtil) ControlsSummariesScore(ctrls *reportsummary.ControlSummaries, frameworkName string) (totalUnormalizedScore float32, totalWcsScore float32)

func (*ScoreUtil) GetScore

func (su *ScoreUtil) GetScore(v map[string]interface{}) float32

daemonset: daemonsetscore*#nodes workloads: if replicas:

             replicascore*workloadkindscore*#replicas
           else:
		     regular

Jump to

Keyboard shortcuts

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