accessintentobserver

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package accessintentobserver runs an independent status observer for durable access-control grant intents. It reads live Kubernetes MCPAccessGrant CRs and serving gateway replica status endpoints, reports fenced observations with a monotonic observer_epoch, and never creates desired revisions or River jobs.

Index

Constants

This section is empty.

Variables

View Source
var ErrStaleObserverEpoch = errors.New("observer epoch superseded by newer lease holder")

ErrStaleObserverEpoch is returned when Platform API rejects an observation because a newer observer holds the cluster lease.

Functions

This section is empty.

Types

type Config

type Config struct {
	ClusterKey string
	ObserverID string
	Interval   time.Duration
}

Config configures the independent access-intent observer.

type GatewayStatusProber

type GatewayStatusProber interface {
	ProbeServingReplicas(ctx context.Context, namespace, serverName, serverUID string) ([]apikit.GrantGatewayReplicaEvidence, error)
}

GatewayStatusProber queries every serving gateway replica for a target server UID.

type GrantReader

type GrantReader interface {
	GetGrantCR(ctx context.Context, namespace, name string) (*ObservedGrantCR, bool, error)
}

GrantReader inspects live MCPAccessGrant CR state in Kubernetes.

type K8sGatewayStatusProber

type K8sGatewayStatusProber struct {
	Clientset  kubernetes.Interface
	HTTPClient *http.Client
	StatusPort int
}

K8sGatewayStatusProber discovers serving gateway Pods for an MCPServer and queries each replica's /config/status endpoint.

func (*K8sGatewayStatusProber) ProbeServingReplicas

func (p *K8sGatewayStatusProber) ProbeServingReplicas(ctx context.Context, namespace, serverName, serverUID string) ([]apikit.GrantGatewayReplicaEvidence, error)

type K8sGrantReader

type K8sGrantReader struct {
	Dynamic dynamic.Interface
}

K8sGrantReader reads live MCPAccessGrant CRs via dynamic.Interface.

func (*K8sGrantReader) GetGrantCR

func (r *K8sGrantReader) GetGrantCR(ctx context.Context, namespace, name string) (*ObservedGrantCR, bool, error)

type ObservedGrantCR

type ObservedGrantCR struct {
	UID               string
	Generation        int64
	GrantID           string
	ServerUID         string
	DesiredRevisionID string
	SpecDigest        string
	Disabled          bool
}

ObservedGrantCR is the sanitized Kubernetes MCPAccessGrant metadata read by the observer.

type Observer

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

Observer watches grant CRs and serving gateway replicas independently of workers.

func New

func New(platform PlatformClient, grants GrantReader, prober GatewayStatusProber, cfg Config) *Observer

New constructs an independent access-intent observer.

func (*Observer) Epoch

func (o *Observer) Epoch() int64

Epoch returns the observer's currently held lease epoch (0 if unacquired).

func (*Observer) ReconcileOnce

func (o *Observer) ReconcileOnce(ctx context.Context) error

ReconcileOnce evaluates every durable grant intent once and writes fenced independent observations to Platform API.

func (*Observer) Run

func (o *Observer) Run(ctx context.Context)

Run continuously polls grant CRs and serving gateway replicas until ctx is canceled.

type PlatformClient

type PlatformClient interface {
	ListGrantIntents(ctx context.Context) ([]apikit.GrantIntent, error)
	ClaimAccessIntentObserverLease(ctx context.Context, clusterKey, observerID string) (apikit.AccessIntentObserverLeaseResponse, error)
	RecordGrantIntentObservation(ctx context.Context, grantID string, req apikit.GrantIntentObservationRequest) (apikit.GrantObservation, error)
}

PlatformClient is the read + observation-only Platform API surface. It deliberately omits intent write and job-enqueue capabilities.

Jump to

Keyboard shortcuts

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