collect

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package collect contains read-only Kubernetes, Istio, and Gateway API collectors.

Index

Constants

View Source
const DefaultRootNamespace = "istio-system"

Variables

This section is empty.

Functions

This section is empty.

Types

type Collector

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

Collector performs bounded, read-only list collection through typed clients.

func New

New returns a collector using typed Kubernetes, Istio, and Gateway API clients.

func (*Collector) Collect

func (c *Collector) Collect(ctx context.Context, scope Scope) (Snapshot, error)

Collect lists the current typed resource set. Permission-like failures are recorded and degraded; non-permission API failures are returned.

func (*Collector) SetMaxConcurrentLists

func (c *Collector) SetMaxConcurrentLists(value int)

SetMaxConcurrentLists overrides the list concurrency bound. Values below 1 are ignored so callers cannot accidentally remove the bound.

type PeerAuthenticationAvailability

type PeerAuthenticationAvailability = ScopedAvailability

PeerAuthenticationAvailability remains an alias for compatibility with existing hand-built snapshots and tests.

type Permission

type Permission struct {
	APIGroup         string
	Resource         string
	Verbs            []string
	Granted          bool
	Optional         bool
	Impact           string
	AffectedControls []string
	DeniedScopes     []string `json:"-"`
}

Permission records the evidence available for one attempted API resource list.

type Scope

type Scope struct {
	AllNamespaces bool
	Namespaces    []string
	RootNamespace string
}

Scope describes whether a scan reads every namespace or a bounded namespace set.

type ScopedAvailability

type ScopedAvailability struct {
	AllNamespaces bool
	Namespaces    map[string]bool
}

ScopedAvailability records which namespace list scopes were available.

type Snapshot

type Snapshot struct {
	RootNamespace                   string
	Namespaces                      []corev1.Namespace
	Nodes                           []corev1.Node
	NodesKnown                      bool
	Pods                            []corev1.Pod
	PodAvailability                 PeerAuthenticationAvailability
	ZtunnelPods                     []corev1.Pod
	ZtunnelPodsKnown                bool
	Deployments                     []appsv1.Deployment
	ReplicaSets                     []appsv1.ReplicaSet
	ReplicaSetAvailability          PeerAuthenticationAvailability
	StatefulSets                    []appsv1.StatefulSet
	DaemonSets                      []appsv1.DaemonSet
	DaemonSetAvailability           PeerAuthenticationAvailability
	ZtunnelDaemonSets               []appsv1.DaemonSet
	ZtunnelDaemonSetsKnown          bool
	Services                        []corev1.Service
	ServiceAvailability             ScopedAvailability
	EndpointSlices                  []discoveryv1.EndpointSlice
	EndpointSliceAvailability       ScopedAvailability
	PeerAuthentications             []*istiosecurityv1beta1.PeerAuthentication
	PeerAuthAvailability            ScopedAvailability
	DestinationRules                []*istionetworkingv1.DestinationRule
	DestinationRuleAvailability     ScopedAvailability
	Sidecars                        []*istionetworkingv1.Sidecar
	SidecarAvailability             ScopedAvailability
	AuthorizationPolicies           []*istiosecurityv1.AuthorizationPolicy
	AuthorizationPolicyAvailability ScopedAvailability
	Gateways                        []gatewayv1.Gateway
	GatewayAvailability             ScopedAvailability
	PermissionSummary               []Permission
}

Snapshot is the raw typed-resource bundle returned by collectors.

func (Snapshot) AuthorizationPoliciesAvailableFor

func (s Snapshot) AuthorizationPoliciesAvailableFor(namespace, rootNamespace string) bool

AuthorizationPoliciesAvailableFor reports whether mesh-root and workload namespace AuthorizationPolicy evidence was collected.

func (Snapshot) ClientProxiesAvailable

func (s Snapshot) ClientProxiesAvailable() bool

ClientProxiesAvailable reports whether every resource collection used to discover sidecar client proxies was complete. A gap in any scanned namespace can hide a client-selected DestinationRule, so contradiction evidence must remain unavailable rather than becoming a known false.

func (Snapshot) DaemonSetsAvailableFor

func (s Snapshot) DaemonSetsAvailableFor(namespace string) bool

DaemonSetsAvailableFor reports whether workload DaemonSet evidence was available in the requested namespace. Dedicated cluster-wide ztunnel discovery is tracked separately and must not make workload discovery incomplete when a namespace-scoped identity cannot perform that list.

func (Snapshot) DestinationRulesAvailableFor

func (s Snapshot) DestinationRulesAvailableFor(namespace, rootNamespace string) bool

DestinationRulesAvailableFor reports whether DestinationRule evidence was collected from both the workload and root configuration namespaces.

func (Snapshot) EndpointSlicesAvailableFor

func (s Snapshot) EndpointSlicesAvailableFor(namespace string) bool

EndpointSlicesAvailableFor reports whether selectorless Service endpoint attachment evidence was collected for a workload namespace.

func (Snapshot) GatewaysAvailable

func (s Snapshot) GatewaysAvailable() bool

GatewaysAvailable reports whether every attempted Gateway API list scope succeeded, which makes the aggregate waypoint count observable.

func (Snapshot) GatewaysAvailableFor

func (s Snapshot) GatewaysAvailableFor(namespace string) bool

GatewaysAvailableFor reports whether Gateway API waypoint evidence was collected for the namespace that owns a selected waypoint.

func (Snapshot) PeerAuthenticationsAvailable

func (s Snapshot) PeerAuthenticationsAvailable() bool

PeerAuthenticationsAvailable reports whether the scanner could list Istio PeerAuthentication resources. A missing CRD or permission denial makes mTLS posture unknown rather than silently defaulting.

func (Snapshot) PeerAuthenticationsAvailableFor

func (s Snapshot) PeerAuthenticationsAvailableFor(namespace, rootNamespace string) bool

PeerAuthenticationsAvailableFor reports whether PeerAuthentication evidence is sufficient for a workload namespace under the M1 mesh-wide/namespace-only resolver. It falls back to the aggregate permission summary for hand-built tests and future callers that do not populate per-scope availability.

func (Snapshot) PodsAvailableFor

func (s Snapshot) PodsAvailableFor(namespace string) bool

PodsAvailableFor reports whether pod evidence was available for the namespace. Hand-built snapshots without permission metadata default to available so unit tests can provide explicit pods without recreating collector bookkeeping.

func (Snapshot) ReplicaSetsAvailableFor

func (s Snapshot) ReplicaSetsAvailableFor(namespace string) bool

ReplicaSetsAvailableFor reports whether ReplicaSet ownership evidence was available for Deployment pod matching in the namespace.

func (Snapshot) ServicesAvailableFor

func (s Snapshot) ServicesAvailableFor(namespace string) bool

ServicesAvailableFor reports whether Service selection and Service-bound port evidence were collected for a workload namespace.

func (Snapshot) SidecarsAvailableFor

func (s Snapshot) SidecarsAvailableFor(namespace, rootNamespace string) bool

SidecarsAvailableFor reports whether workload-namespace and mesh-root Sidecar resource scoping evidence was collected.

Jump to

Keyboard shortcuts

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