Documentation
¶
Overview ¶
Package deploymenttransform provides a generic, version-keyed registry for adapting canonical deployment artifact specs to the capability of a target gateway. Each registered Transformation is scoped to one artifact kind and applied only when its AppliesWhen predicate matches the target gateway version.
Generators produce the canonical (latest) artifact shape unconditionally. The registry's Transform call, invoked in the deploy orchestration layer before the artifact is marshalled and stored, rewrites the spec to whatever shape the target gateway understands.
New version-boundary conversions are registered once, in a package init(), without touching the deploy services. The deploy services call only Default().Transform(kind, target, &spec).
Index ¶
Constants ¶
const MinSplitPoliciesVersion = "1.2.0"
MinSplitPoliciesVersion is the first gateway release that understands globalPolicies/operationPolicies. Use this constant in tests and call sites instead of a raw string literal so a future version-boundary change is a one-place edit.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds registered Transformations and applies them in order.
func Default ¶
func Default() *Registry
Default returns the package-level Registry. All transformations registered via init() are available here.
func (*Registry) Register ¶
func (r *Registry) Register(t Transformation)
Register adds a Transformation to the registry. Transformations are applied in registration order, so order matters when multiple transformations target the same kind and version range.
type Transformation ¶
type Transformation struct {
// Name identifies the transformation in logs and error messages.
Name string
// Kind is the artifact kind this transformation applies to
// (e.g. constants.LLMProvider, constants.LLMProxy).
Kind string
// AppliesWhen returns true when this transformation must be applied for
// the given target gateway version.
AppliesWhen func(target Version) bool
// Apply mutates the payload (a *dto.*DeploymentSpec) in place.
Apply func(payload any) error
}
Transformation adapts a canonical deployment spec so a target gateway version can consume it. Scoped to one artifact kind; applied only when AppliesWhen returns true for the target Version.
type Version ¶
type Version struct {
Major, Minor, Patch int
}
Version is a parsed, comparable gateway semver. Empty or unparseable version strings are treated as 1.0.0 — the implicit version for gateways that predate version reporting.
func ParseVersion ¶
ParseVersion parses a gateway version string into a Version. Pre-release suffixes (e.g. "-SNAPSHOT", "-RC1") and a leading "v" are stripped before parsing. An empty or unparseable string returns Version{1, 0, 0}.