istio

package
v0.0.1-rc.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 30 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package istio projects Istio registry, routing, security, ambient, and waypoint semantics onto Kubernetes identities and maps Istio active-probe access logs to telemetry events.

Inputs

The plugin opens no Kubernetes watch. It declares its GroupVersionResources through KubernetesResources and consumes the Kubernetes plugin's per-GVR collections and resource-coverage collection. Namespaces, Pods, Services, and Deployments are required; Gateway API Gateways and the Istio security and networking APIs are optional capabilities whose absence is reported as coverage, not as missing policy.

Identity and graph output

Istio resources are Kubernetes objects, so assertions reuse the Kubernetes kubernetes.io/v1 Object scheme (cluster authority, apiVersion/kind/UID key). ServiceEntry hosts become provider-neutral DNS or IP network destinations under the configured network ID. The "semantics" contribution emits governed-by (AuthorizationPolicy, PeerAuthentication, waypoint association) and exposes (ServiceEntry, VirtualService destinations) relationships and authorization-posture, istio-mtls, istio-data-plane, and serviceentry-binding facets with typed security semantics where the neutral schema can represent them. CollectionProjection marks that contribution ready.

Projection starts only after every object collection and the coverage collection have synchronized to a coherent generation. Malformed provider objects fail the candidate projection and keep the previous contribution. Unexpected subscription closure publishes a degraded replacement from the last coherent cache and returns an error.

Telemetry

Plugin.TelemetryMappings registers an OTLP log mapper for active-probe records, typically emitted by an ambient waypoint. It resolves namespace and name endpoint references to UIDs from the last coherent object snapshot and rejects records whose identity cannot be resolved rather than guessing.

The package also implements the peer-authentication/v1 remediation action, which requires mutual TLS for a Pod with a STRICT PeerAuthentication.

See https://agent-shield.dev/docs/plugins/istio/ for the telemetry attribute contract.

Index

Constants

View Source
const CollectionProjection = "istio/projection"

CollectionProjection signals readiness of the Istio semantic contribution; its graph assertions are published separately through ReplaceContribution.

View Source
const PluginID = "istio"

PluginID is the plugin and contribution owner ID.

Variables

This section is empty.

Functions

func ActiveProbeLogRecord

func ActiveProbeLogRecord(observation ActiveProbeObservation) telemetry.LogRecord

ActiveProbeLogRecord encodes observation as the OTLP log record the active-probe mapper accepts.

func Descriptor

func Descriptor() discovery.Descriptor

Descriptor declares Istio as a semantic consumer of Kubernetes observations, avoiding a second watch against the same cluster APIs.

func Project

func Project(clusterID, sourceID string, objects []*unstructured.Unstructured) (graph.Input, error)

Project projects bare objects with the cluster ID as network ID and the default istio-system root namespace. It exists for tests and offline evaluation; the plugin uses ProjectObserved with collection event IDs.

func ProjectForNetwork

func ProjectForNetwork(clusterID, networkID, rootNamespace, sourceID string, objects []*unstructured.Unstructured) (graph.Input, error)

ProjectForNetwork is Project with an explicit network ID and root namespace.

Types

type ActiveProbeObservation

type ActiveProbeObservation struct {
	EventID           string
	ObservedAt        time.Time
	SubjectAPIVersion string
	SubjectKind       string
	SubjectUID        string
	ObjectAPIVersion  string
	ObjectKind        string
	ObjectUID         string
	Operation         string
	Outcome           string
	Coverage          string
	Count             uint64
	HTTPStatuses      string
	Result            string
}

ActiveProbeObservation is the typed form of an active-probe record with UID-identified endpoints, used to build fixtures and replay records.

type CLIConfig

type CLIConfig struct {
	ClusterID     string
	NetworkID     string
	SourceID      string
	RootNamespace string
}

CLIConfig contains Istio-owned runtime options.

func (*CLIConfig) RegisterFlags

func (config *CLIConfig) RegisterFlags(flags *pflag.FlagSet) error

RegisterFlags registers Istio flags in the istio-* namespace.

type Config

type Config struct {
	ClusterID     string
	NetworkID     string
	SourceID      string
	RootNamespace string
	Actions       kubernetesplugin.WriteTransport
}

Config identifies the cluster and source shared with the Kubernetes plugin. NetworkID defaults to ClusterID and RootNamespace to istio-system. Actions enables the remediation action; nil leaves it unadvertised.

type Diagnostic

type Diagnostic struct {
	Code     string
	Resource string
}

Diagnostic records an observation that produced no graph semantics, such as an invalid host or unsupported field. It is not a graph fact.

type Index

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

Index is the immutable reconciliation index built once per projection. It indexes by UID for authoritative references and by normalized names only where Istio references are name-based.

func NewIndex

func NewIndex(scope ProjectionContext, observations []ObservedObject) *Index

NewIndex sorts observations, skipping objects without a UID, so the index is independent of input order. Callers keep observations immutable.

type ObservedObject

type ObservedObject = coherentcache.Object

ObservedObject keeps collection delivery metadata beside the native object so projected assertions can retain evidence provenance.

type Plugin

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

Plugin is the Istio semantic projection, telemetry mapping, and remediation plugin.

func New

func New(config Config) (*Plugin, error)

New validates config, applies defaults, and prepares typed clients for the shared Kubernetes collections.

func (*Plugin) Descriptor

func (p *Plugin) Descriptor() discovery.Descriptor

Descriptor implements discovery.Plugin; it returns the same value as the package-level Descriptor, which main also uses before construction.

func (*Plugin) Execute

Execute re-derives the plan, requires the provider state recorded by Prepare to be unchanged, labels the Pod, rechecks for conflicting PeerAuthentication, and creates the policy. If a step after labeling fails, the label is rolled back.

func (*Plugin) KubernetesResources

func (p *Plugin) KubernetesResources() []kubernetesplugin.ResourceRequirement

KubernetesResources lists the GVRs the Kubernetes plugin must watch for this plugin.

func (*Plugin) Plan

func (p *Plugin) Plan(ctx context.Context, proposal remediation.Proposal, actionID string) (remediation.Plan, error)

Plan resolves the proposal's target Pod and derives the desired target label and STRICT PeerAuthentication, rejecting conflicting existing policy. It writes nothing.

func (*Plugin) Prepare

Prepare submits the desired Pod label and PeerAuthentication as server-side dry runs so admission can reject them before any change, and records the admitted state.

func (*Plugin) RemediationDescriptor

func (p *Plugin) RemediationDescriptor() remediation.Descriptor

RemediationDescriptor advertises the peer-authentication/v1 mutual TLS action for Kubernetes Pods when an action transport is configured.

func (*Plugin) Run

func (p *Plugin) Run(ctx context.Context, runtime discovery.Runtime) error

Run consumes the Kubernetes collections and replaces the semantics contribution whenever both object and coverage collections reach a new coherent generation. Each coherent object set also refreshes the telemetry resolver, so the mapper sees the same snapshot as the projection.

func (*Plugin) SourceID

func (p *Plugin) SourceID() string

SourceID returns the Kubernetes source ID this plugin projects for.

func (*Plugin) TelemetryMappings

func (p *Plugin) TelemetryMappings() []telemetry.Mapping

TelemetryMappings registers the active-probe OTLP mapper. Its resolver sees the same coherent snapshot as the last projection.

func (*Plugin) Verify

Verify reports satisfied only while the live Pod label and PeerAuthentication still match the digests recorded at execution. It checks declared configuration, not observed mTLS traffic.

type ProjectionContext

type ProjectionContext struct {
	ClusterID            string
	NetworkID            string
	SourceID             string
	RootNamespace        string
	GatewayCoverageKnown bool
}

ProjectionContext carries authority and coverage boundaries into the pure semantic projection; it contains no runtime or provider clients.

type ProjectionResult

type ProjectionResult struct {
	Input       graph.Input
	Diagnostics []Diagnostic
}

ProjectionResult separates publishable assertions from bounded diagnostics about observations that could not produce graph semantics.

func ProjectObserved

func ProjectObserved(scope ProjectionContext, observations []ObservedObject) (ProjectionResult, error)

ProjectObserved deterministically projects one coherent snapshot. The result is independent of observation order.

Directories

Path Synopsis
Package api holds typed subsets of the Istio security.istio.io and networking.istio.io resources the Istio projector reads.
Package api holds typed subsets of the Istio security.istio.io and networking.istio.io resources the Istio projector reads.

Jump to

Keyboard shortcuts

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