Documentation
¶
Index ¶
- Constants
- Variables
- func MustExtractFactory(ctx context.Context) types.Factory
- func MustExtractSectionGVR(ctx context.Context) types.GVR
- func WithGroup(ctx context.Context, gvr types.GVR, grp string) context.Context
- func WithSpec(ctx context.Context, spec rules.Spec) context.Context
- type Aliases
- func (a *Aliases) Dump()
- func (a *Aliases) Exclude(gvr types.GVR, sections []string) bool
- func (a *Aliases) Init(c types.Connection) error
- func (a *Aliases) Inject(ss ShortNames)
- func (a *Aliases) IsCiliumCluster() bool
- func (a *Aliases) IsNamespaced(gvr types.GVR) bool
- func (a *Aliases) Realize()
- func (a *Aliases) Singular(gvr types.GVR) string
- func (a *Aliases) TitleFor(s string, plural bool) string
- func (a *Aliases) ToResources(nn []string) []string
- type ContextKey
- type Empty
- type Linters
- type R
- type ResourceMetas
- type RunInfo
- type ShortNames
- type StringSet
Constants ¶
const All = "all"
All indicates all data keys are being used when referencing a cm or secret.
Variables ¶
var AllKeys = StringSet{All: Blank}
AllKeys indicates all keys are present.
var Blank = Empty{}
Blank represents an empty value.
var (
ClusterGVR = types.NewGVR("cluster")
)
var Glossary = make(Linters)
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.
Types ¶
type Aliases ¶
type Aliases struct {
// contains filtered or unexported fields
}
Aliases represents a collection of resource aliases.
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) 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) 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"
KeyNamespaceName ContextKey = "namespaceName"
)
A collection of context keys.
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.