Documentation
¶
Overview ¶
Package workloads provides the WorkloadDiscoverer interface for discovering backend workloads in both CLI and Kubernetes environments.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Discoverer ¶
type Discoverer interface {
// ListWorkloadsInGroup returns all workloads that belong to the specified group
ListWorkloadsInGroup(ctx context.Context, groupName string) ([]TypedWorkload, error)
// GetWorkloadAsVMCPBackend retrieves workload details and converts it to a vmcp.Backend.
// The returned Backend should have all fields populated except AuthConfig,
// which will be set by the discoverer based on the auth configuration.
// Returns nil if the workload exists but is not accessible (e.g., no URL).
GetWorkloadAsVMCPBackend(ctx context.Context, workload TypedWorkload) (*vmcp.Backend, error)
}
Discoverer is the interface for workload managers used by vmcp. This interface contains only the methods needed for backend discovery, allowing both CLI and Kubernetes managers to implement it.
func NewK8SDiscoverer ¶
func NewK8SDiscoverer(namespace ...string) (Discoverer, error)
NewK8SDiscoverer creates a new Kubernetes workload discoverer that directly uses the Kubernetes client to discover MCPServer CRDs. If namespace is empty, it will detect the namespace using k8s.GetCurrentNamespace().
func NewK8SDiscovererWithClient ¶
func NewK8SDiscovererWithClient(k8sClient client.Client, namespace string) Discoverer
NewK8SDiscovererWithClient creates a new Kubernetes workload discoverer with a provided client. This is useful for testing with fake clients.
type TypedWorkload ¶ added in v0.6.12
type TypedWorkload struct {
// Name is the name of the workload
Name string
// Type is the type of the workload (MCPServer or MCPRemoteProxy)
Type WorkloadType
}
TypedWorkload contains information about a discovered workload
type WorkloadType ¶ added in v0.6.12
type WorkloadType string
WorkloadType represents the type of workload
const ( // WorkloadTypeMCPServer represents an MCPServer workload WorkloadTypeMCPServer WorkloadType = "MCPServer" // WorkloadTypeMCPRemoteProxy represents an MCPRemoteProxy workload WorkloadTypeMCPRemoteProxy WorkloadType = "MCPRemoteProxy" )