safeguards

package
v0.0.40 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Constraint_CAI   = "container-allowed-images"
	Constraint_CEP   = "container-enforce-probes"
	Constraint_CRL   = "container-resource-limits"
	Constraint_CRIP  = "container-restricted-image-pulls"
	Constraint_DBPDB = "disallowed-bad-pod-disruption-budgets"
	Constraint_PEA   = "pod-enforce-antiaffinity"
	Constraint_RT    = "restricted-taints"
	Constraint_USS   = "unique-service-selectors"
	Constraint_all   = "all"
)

Variables

View Source
var Safeguard_CRIP = Safeguard{
	// contains filtered or unexported fields
}

Functions

func AddSafeguardCRIP

func AddSafeguardCRIP()

adds Safeguard_CRIP to full list of Safeguards

func GetScheme

func GetScheme() *runtime.Scheme

func IsDirectory

func IsDirectory(path string) (bool, error)

IsDirectory determines if a file represented by path is a directory or not

func IsYAML

func IsYAML(path string) bool

IsYAML determines if a file is of the YAML extension or not

Types

type FileCrawler

type FileCrawler struct {
	Safeguards []Safeguard
	// contains filtered or unexported fields
}

func (FileCrawler) ReadConstraint

func (fc FileCrawler) ReadConstraint(name string) (*unstructured.Unstructured, error)

func (FileCrawler) ReadConstraintTemplate

func (fc FileCrawler) ReadConstraintTemplate(name string) (*templates.ConstraintTemplate, error)

func (FileCrawler) ReadConstraintTemplates

func (fc FileCrawler) ReadConstraintTemplates() ([]*templates.ConstraintTemplate, error)

func (FileCrawler) ReadConstraints

func (fc FileCrawler) ReadConstraints() ([]*unstructured.Unstructured, error)

func (FileCrawler) ReadManifests

func (fc FileCrawler) ReadManifests(path string) ([]*unstructured.Unstructured, error)

methods for retrieval of manifest, constraint templates, and constraints

type ManifestFile

type ManifestFile struct {
	Name string
	Path string
}

func GetManifestFiles

func GetManifestFiles(p string) ([]ManifestFile, error)

GetManifestFiles uses filepath.Walk to retrieve a list of the manifest files within the given manifest path

type ManifestResult

type ManifestResult struct {
	Name             string              // the name of the manifest
	ObjectViolations map[string][]string // a map of string object names to slice of string objectViolations
	ViolationsCount  int                 // a count of how many violations are associated with this manifest
}

func GetManifestResults

func GetManifestResults(ctx context.Context, manifestFiles []ManifestFile) ([]ManifestResult, error)

GetManifestResults takes in a list of manifest files and returns a slice of ManifestViolation structs

type Safeguard

type Safeguard struct {
	// contains filtered or unexported fields
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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