Documentation
¶
Overview ¶
Package vmcpconfig provides conversion logic from VirtualMCPServer CRD to vmcp Config
Index ¶
Constants ¶
const ( // AuthzConfigTypeCedarV1 is the MCPAuthzConfig.spec.type value for the Cedar // authorizer. vMCP's incoming-auth middleware is hard-coded to Cedar, so both // the converter and the VirtualMCPServer controller only resolve shared-config // references of this type; any other type fails fast. AuthzConfigTypeCedarV1 = "cedarv1" )
Variables ¶
This section is empty.
Functions ¶
func ConvertUpstreamFilter ¶ added in v0.55.0
func ConvertUpstreamFilter(cfg *mcpv1beta1.AuthServerUpstreamFilterConfig) *upstreamfilter.GroupBasedFilterConfig
ConvertUpstreamFilter converts the vMCP-only AuthServerUpstreamFilterConfig CRD field into the serializable upstreamfilter.GroupBasedFilterConfig that the auth-server runtime consumes. Returns nil when the CRD field is unset so the auth server preserves full-chain behavior.
Slice elements are cloned defensively so the resulting RunConfig does not alias the caller's CRD object; this prevents a later mutation of the live CR (e.g. a status-only patch that reuses pointers) from racing with the serialized ConfigMap payload.
Types ¶
type Converter ¶
type Converter struct {
// contains filtered or unexported fields
}
Converter converts VirtualMCPServer CRD specs to vmcp Config
func NewConverter ¶
func NewConverter(oidcResolver oidc.Resolver, k8sClient client.Client, options ...ConverterOption) (*Converter, error)
NewConverter creates a new Converter instance. oidcResolver is required and used to resolve OIDC configuration from various sources (kubernetes, configMap, inline). Use a mock resolver in tests. k8sClient is required for resolving MCPToolConfig references and fetching referenced VirtualMCPCompositeToolDefinition resources. Without WithDefaultRedisConfig, only explicit session storage is configured; conversion does not read the operator's environment. Returns an error if oidcResolver or k8sClient is nil.
func (*Converter) Convert ¶
func (c *Converter) Convert( ctx context.Context, vmcp *mcpv1beta1.VirtualMCPServer, telemetryCfg *mcpv1beta1.MCPTelemetryConfig, ) (*vmcpconfig.Config, *authserver.RunConfig, error)
Convert converts VirtualMCPServer CRD spec to a vmcp Config and an optional auth server RunConfig.
The conversion starts with a DeepCopy of the embedded config.Config from the CRD spec. This ensures that simple fields (like Optimizer, Metadata, etc.) are automatically passed through without explicit mapping. Only fields that require special handling (auth, aggregation, composite tools, telemetry) are explicitly converted below.
telemetryCfg is the already-fetched MCPTelemetryConfig (nil when not referenced). It is passed in by the controller to avoid redundant API calls; normalizeTelemetry uses it directly instead of re-fetching.
The returned Config is the serializable vMCP config. The RunConfig is non-nil only when AuthServerConfig is set on the VirtualMCPServer spec.
type ConverterOption ¶ added in v0.59.0
type ConverterOption func(*Converter)
ConverterOption configures a Converter's injected dependencies.
func WithDefaultRedisConfig ¶ added in v0.59.0
func WithDefaultRedisConfig(defaults *controllerutil.DefaultRedisConfig) ConverterOption
WithDefaultRedisConfig supplies the read-only global Redis snapshot loaded at operator startup. Nil disables the global fallback. It does not read Secrets or connect to Redis; the controller projects referenced Secrets into workloads.
type DelegateClientConfigValidationError ¶ added in v0.43.0
type DelegateClientConfigValidationError struct {
Err error
}
DelegateClientConfigValidationError marks an invalid delegate-client configuration after its effective scopes and audiences have been derived. Controllers can surface it as a terminal spec error rather than retrying.
func (*DelegateClientConfigValidationError) Error ¶ added in v0.43.0
func (e *DelegateClientConfigValidationError) Error() string
func (*DelegateClientConfigValidationError) Unwrap ¶ added in v0.43.0
func (e *DelegateClientConfigValidationError) Unwrap() error