mcpserver

package
v2.3.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// ControllerName is the name used for logging and event recording.
	ControllerName = "mcpserver"
)
View Source
const (
	// TriggerChannelBufSize is the buffer size for the channel used to
	// enqueue artificial reconciliation events.
	TriggerChannelBufSize = 100
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CPEvent

type CPEvent struct {
	Type                    EventType
	KonnectClient           sdkops.SDKWrapper
	KonnectClientForPolling sdkops.SDKWrapper
	ControlPlane            *konnectv1alpha2.KonnectGatewayControlPlane
}

CPEvent signals that a KonnectGatewayControlPlane event occurred. ControlPlane is always set. For EventTypeDeregister it may be a stub carrying only the Name and Namespace needed for cancellation.

type EventType

type EventType string

EventType represents the type of a control plane event.

const (
	// EventTypeRegister signals that a KonnectGatewayControlPlane became available
	// and its signal-polling routine should be started.
	EventTypeRegister EventType = "register"
	// EventTypeDeregister signals that a KonnectGatewayControlPlane was removed
	// and its signal-polling routine should be stopped.
	EventTypeDeregister EventType = "deregister"
)

type MCPServerCPReconciler

type MCPServerCPReconciler struct {
	client.Client

	ControllerOptions    controller.Options
	LoggingMode          logging.Mode
	SignalManager        *SignalManager
	SdkFactory           sdkops.SDKFactory
	SdkFactoryForPolling sdkops.SDKFactory
}

MCPServerCPReconciler reconciles a KonnectGatewayControlPlane object.

func (*MCPServerCPReconciler) Reconcile

func (r *MCPServerCPReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)

Reconcile reconciles the KonnectGatewayControlPlane resource.

func (*MCPServerCPReconciler) SetupWithManager

func (r *MCPServerCPReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type MCPServerDataPlaneReconciler added in v2.3.0

type MCPServerDataPlaneReconciler struct {
	client.Client

	Scheme *runtime.Scheme

	ControllerOptions controller.Options
	LoggingMode       logging.Mode
	SignalManager     *SignalManager
	SdkFactory        sdkops.SDKFactory

	ClusterDomain string

	// ReconcileEventCh allows external callers to push synthetic reconciliation
	// events so that a Reconcile loop starts without an actual change on the
	// MCPServer CRD.
	ReconcileEventCh chan event.GenericEvent

	// TypeConverter is injected via the TypeConverterProvider at controller
	// registration time.  It is used for diff-before-apply via Server-Side Apply.
	TypeConverter managedfields.TypeConverter

	SecretLabelSelector string
	// contains filtered or unexported fields
}

MCPServerDataPlaneReconciler reconciles a MCPServerDataPlane object.

func (*MCPServerDataPlaneReconciler) Reconcile added in v2.3.0

Reconcile reconciles the MCPServer resource.

func (*MCPServerDataPlaneReconciler) SetupWithManager added in v2.3.0

func (r *MCPServerDataPlaneReconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type MCPServerSignalReconciler added in v2.3.0

type MCPServerSignalReconciler struct {
	client.Client

	ControllerOptions controller.Options
	LoggingMode       logging.Mode
	SignalManager     *SignalManager
}

MCPServerSignalReconciler reconciles a mirrored konnectv1alpha1.MCPServer to keep the signal-polling offset in sync with its lifecycle: it adds mcpServerFinalizer to every mirror and, on deletion, notifies the SignalManager to reset the offset before letting the object go.

This is deliberately separate from MCPServerDataPlaneReconciler: the reset must react to the mirrored MCPServer disappearing, not to the DataPlane workload being torn down.

func (*MCPServerSignalReconciler) Reconcile added in v2.3.0

Reconcile reconciles the mirrored MCPServer resource.

func (*MCPServerSignalReconciler) SetupWithManager added in v2.3.0

func (r *MCPServerSignalReconciler) SetupWithManager(_ context.Context, mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

type MCPServersFetcher

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

MCPServersFetcher asynchronously fetches all MCP servers for a given control plane. It blocks on a wakeup channel and, upon receiving a signal, retrieves the full list of MCP servers from the Konnect API using ListMcpServersByControlPlane, paginating as needed, and creates a mirrored MCPServer Kubernetes object for each one.

func NewMCPServersFetcher

func NewMCPServersFetcher(
	loggingMode logging.Mode,
	cl client.Client,
	konnectClient sdkops.SDKWrapper,
	fetchEventCh chan struct{},
	reconcileEventCh chan<- event.GenericEvent,
	controlPlane *konnectv1alpha2.KonnectGatewayControlPlane,
	scheme *runtime.Scheme,
) *MCPServersFetcher

NewMCPServersFetcher creates a new MCPServersFetcher.

type SignalManager

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

SignalManager manages a set of per-UUID background goroutines that periodically poll the Konnect MCP server signal API until stopped or the parent context is cancelled. Events are delivered via a channel and consumed by the internal dispatch loop.

func NewSignalManager

func NewSignalManager(loggingMode logging.Mode, client client.Client, scheme *runtime.Scheme, reconcileEventCh chan<- event.GenericEvent) *SignalManager

NewSignalManager creates a new SignalManager.

func (*SignalManager) CPEvents

func (s *SignalManager) CPEvents() <-chan CPEvent

CPEvents returns a read-only channel delivering CP lifecycle events. It is intended for use in tests.

func (*SignalManager) EmitControlPlaneEvent

func (s *SignalManager) EmitControlPlaneEvent(ctx context.Context, ev CPEvent)

EmitControlPlaneEvent sends ev to the dispatch channel. It blocks until the event is accepted or ctx is done.

func (*SignalManager) NotifyMCPServerDeleted

func (s *SignalManager) NotifyMCPServerDeleted(namespace, cpName string)

NotifyMCPServerDeleted sends a reset signal to the signal routine of the control plane identified by namespace/cpName, so that the next poll uses the initial offset and picks up any changes caused by the deletion.

Jump to

Keyboard shortcuts

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