Documentation
¶
Overview ¶
Package platformrelease defines the MCP Runtime platform component catalog, the per-release component manifest format, and version/image helpers shared by `mcp-runtime setup` (version stamping) and `mcp-runtime update`.
Index ¶
- Constants
- func BundleCRDs(dir string) (string, error)
- func CRDObjectNames(crdsYAML string) ([]string, error)
- func CompareVersionStrings(a, b string) (cmp int, ok bool)
- func ComponentNames() []string
- func DigestFromImageID(imageID string) string
- func FilterCRDBundle(crdsYAML string) (filtered string, names []string, err error)
- func LoadManifest(ctx context.Context, source string, client *http.Client) ([]byte, error)
- func MetadataPatch(c Component, version string) map[string]any
- func PreviousImageAnnotation(component string) string
- func ReleaseCRDsURL(version string) string
- func ReleaseManifestURL(version string) string
- func StampInstalledVersion(ctx context.Context, cs kubernetes.Interface, version string) error
- func ValidDigest(s string) bool
- func ValidTag(s string) bool
- type Component
- type ImageRef
- type Manifest
- type ManifestComponent
- type OptIn
- type Version
Constants ¶
const ( LabelPartOf = "app.kubernetes.io/part-of" LabelPartOfValue = "github.com/mcp-runtime/mcp-runtime" LabelComponent = "mcpruntime.org/component" AnnotationVersion = "mcpruntime.org/platform-version" )
Metadata keys written on platform Deployments. They live on Deployment metadata (never the pod template) so writing them never triggers a rollout.
const ( // OperatorDeployment is the operator controller-manager Deployment name. OperatorDeployment = "mcp-runtime-operator-controller-manager" // OperatorNamespace is the namespace the operator runs in. OperatorNamespace = nsRuntime )
const ( // ManifestAPIVersion is the release manifest schema version. ManifestAPIVersion = "mcpruntime.org/v1alpha1" // ManifestKind is the release manifest kind. ManifestKind = "PlatformRelease" // ManifestAssetName is the file name attached to GitHub releases. ManifestAssetName = "platform-manifest.json" // CRDsAssetName is the standalone multi-document CRD YAML attached to // GitHub releases. update also accepts CRDs embedded in the manifest. CRDsAssetName = "platform-crds.yaml" // DefaultReleaseBaseURL is where --to resolves release manifests. DefaultReleaseBaseURL = "https://github.com/mcp-runtime/mcp-runtime/releases/download" )
Variables ¶
This section is empty.
Functions ¶
func BundleCRDs ¶
BundleCRDs reads every .yaml/.yml file under dir (lexically sorted) and returns a multi-document YAML bundle suitable for embedding in a release manifest or publishing as platform-crds.yaml.
func CRDObjectNames ¶
CRDObjectNames returns metadata.name values for CustomResourceDefinition documents in a multi-document YAML bundle.
func CompareVersionStrings ¶
CompareVersionStrings compares two version strings. ok is false when either side is not a semantic version, in which case the result is meaningless.
func ComponentNames ¶
func ComponentNames() []string
ComponentNames returns all catalog component names, sorted.
func DigestFromImageID ¶
DigestFromImageID extracts the sha256 digest from a container status imageID such as "docker-pullable://repo@sha256:..." or "repo@sha256:...".
func FilterCRDBundle ¶
FilterCRDBundle keeps only CustomResourceDefinition documents from a multi-document YAML bundle and returns their metadata.name values in order. Any other non-empty kind is rejected so update cannot apply arbitrary cluster objects from a release or --crds file.
func LoadManifest ¶
LoadManifest reads a manifest from a local path or an https:// URL.
func MetadataPatch ¶
MetadataPatch returns a merge patch that sets the platform labels and, for MCP Runtime-built components, the platform-version annotation on a Deployment's own metadata. It never touches the pod template.
func PreviousImageAnnotation ¶
PreviousImageAnnotation returns the annotation key update uses to record the image a component ran before the most recent update, for manual recovery.
func ReleaseCRDsURL ¶
ReleaseCRDsURL returns the GitHub release asset URL for the CRD bundle.
func ReleaseManifestURL ¶
ReleaseManifestURL returns the GitHub release asset URL for a version.
func StampInstalledVersion ¶
StampInstalledVersion labels and annotates every installed MCP Runtime Deployment with the platform version setup just deployed. Missing Deployments are skipped. Third-party components (cert-manager) are never stamped. Metadata-only patches do not trigger rollouts.
func ValidDigest ¶
ValidDigest reports whether s is a sha256 digest.
Types ¶
type Component ¶
type Component struct {
// Name is the stable component identifier used in manifests and --only.
Name string
// Namespace and Deployment identify the workload. Empty Deployment means
// the image has no long-running workload (for example doctor-smoke).
Namespace string
Deployment string
// Container is the container name inside the Deployment pod template.
Container string
// EnvVar, when set, means the image is stored in this env var on the
// container instead of the container image (gateway proxy sidecar image).
EnvVar string
// Repository is the default image repository, used for manifest generation.
// Empty for components MCP Runtime does not build.
Repository string
// Built reports whether MCP Runtime builds and versions this image with
// the platform release (so the platform-version annotation applies).
Built bool
// OptIn marks components excluded unless explicitly selected.
OptIn OptIn
// Note is shown in plans when the component changes.
Note string
}
Component maps a release-manifest component name to the single workload container (or env var) that carries its image. The CLI owns this mapping; release manifests only provide image coordinates, so a manifest can never direct update at an arbitrary workload.
func Catalog ¶
func Catalog() []Component
Catalog returns a copy of the component catalog in rollout order.
func (Component) HasWorkload ¶
HasWorkload reports whether the component is backed by a Deployment.
type ImageRef ¶
type ImageRef struct {
// Registry is the registry host (with optional port); empty when the
// reference is relative (for example "mcp-ui:v1").
Registry string
// Path is the repository path without the registry host.
Path string
Tag string
Digest string
}
ImageRef is a parsed OCI image reference.
func ParseImageRef ¶
ParseImageRef parses repo[:tag][@digest] with an optional registry host.
type Manifest ¶
type Manifest struct {
APIVersion string `json:"apiVersion"`
Kind string `json:"kind"`
// Version is the platform release version (semver).
Version string `json:"version"`
// Registry optionally resolves relative component repositories. When
// empty, relative repositories resolve against the registry host of the
// image currently running in the cluster.
Registry string `json:"registry,omitempty"`
// CRDChange reports that this release changes CustomResourceDefinitions.
// When true, update applies CRDs from CRDs (or --crds / platform-crds.yaml)
// before patching component images.
CRDChange bool `json:"crdChange,omitempty"`
// CRDs is a multi-document YAML of CustomResourceDefinitions embedded in
// the release manifest so `mcp-runtime update --to` can apply schema
// changes without a separate setup run.
CRDs string `json:"crds,omitempty"`
Components []ManifestComponent `json:"components"`
}
Manifest is the authoritative per-release component version list.
func GenerateManifest ¶
GenerateManifest builds the default release manifest for version: every MCP Runtime-built component, relative repositories, tag = version. When crdChange is true, crdsYAML (multi-document CustomResourceDefinition YAML) is embedded so update can apply schema changes from the release JSON alone.
func ParseManifest ¶
ParseManifest decodes (JSON or YAML) and validates a release manifest.
func (*Manifest) Component ¶
func (m *Manifest) Component(name string) (ManifestComponent, bool)
Component returns the manifest entry for name.
type ManifestComponent ¶
type ManifestComponent struct {
Name string `json:"name"`
Repository string `json:"repository"`
Tag string `json:"tag"`
Digest string `json:"digest,omitempty"`
}
ManifestComponent pins one component image.
type OptIn ¶
type OptIn string
OptIn classifies components that update only touches when explicitly selected.
type Version ¶
type Version struct {
Major, Minor, Patch int
Pre string
// contains filtered or unexported fields
}
Version is a parsed semantic version (vMAJOR.MINOR.PATCH[-PRERELEASE]).
func ParseVersion ¶
ParseVersion parses a semantic version with an optional leading "v".