runtimeapi

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NormalizeTeamSlug

func NormalizeTeamSlug(raw string) string

NormalizeTeamSlug canonicalizes a team slug using the platform store rules shared with identity APIs.

func PlatformMode

func PlatformMode() string

PlatformMode returns org or public, defaulting invalid or empty values to org.

func ResolveDeployImageReference

func ResolveDeployImageReference(image, namespace, teamSlug string) string

ResolveDeployImageReference expands short image names into the platform registry and namespace repository scope.

func ValidateDeployImage

func ValidateDeployImage(image, namespace, teamSlug, role string) error

ValidateDeployImage enforces registry allow-list and namespace-scoped repository rules for deployment images.

Types

type AccessService

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

func (*AccessService) HandleAdapterCertificate

func (s *AccessService) HandleAdapterCertificate(w http.ResponseWriter, r *http.Request)

HandleAdapterCertificate signs a client-generated CSR after verifying that its SPIFFE URI names a session owned by the authenticated principal.

func (*AccessService) HandleAdapterPreflight

func (s *AccessService) HandleAdapterPreflight(w http.ResponseWriter, r *http.Request)

HandleAdapterPreflight reports whether the selected server can use the configured adapter-certificate path. It performs reads only; enrollment still rechecks every condition before creating a session.

func (*AccessService) HandleAdapterSession

func (s *AccessService) HandleAdapterSession(w http.ResponseWriter, r *http.Request)

HandleAdapterSession issues (or reuses) an MCPAgentSession for an adapter call. The platform — not the adapter — picks the matching grant, caps the trust at the grant's ceiling, and writes the session resource. The adapter then uses the returned session to enroll a certificate for every request to the runtime gateway.

Errors:

  • 400 when body decoding or input validation fails
  • 401 when no Principal is on the request (auth middleware should reject first)
  • 403 when no matching enabled grant is found, or the principal lacks the team
  • 503 when Kubernetes is unavailable

func (*AccessService) HandleAdapterSessionItemPath

func (s *AccessService) HandleAdapterSessionItemPath(w http.ResponseWriter, r *http.Request)

HandleAdapterSessionItemPath deletes only a newly-created session whose certificate enrollment is still pending and whose owner is the caller.

func (*AccessService) HandleGrantItemPath

func (s *AccessService) HandleGrantItemPath(w http.ResponseWriter, r *http.Request)

HandleGrantItemPath handles GET, DELETE, PATCH, and legacy enable or disable actions for one MCPAccessGrant.

func (*AccessService) HandleRuntimeGrants

func (s *AccessService) HandleRuntimeGrants(w http.ResponseWriter, r *http.Request)

HandleRuntimeGrants lists and applies MCPAccessGrant resources within the caller's allowed namespace scope.

func (*AccessService) HandleRuntimePolicy

func (s *AccessService) HandleRuntimePolicy(w http.ResponseWriter, r *http.Request)

HandleRuntimePolicy returns the rendered gateway policy for a server the caller can administer.

func (*AccessService) HandleRuntimeSessions

func (s *AccessService) HandleRuntimeSessions(w http.ResponseWriter, r *http.Request)

HandleRuntimeSessions lists and applies platform sessions within the caller's allowed namespace scope.

func (*AccessService) HandleSessionItemPath

func (s *AccessService) HandleSessionItemPath(w http.ResponseWriter, r *http.Request)

HandleSessionItemPath handles GET, DELETE, PATCH, and legacy revoke or unrevoke actions for one MCPAgentSession.

type DeploymentService

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

func (*DeploymentService) EnsureCatalogNamespace

func (s *DeploymentService) EnsureCatalogNamespace(ctx context.Context, namespace string) error

EnsureCatalogNamespace creates or updates a catalog namespace with platform labels, security defaults, and ingress watch access.

func (*DeploymentService) HandleAdminDeployments

func (s *DeploymentService) HandleAdminDeployments(w http.ResponseWriter, r *http.Request)

HandleAdminDeployments lists platform-visible deployments across namespaces for admins.

func (*DeploymentService) HandleDeploymentItem

func (s *DeploymentService) HandleDeploymentItem(w http.ResponseWriter, r *http.Request)

HandleDeploymentItem deletes a user-managed Kubernetes deployment and service after namespace authorization.

func (*DeploymentService) HandleDeployments

func (s *DeploymentService) HandleDeployments(w http.ResponseWriter, r *http.Request)

HandleDeployments lists and applies user-managed Kubernetes deployments for the caller's namespace scope.

func (*DeploymentService) ListAdminDeploymentSummaries

func (s *DeploymentService) ListAdminDeploymentSummaries(ctx context.Context, namespace string) ([]map[string]any, error)

ListAdminDeploymentSummaries returns deployment summaries from all namespaces or one requested namespace.

func (*DeploymentService) ReconcileTeamNamespaceNetworkPolicies

func (s *DeploymentService) ReconcileTeamNamespaceNetworkPolicies(ctx context.Context) error

ReconcileTeamNamespaceNetworkPolicies refreshes the policies for every platform-managed workload namespace, including existing org/public/user catalogs. The historical method name is retained for callers. Ordinary API rollouts must replace old broad base policies as well as creating exceptions.

func (*DeploymentService) TeamIntentProvisionerConfig

func (s *DeploymentService) TeamIntentProvisionerConfig() (TeamIntentProvisionerConfig, bool)

TeamIntentProvisionerConfig returns the cluster provisioning dependencies for durable team intent reconciliation and observation, or false when Kubernetes is unavailable.

type InventoryService

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

func (*InventoryService) HandleRuntimeTools

func (s *InventoryService) HandleRuntimeTools(w http.ResponseWriter, r *http.Request)

HandleRuntimeTools returns a scoped, filterable catalog of tools across visible MCP servers.

type Principal

type Principal = passport.Principal

Principal is the authenticated platform identity contract shared by runtime handlers.

type RegistryPushService

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

func (*RegistryPushService) HandleRegistryPushTransfer

func (s *RegistryPushService) HandleRegistryPushTransfer(w http.ResponseWriter, r *http.Request)

HandleRegistryPushTransfer serves a one-time docker save tar to in-cluster helper pods.

func (*RegistryPushService) HandleRuntimeRegistryPush

func (s *RegistryPushService) HandleRuntimeRegistryPush(w http.ResponseWriter, r *http.Request)

HandleRuntimeRegistryPush accepts a docker save tar and pushes it to the platform registry from inside the cluster.

type RuntimeServer

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

RuntimeServer composes runtime API dependencies for analytics, Kubernetes control-plane access, and platform identity.

func NewRuntimeServer

func NewRuntimeServer(db clickhouse.Conn, dbName string, apiKeys map[string]struct{}, identity identityStore) (*RuntimeServer, error)

NewRuntimeServer creates a runtime server with Kubernetes access.

func (*RuntimeServer) Access

func (s *RuntimeServer) Access() *AccessService

Access returns the grant/session capability owned by the runtime server.

func (*RuntimeServer) AccessManager

func (s *RuntimeServer) AccessManager() *k8sstore.Manager

AccessManager returns the shared grant/session manager when initialized.

func (*RuntimeServer) Deployments

func (s *RuntimeServer) Deployments() *DeploymentService

Deployments returns the deployment capability owned by the runtime server.

func (*RuntimeServer) HandleActionRestart

func (s *RuntimeServer) HandleActionRestart(w http.ResponseWriter, r *http.Request)

HandleActionRestart restarts one or all platform runtime components.

func (*RuntimeServer) HandleDashboardSummary

func (s *RuntimeServer) HandleDashboardSummary(w http.ResponseWriter, r *http.Request)

HandleDashboardSummary returns analytics and live control-plane counters for the platform dashboard.

func (*RuntimeServer) HandleDelegationRecipients

func (s *RuntimeServer) HandleDelegationRecipients(w http.ResponseWriter, r *http.Request)

HandleDelegationRecipients resolves one explicitly named recipient team for a resource-namespace manager. It never grants access to global team directory listing, membership management, or private recipient account metadata.

func (*RuntimeServer) HandleOverviewDirectory

func (s *RuntimeServer) HandleOverviewDirectory(w http.ResponseWriter, r *http.Request)

func (*RuntimeServer) HandleOverviewServers

func (s *RuntimeServer) HandleOverviewServers(w http.ResponseWriter, r *http.Request)

func (*RuntimeServer) HandleRuntimeAgentPath

func (s *RuntimeServer) HandleRuntimeAgentPath(w http.ResponseWriter, r *http.Request)

HandleRuntimeAgentPath reads, renames, deactivates, or reactivates one agent.

func (*RuntimeServer) HandleRuntimeComponents

func (s *RuntimeServer) HandleRuntimeComponents(w http.ResponseWriter, r *http.Request)

HandleRuntimeComponents returns admin-only health details for platform components.

func (*RuntimeServer) HandleRuntimeGrafana

func (s *RuntimeServer) HandleRuntimeGrafana(w http.ResponseWriter, r *http.Request)

HandleRuntimeGrafana is the sole supported Grafana entry point. Authentication is performed by the runtime routes, not by a caller-provided identity header. Tenant data requests are restricted before they reach Grafana's shared datasource; editing a dashboard variable or using Explore cannot widen access.

func (*RuntimeServer) HandleRuntimeNamespaceItem

func (s *RuntimeServer) HandleRuntimeNamespaceItem(w http.ResponseWriter, r *http.Request)

HandleRuntimeNamespaceItem returns one visible namespace record or synthetic catalog namespace entry.

func (*RuntimeServer) HandleRuntimeNamespaces

func (s *RuntimeServer) HandleRuntimeNamespaces(w http.ResponseWriter, r *http.Request)

HandleRuntimeNamespaces lists namespaces visible to the caller, including catalog namespace entries for the current platform mode.

func (s *RuntimeServer) HandleRuntimeObservabilityLinks(w http.ResponseWriter, r *http.Request)

func (*RuntimeServer) HandleRuntimeObservabilityLogs

func (s *RuntimeServer) HandleRuntimeObservabilityLogs(w http.ResponseWriter, r *http.Request)

HandleRuntimeObservabilityLogs exposes only the authenticated server's recent container logs. The LogQL selector is constructed from the resolved MCPServer identity; callers cannot supply arbitrary Loki queries.

func (*RuntimeServer) HandleRuntimeObservabilityMetrics

func (s *RuntimeServer) HandleRuntimeObservabilityMetrics(w http.ResponseWriter, r *http.Request)

HandleRuntimeObservabilityMetrics returns a fixed set of owner-scoped, one-hour gateway metric values. Callers cannot submit PromQL.

func (*RuntimeServer) HandleRuntimeObservabilityPrometheusQuery

func (s *RuntimeServer) HandleRuntimeObservabilityPrometheusQuery(w http.ResponseWriter, r *http.Request)

func (*RuntimeServer) HandleRuntimeObservabilityTraces

func (s *RuntimeServer) HandleRuntimeObservabilityTraces(w http.ResponseWriter, r *http.Request)

HandleRuntimeObservabilityTraces returns one server's traces without handing the caller a query language. Tempo is single-tenant and a trace can contain spans from other servers (a caller that talks to several of them shares one trace), so isolation cannot rely on the search alone:

  • the search expression is built here from the authorized server's namespace and UID; no caller text reaches Tempo;
  • the response is rebuilt from spans that matched, so root names and services of other workloads in the same trace are never returned;
  • a trace is returned only after its spans are filtered to resources that carry this server's UID, and a trace with none of them is "not found".

func (*RuntimeServer) HandleRuntimeServerEvents

func (s *RuntimeServer) HandleRuntimeServerEvents(w http.ResponseWriter, r *http.Request)

HandleRuntimeServerEvents returns recent analytics events for a server the caller can administer.

func (*RuntimeServer) HandleRuntimeServerItem

func (s *RuntimeServer) HandleRuntimeServerItem(w http.ResponseWriter, r *http.Request)

HandleRuntimeServerItem returns or retires one MCPServer after namespace authorization.

func (*RuntimeServer) HandleRuntimeServers

func (s *RuntimeServer) HandleRuntimeServers(w http.ResponseWriter, r *http.Request)

HandleRuntimeServers lists and applies MCPServer resources within the caller's readable or publishable namespaces.

func (*RuntimeServer) HandleRuntimeTeamAgents

func (s *RuntimeServer) HandleRuntimeTeamAgents(w http.ResponseWriter, r *http.Request, p principal, teamSlug string)

HandleRuntimeTeamAgents lists and creates governance agents under a team.

func (*RuntimeServer) HandleRuntimeTeamItemPath

func (s *RuntimeServer) HandleRuntimeTeamItemPath(w http.ResponseWriter, r *http.Request)

HandleRuntimeTeamItemPath routes team detail and membership operations after role checks.

func (*RuntimeServer) HandleRuntimeTeams

func (s *RuntimeServer) HandleRuntimeTeams(w http.ResponseWriter, r *http.Request)

HandleRuntimeTeams lists visible teams and lets admins create team identity records.

func (*RuntimeServer) HandleWorkspaceAccess

func (s *RuntimeServer) HandleWorkspaceAccess(w http.ResponseWriter, r *http.Request)

func (*RuntimeServer) HandleWorkspaceServers

func (s *RuntimeServer) HandleWorkspaceServers(w http.ResponseWriter, r *http.Request)

func (*RuntimeServer) HandleWorkspaceTeams

func (s *RuntimeServer) HandleWorkspaceTeams(w http.ResponseWriter, r *http.Request)

Personal workspace membership comes from the resolved principal, including for admins. ListTeams intentionally has different, administrative semantics.

func (*RuntimeServer) Inventory

func (s *RuntimeServer) Inventory() *InventoryService

Inventory returns the tool inventory capability owned by the runtime server.

func (*RuntimeServer) KubernetesAvailable

func (s *RuntimeServer) KubernetesAvailable() bool

KubernetesAvailable reports whether Kubernetes-backed runtime endpoints can serve requests.

func (*RuntimeServer) KubernetesClients

func (s *RuntimeServer) KubernetesClients() *k8sclient.Clients

KubernetesClients returns the shared Kubernetes client bundle when initialized.

func (*RuntimeServer) RegistryPush

func (s *RuntimeServer) RegistryPush() *RegistryPushService

RegistryPush returns the registry push transfer capability owned by the runtime server.

func (*RuntimeServer) ResourceHistoryHandler

func (s *RuntimeServer) ResourceHistoryHandler() http.Handler

func (*RuntimeServer) SetAuditWriter

func (s *RuntimeServer) SetAuditWriter(writer auditWriter)

SetAuditWriter overrides the audit sink used by runtime mutation handlers.

type TeamIntentProvisionerConfig

type TeamIntentProvisionerConfig struct {
	Client                   kubernetes.Interface
	EnsureRegistryPullSecret func(context.Context, kubernetes.Interface, string) error
	Traefik                  k8sprovision.TraefikWatchConfig
	IngressFromNamespaces    []string
}

TeamIntentProvisionerConfig bundles the live Kubernetes client, registry pull secret provisioner, and Traefik watch settings used by the opt-in durable team intent worker and independent status observer.

Directories

Path Synopsis
Package k8sprovision owns Kubernetes namespace defaults, namespace-local RBAC, ingress watches and workload isolation.
Package k8sprovision owns Kubernetes namespace defaults, namespace-local RBAC, ingress watches and workload isolation.

Jump to

Keyboard shortcuts

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