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 workload names that belong to the specified group
ListWorkloadsInGroup(ctx context.Context, groupName string) ([]string, error)
// GetWorkloadAsVMCPBackend retrieves workload details by name and converts it to a vmcp.Backend.
// The returned Backend should have all fields populated except AuthStrategy and AuthMetadata,
// 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, workloadName string) (*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.