common

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KIND_POD                    = "Pod"
	KIND_REPLICATION_CONTROLLER = "ReplicationController"
	KIND_DEPLOYMENT             = "Deployment"
	KIND_REPLICA_SET            = "ReplicaSet"
	KIND_DAEMON_SET             = "DaemonSet"
	KIND_STATEFUL_SET           = "StatefulSet"
	KIND_JOB                    = "Job"
	KIND_CRON_JOB               = "CronJob"
)

Variables

View Source
var (
	ExemptPodLabelName  = "resources.gardener.cloud/managed-by"
	ExemptPodLabelValue = "gardener"
)

Functions

func GetOwnerReferences

func GetOwnerReferences(resources []unstructured.Unstructured, item unstructured.Unstructured) ([]metav1.OwnerReference, error)

func GetPods

func GetPods(resources []unstructured.Unstructured) []unstructured.Unstructured

func GetViolationsGroupedByResource

func GetViolationsGroupedByResource(violations []Violation) [][]Violation

func IndexFunc

func IndexFunc[E any](s []E, f func(E) bool) int

func IsExempt

func IsExempt(resource unstructured.Unstructured) bool

Types

type AbortFunc

type AbortFunc func() (bool, error)

type FileSystemContextKeyType

type FileSystemContextKeyType string
const FileSystemContextKey FileSystemContextKeyType = "fs"

type Validator

type Validator interface {
	/*
		The return violations slice is non-nil if invalid resources were found
		The return error is non-nil if another type of error was encountered
	*/
	Validate(resources []unstructured.Unstructured) (violations []Violation, err error)
	GetName() string
}

type Violation

type Violation struct {
	Message       string                     // an error describing the violation
	Resource      *unstructured.Unstructured // the violating resource
	Level         int                        // verbosity level: 0 is the most severe
	ValidatorName string
}

func NewViolation

func NewViolation(resource unstructured.Unstructured, message string, level int, validatorName string) Violation

type ViolationTarget

type ViolationTarget struct {
	Kind      string
	Name      string
	Namespace string
	Group     string
}

Jump to

Keyboard shortcuts

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