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 ¶
const ( SourceRegistry = "registry" SourceEmbedded = "embedded" )
Source names where a schema came from.
const EmbeddedSchemaVersion = "0.6.0"
EmbeddedSchemaVersion is the agent chart version whose values.schema.json is compiled into the binary (internal/chart/embedded/).
Variables ¶
This section is empty.
Functions ¶
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 (x.x.x: every 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 Reference ¶
type Reference struct {
// Host is the registry host, e.g. gsoci.azurecr.io.
Host string
// Repository is the path within the registry, e.g. charts/giantswarm/agent.
Repository string
// Insecure selects plain HTTP (tests).
Insecure bool
}
Reference is a parsed oci:// chart URL.
func ParseReference ¶
ParseReference parses oci://<host>/<repository>.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry talks to one OCI registry.
func NewRegistry ¶
NewRegistry builds a client with sensible timeouts.
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 *Registry, log *slog.Logger) (*Resolver, error)
NewResolver builds a resolver for ociURL tracking semverRange, re-reading the registry every refresh.
func (*Resolver) 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 ¶
SemverRange is the configured range.
type Schema ¶
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.