chart

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package chart knows the agent chart: where it lives, which version a Flux OCIRepository tracking the configured semver range resolves to right now, and the values.schema.json of that version — the contract every agent's values are validated against before anything is applied. The registry is the source of truth; an embedded copy of the schema (the chart version the service was built against) is the fallback when the registry cannot be reached, and the API says which one is in use.

Index

Constants

View Source
const (
	SourceRegistry = "registry"
	SourceEmbedded = "embedded"
)

Source names where a schema came from.

View Source
const EmbeddedSchemaVersion = "1.0.0"

EmbeddedSchemaVersion is the agent chart version whose values.schema.json is compiled into the binary (internal/chart/embedded/): the Generic chart 1.x values contract — one release renders a kagent.dev/v1alpha3 AgentTemplate plus the agent's muster RemoteMCPServer; skills are a list of commit- or digest-pinned sources (bundled $defs/skill.schema.json); `agent.harness`, `muster.url`, `muster.tools`, `muster.discovery`; none of the 0.x runtime keys. The copy is the chart's own values.schema.json at the commit that made the contract final (giantswarm/agent, chart-1-0-agenttemplate @ 82815864).

Variables

This section is empty.

Functions

func Latest

func Latest(tags []string, constraint string) (string, error)

Latest picks the highest stable version among tags that satisfies the constraint, the way Flux's OCIRepository ref.semver does (Masterminds semver; pre-releases are excluded unless the range names one — `1.x` never matches a `1.0.0-dev.…` branch build).

Types

type Info

type Info struct {
	// OCIURL is the chart's OCI URL as the OCIRepository carries it.
	OCIURL string `json:"ociUrl"`
	// Semver is the range the OCIRepository tracks (1.x: every 1.x release).
	Semver string `json:"semver"`
	// LatestVersion is the newest published version inside that range, or ""
	// when the registry could not be read.
	LatestVersion string `json:"latestVersion,omitempty"`
	// SchemaVersion is the chart version whose values.schema.json validates
	// agent values right now.
	SchemaVersion string `json:"schemaVersion"`
	// SchemaSource is registry or embedded.
	SchemaSource string `json:"schemaSource"`
	// ResolvedAt is when the registry was last read successfully.
	ResolvedAt *time.Time `json:"resolvedAt,omitempty"`
	// Error is the last registry error, when the embedded fallback is in use.
	Error string `json:"error,omitempty"`
}

Info is what GET /info reports about the chart.

type Resolver

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

Resolver reads the chart from the registry and caches the result.

func NewResolver

func NewResolver(ociURL, semverRange string, refresh time.Duration, registry *oci.Registry, log *slog.Logger) (*Resolver, error)

NewResolver builds a resolver for ociURL tracking semverRange, re-reading the registry every refresh.

func (*Resolver) Info

func (r *Resolver) Info(ctx context.Context) Info

Info reports the resolution state without forcing a registry read.

func (*Resolver) Name

func (r *Resolver) Name() string

Name is the chart name (the OCIRepository is named after it).

func (*Resolver) OCIURL

func (r *Resolver) OCIURL() string

OCIURL is the configured chart URL.

func (*Resolver) Schema

func (r *Resolver) Schema(ctx context.Context) Schema

Schema returns the current schema: the registry's for the latest version in range when it can be read (cached for the refresh period), else the embedded copy. It never fails: validation must work offline.

func (*Resolver) SemverRange

func (r *Resolver) SemverRange() string

SemverRange is the configured range.

type Schema

type Schema struct {
	Document any
	Version  string
	Source   string
}

Schema is a parsed values.schema.json with its provenance.

func EmbeddedSchema

func EmbeddedSchema() Schema

EmbeddedSchema is the compiled-in values.schema.json of the agent chart at EmbeddedSchemaVersion — the offline fallback, and what tests validate with.

Jump to

Keyboard shortcuts

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