internal

package
v0.21.3 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const All = "all"

All indicates all data keys are being used when referencing a cm or secret.

Variables

View Source
var AllKeys = StringSet{All: Blank}

AllKeys indicates all keys are present.

View Source
var Blank = Empty{}

Blank represents an empty value.

View Source
var (
	ClusterGVR = types.NewGVR("cluster")
)
View Source
var Glossary = make(Linters)
View Source
var Rs = []R{
	CL, CM, EP, NS, NO, PV, PVC, PO, SEC, SA, SVC, DP, DS, RS, STS, CR,
	CRB, RO, ROB, ING, NP, PDB, HPA, PMX, NMX, CJOB, JOB, GW, GWC, GWR,
}

Functions

func MustExtractFactory added in v0.20.0

func MustExtractFactory(ctx context.Context) types.Factory

func MustExtractSectionGVR added in v0.8.0

func MustExtractSectionGVR(ctx context.Context) types.GVR

MustExtractSectionGVR extract section gvr from context or die.

func WithGroup

func WithGroup(ctx context.Context, gvr types.GVR, grp string) context.Context

WithGroup adds a group to the context.

func WithSpec added in v0.20.0

func WithSpec(ctx context.Context, spec rules.Spec) context.Context

Types

type Aliases

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

Aliases represents a collection of resource aliases.

func NewAliases

func NewAliases() *Aliases

NewAliases returns a new instance.

func (*Aliases) Dump added in v0.20.0

func (a *Aliases) Dump()

func (*Aliases) Exclude added in v0.8.0

func (a *Aliases) Exclude(gvr types.GVR, sections []string) bool

Exclude checks if section should be excluded from the report.

func (*Aliases) Init added in v0.8.0

func (a *Aliases) Init(c types.Connection) error

Init loads the aliases glossary.

func (*Aliases) Inject added in v0.21.0

func (a *Aliases) Inject(ss ShortNames)

func (*Aliases) IsCiliumCluster added in v0.21.0

func (a *Aliases) IsCiliumCluster() bool

func (*Aliases) IsNamespaced added in v0.21.0

func (a *Aliases) IsNamespaced(gvr types.GVR) bool

func (*Aliases) Realize added in v0.21.0

func (a *Aliases) Realize()

func (*Aliases) Singular added in v0.8.0

func (a *Aliases) Singular(gvr types.GVR) string

Singular returns a singular resource name.

func (*Aliases) TitleFor added in v0.8.0

func (a *Aliases) TitleFor(s string, plural bool) string

TitleFor produces a section title from an alias.

func (*Aliases) ToResources

func (a *Aliases) ToResources(nn []string) []string

ToResources converts aliases to resource names.

type ContextKey added in v0.8.0

type ContextKey string

ContextKey represents context key.

const (
	KeyFactory    ContextKey = "factory"
	KeyLabels     ContextKey = "labels"
	KeyFields     ContextKey = "fields"
	KeyOverAllocs ContextKey = "overAllocs"
	KeyRunInfo    ContextKey = "runInfo"
	KeyConfig     ContextKey = "config"
	KeyNamespace  ContextKey = "namespace"
	KeyVersion    ContextKey = "version"
	KeyDB         ContextKey = "db"
)

A collection of context keys.

type Empty

type Empty struct{}

Empty denotes an empty value.

type Linters added in v0.20.0

type Linters map[R]types.GVR

func (Linters) Dump added in v0.20.0

func (ll Linters) Dump()

func (Linters) Include added in v0.20.0

func (ll Linters) Include(gvr types.GVR) (R, bool)

type R added in v0.20.0

type R string
const (
	CM   R = "configmaps"
	CL   R = "cluster"
	EP   R = "endpoints"
	NS   R = "namespaces"
	NO   R = "nodes"
	PV   R = "persistentvolumes"
	PVC  R = "persistentvolumeclaims"
	PO   R = "pods"
	SEC  R = "secrets"
	SA   R = "serviceaccounts"
	SVC  R = "services"
	DP   R = "deployments"
	DS   R = "daemonsets"
	RS   R = "replicasets"
	STS  R = "statefulsets"
	CR   R = "clusterroles"
	CRB  R = "clusterrolebindings"
	RO   R = "roles"
	ROB  R = "rolebindings"
	ING  R = "ingresses"
	NP   R = "networkpolicies"
	PDB  R = "poddisruptionbudgets"
	HPA  R = "horizontalpodautoscalers"
	PMX  R = "podmetrics"
	NMX  R = "nodemetrics"
	CJOB R = "cronjobs"
	JOB  R = "jobs"
	GW   R = "gateways"
	GWC  R = "gatewayclasses"
	GWR  R = "httproutes"
)

type ResourceMetas added in v0.8.0

type ResourceMetas map[types.GVR]metav1.APIResource

ResourceMetas represents a collection of resource metadata.

type RunInfo

type RunInfo struct {
	Section    string
	SectionGVR types.GVR
	Group      string
	GroupGVR   types.GVR
	Spec       rules.Spec
	Total      int
}

RunInfo describes a scan run.

func MustExtractRunInfo

func MustExtractRunInfo(ctx context.Context) RunInfo

MustExtractRunInfo extracts runinfo from context or die.

func NewRunInfo added in v0.20.0

func NewRunInfo(gvr types.GVR) RunInfo

type ShortNames added in v0.21.0

type ShortNames map[R][]string

type StringSet

type StringSet map[string]Empty

StringSet represents a set of strings.

func (StringSet) Add

func (ss StringSet) Add(strs ...string)

Add a collection of elements to the set.

func (StringSet) AddAll added in v0.9.1

func (ss StringSet) AddAll(s StringSet)

AddAll merges two sets.

func (StringSet) Clone added in v0.8.2

func (ss StringSet) Clone() StringSet

Clone returns a new copy.

func (StringSet) Diff

func (ss StringSet) Diff(set StringSet) StringSet

Diff computes B-A.

func (StringSet) Has

func (ss StringSet) Has(s string) bool

Has checks if an item is in the set.

Directories

Path Synopsis
db

Jump to

Keyboard shortcuts

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