Documentation
¶
Overview ¶
Package topology is the layout of the platform: what runs where, how it is addressed and which catalogs exist. It has no repository imports and does not provision resources or authorize requests.
- Components and placement: the component catalog, owners, namespaces, ports, credential Secret placement and service hosts.
- Mode and scopes: the org and public platform modes, the tenant and org publish scopes, and the catalog namespaces they imply. There is no anonymous catalog.
- Public routes: validation of customer-facing paths and the default MCP route.
- Hosts and registry: resolution of the registry, MCP and platform hostnames from the environment, and rewriting of image references for push, display and in-cluster pulls.
Index ¶
- Constants
- func CredentialOwner(key string) (string, bool)
- func CredentialPlacement(key string) (namespace, name string, ok bool)
- func DefaultMCPPath(serverName string) string
- func DisplayImageReference(image string) string
- func ImageRefForClusterPull(image string) string
- func NormalizePlatformDomain(raw string) string
- func OwnerNamespaces() map[Owner]string
- func ResolveMcpIngressHost() string
- func ResolvePlatformIngressHost() string
- func ResolveRegistryEndpoint() string
- func ResolveRegistryHost() string
- func ResolveRegistryPullHost() string
- func RewriteImageRegistryHost(image, registry string) (string, bool)
- func RoutesOverlap(a, b string) bool
- func ScopeCatalogNamespace(scope Scope) (string, bool)
- func ScopeRegistryAlias(scope Scope) (string, bool)
- func ServiceHost(key string, port int) (string, error)
- func ValidateRoutePath(value string, allowRoot bool) error
- type Capability
- type Component
- type CredentialSet
- type Dependency
- type Mode
- func (m Mode) CatalogNamespaces() []string
- func (m Mode) CatalogNamespacesForScope(scope Scope) []string
- func (m Mode) CatalogScope(namespace string) (Scope, bool)
- func (m Mode) DefaultCatalogNamespace() string
- func (m Mode) EnabledPublishScopes() []Scope
- func (m Mode) IsCatalogNamespace(namespace string) bool
- func (m Mode) SharedCatalogWritable() bool
- type Owner
- type PortTarget
- type Routes
- type Scope
Constants ¶
const ( PlatformNamespace = "mcp-platform" ObservabilityNamespace = "mcp-observability" LogCollectorNamespace = "mcp-log-collector" OperatorNamespace = "github.com/mcp-runtime/mcp-runtime" // The namespace is the location; the name marks the copy as shared. SharedConfigName = "mcp-shared-config" // SharedDataPriorityClass outranks SharedServicesPriorityClass during eviction. // Both are cluster-scoped and used by more than one namespace. )
const ( // DefaultRegistryHost names the registry used when none is configured. DefaultRegistryHost = "registry.local" MCPServerPort = 8088 MCPGatewayPort = 8091 // DefaultServerNamespace is the namespace used when a command or resource // omits one. There is no separate base namespace: servers live in a // catalog namespace (organization by default) or a team namespace. DefaultServerNamespace = DefaultOrgCatalogNamespace // AnalyticsTokenAudience must match the audience accepted by ingest. AnalyticsTokenAudience = "github.com/mcp-runtime/mcp-runtime/services/ingest" )
const ( ScopeTenant Scope = "tenant" ScopeOrg Scope = "org" DefaultOrgCatalogNamespace = "mcp-servers-org" OrgRegistryAlias = "org" )
const DefaultDocsURL = "https://mcpruntime.org/docs/"
Variables ¶
This section is empty.
Functions ¶
func CredentialOwner ¶
CredentialOwner returns the authoritative Secret for a key. For shared API auth keys platform-api is the owner; the remaining API/UI copies are derived.
func CredentialPlacement ¶
CredentialPlacement returns the namespace and Secret that own a key.
func DefaultMCPPath ¶
DefaultMCPPath is the default public MCP path for a managed server.
func DisplayImageReference ¶
DisplayImageReference rewrites internal registry image refs for user-facing display. It prefers the public registry host when configured, and otherwise strips the internal host so cluster-only endpoints do not leak into UI/API responses.
func ImageRefForClusterPull ¶
ImageRefForClusterPull rewrites platform-registry images to the in-cluster pull host.
func NormalizePlatformDomain ¶
NormalizePlatformDomain returns a lowercased FQDN suitable for "registry." + d and "mcp." + d, or an empty string if the input is unusable.
func OwnerNamespaces ¶
OwnerNamespaces returns a copy of the install placement.
func ResolveMcpIngressHost ¶
func ResolveMcpIngressHost() string
func ResolvePlatformIngressHost ¶
func ResolvePlatformIngressHost() string
ResolvePlatformIngressHost is the public hostname for the platform / admin dashboard UI: MCP_PLATFORM_INGRESS_HOST, else platform.<MCP_PLATFORM_DOMAIN> when the platform domain is set, else empty (path-based dev routing is used).
func ResolveRegistryEndpoint ¶
func ResolveRegistryEndpoint() string
ResolveRegistryEndpoint returns the registry endpoint used by pulls and in-cluster skopeo: MCP_REGISTRY_ENDPOINT, then MCP_REGISTRY_HOST, then registry.<MCP_PLATFORM_DOMAIN>, then the local default. It deliberately skips MCP_REGISTRY_INGRESS_HOST, the public auth-protected host, so an install that only names its ingress still gets the "set MCP_REGISTRY_ENDPOINT" guidance instead of pulling through the public edge.
func ResolveRegistryHost ¶
func ResolveRegistryHost() string
ResolveRegistryHost resolves the public host used for default image names, ingress, and registry credentials. Precedence is MCP_REGISTRY_INGRESS_HOST, MCP_REGISTRY_HOST, registry.<MCP_PLATFORM_DOMAIN>, then the local development default. MCP_REGISTRY_ENDPOINT is reserved for internal pulls and transfers, so it must not become a public host fallback.
func ResolveRegistryPullHost ¶
func ResolveRegistryPullHost() string
ResolveRegistryPullHost returns the registry host kubelet should use for in-cluster image pulls. Precedence: MCP_REGISTRY_PULL_HOST, MCP_REGISTRY_ENDPOINT, then bundled cluster DNS.
Public ingress hostnames are intentionally excluded. Workload pods must pull from the internal registry endpoint, not the auth-protected external ingress.
func RewriteImageRegistryHost ¶
RewriteImageRegistryHost replaces the registry portion of an image reference.
func RoutesOverlap ¶
func ScopeCatalogNamespace ¶
func ScopeRegistryAlias ¶
func ServiceHost ¶
ServiceHost is the in-cluster DNS name for a component Service port.
func ValidateRoutePath ¶
ValidateRoutePath rejects escaped separators, traversal, URL components, and characters that could change a generated ingress or middleware definition.
Types ¶
type Capability ¶
type Capability string
const ( Control Capability = "control" Telemetry Capability = "telemetry" Routing Capability = "routing" Persistent Capability = "persistent" NodeLogs Capability = "node-logs" Optional Capability = "optional" External Capability = "external" )
type Component ¶
type Component struct {
Owner Owner `json:"-"`
Capabilities []Capability `json:"-"`
Dependencies []Dependency `json:"-"`
Managed bool `json:"-"`
Key string
Display string
Namespace string
Kind string
Resource string
Label string
Aliases []string
PortTarget *PortTarget
}
Component identifies a stable platform component independently of placement.
func Catalog ¶
func Catalog() []Component
Catalog returns an independent copy, including nested metadata.
func PlatformComponents ¶
PlatformComponents preserves the existing management surface. Image-only, optional authentication and database components are deliberately not added to restart-all or to the public status response by inventory consolidation.
type CredentialSet ¶
CredentialSet defines the exact keys delivered to its consumers. Shared keys have one authoritative set; setup synchronizes only explicitly listed copies. This metadata describes consumption, not authorization to read Secrets.
func CredentialSets ¶
func CredentialSets() []CredentialSet
CredentialSets returns copies safe for callers to modify.
func (CredentialSet) Namespace ¶
func (set CredentialSet) Namespace() string
Namespace returns the install namespace for a credential set from its first consumer. A set with no consumer stays with the platform owner.
type Dependency ¶
Dependency describes a service relationship, not rollout order. Optional dependencies must not block the control plane during telemetry outages.
type Mode ¶
type Mode string
Mode is the canonical lower-case representation of a platform mode.
const ( // ModeOrg exposes a shared organization catalog that signed-in users may // publish into. Tenant namespaces remain reachable to their owners. ModeOrg Mode = "org" // ModePublic is the hosted, internet-facing deployment profile. Its // catalogs and publish scopes are identical to ModeOrg (tenant and org); // it only adds the stricter setup login-configuration requirements. There // is no anonymous catalog. ModePublic Mode = "public" )
func ModeFromEnv ¶
func ModeFromEnv() Mode
ModeFromEnv reads the current platform mode from PLATFORM_MODE, falling back to MCP_PLATFORM_MODE. Unknown values resolve to ModeOrg.
func NormalizeMode ¶
NormalizeMode returns the canonical mode for raw. The second return value is true when raw was empty or matched a known mode; unknown values fall back to ModeOrg and return false. Tenant is a publish scope, not a platform mode.
func (Mode) CatalogNamespaces ¶
CatalogNamespaces returns the shared catalog namespaces of the mode.
func (Mode) CatalogNamespacesForScope ¶
CatalogNamespacesForScope returns the catalog namespaces of a publish scope. Only the org scope has shared catalogs; tenant namespaces are per team.
func (Mode) CatalogScope ¶
CatalogScope reports the publishing boundary of a catalog namespace.
func (Mode) DefaultCatalogNamespace ¶
DefaultCatalogNamespace returns the primary catalog namespace for the active mode. Unknown modes return an empty namespace.
Override precedence (first non-empty wins):
- PLATFORM_CATALOG_NAMESPACE
- MCP_PLATFORM_CATALOG_NAMESPACE
- PLATFORM_ORG_NAMESPACE
- built-in default (DefaultOrgCatalogNamespace)
func (Mode) EnabledPublishScopes ¶
EnabledPublishScopes returns the publishing boundaries enabled by the mode: tenant and org in every known mode.
func (Mode) IsCatalogNamespace ¶
IsCatalogNamespace reports whether namespace is one of the active mode's catalog namespaces.
func (Mode) SharedCatalogWritable ¶
SharedCatalogWritable reports whether signed-in users may publish into the active catalog namespace (true for ModeOrg and ModePublic).
type PortTarget ¶
PortTarget defines a port forwarding target.
type Routes ¶
func (Routes) PlatformPrefix ¶
func (Routes) ValidateAuth ¶
ValidateAuth checks collisions when the issuer shares the platform hostname.