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
- func ActiveProbeLogRecord(observation ActiveProbeObservation) telemetry.LogRecord
- func Descriptor() discovery.Descriptor
- func Project(clusterID, sourceID string, objects []*unstructured.Unstructured) (graph.Input, error)
- func ProjectForNetwork(clusterID, networkID, rootNamespace, sourceID string, ...) (graph.Input, error)
- type ActiveProbeObservation
- type CLIConfig
- type Config
- type Diagnostic
- type Index
- type ObservedObject
- type Plugin
- func (p *Plugin) Descriptor() discovery.Descriptor
- func (p *Plugin) Execute(ctx context.Context, proposal remediation.Proposal, plan remediation.Plan, ...) (remediation.ExecutionResult, error)
- func (p *Plugin) KubernetesResources() []kubernetesplugin.ResourceRequirement
- func (p *Plugin) Plan(ctx context.Context, proposal remediation.Proposal, actionID string) (remediation.Plan, error)
- func (p *Plugin) Prepare(ctx context.Context, proposal remediation.Proposal, plan remediation.Plan) (remediation.Preparation, error)
- func (p *Plugin) RemediationDescriptor() remediation.Descriptor
- func (p *Plugin) Run(ctx context.Context, runtime discovery.Runtime) error
- func (p *Plugin) SourceID() string
- func (p *Plugin) TelemetryMappings() []telemetry.Mapping
- func (p *Plugin) Verify(ctx context.Context, proposal remediation.Proposal, plan remediation.Plan, ...) (remediation.Verification, error)
- type ProjectionContext
- type ProjectionResult
Constants ¶
const CollectionProjection = "istio/projection"
CollectionProjection signals readiness of the Istio semantic contribution; its graph assertions are published separately through ReplaceContribution.
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 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 ¶
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 ¶
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 ¶
func (p *Plugin) Execute(ctx context.Context, proposal remediation.Proposal, plan remediation.Plan, preparation remediation.Preparation) (remediation.ExecutionResult, error)
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 ¶
func (p *Plugin) Prepare(ctx context.Context, proposal remediation.Proposal, plan remediation.Plan) (remediation.Preparation, error)
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 ¶
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) TelemetryMappings ¶
TelemetryMappings registers the active-probe OTLP mapper. Its resolver sees the same coherent snapshot as the last projection.
func (*Plugin) Verify ¶
func (p *Plugin) Verify(ctx context.Context, proposal remediation.Proposal, plan remediation.Plan, result remediation.ExecutionResult) (remediation.Verification, error)
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.