Documentation
¶
Overview ¶
Package resolve decides which package versions to install and whether a package's requirements and conflicts are satisfied.
It deliberately is not a general SAT solver. Requirements are mostly on capabilities, constraints are expected to be loose, and a distribution pins exact versions; a solver that finds clever combinations nobody tested would be a liability. The search below takes the highest acceptable version of each package, prefers providers that are already installed, and backtracks only within that order.
Index ¶
Constants ¶
const APIPrefix = "api:"
APIPrefix marks a capability that the API server can satisfy through discovery, e.g. "api:cert-manager.io/v1".
const Unversioned = "0.0.0-unversioned"
Unversioned is the version of a package that declares none.
Variables ¶
var ErrUnresolvable = errors.New("requests cannot be satisfied")
ErrUnresolvable is returned when no combination satisfies the requests. The wrapped message explains the closest attempt.
Functions ¶
Types ¶
type Change ¶
type Change struct {
Name string
From string
To string
Action Action
// Reason says why the package is in the plan: "requested" or the
// requirement that pulled it in.
Reason string
}
Change is one line of a plan.
type Plan ¶
type Plan struct {
Changes []Change
}
Plan is the outcome of resolving a set of requests.
type Release ¶
type Release struct {
Name string
Version string
Provides []string
Requires []Requirement
Conflicts []string
}
Release is one version of a package as published in a repository.
type Requirement ¶
Requirement is a dependency on a package or a capability.
func RequirementsOf ¶
func RequirementsOf(v *v1.Variant, ignore []string) []Requirement
RequirementsOf turns a variant's dependsOn and requires into requirements, minus the packages and capabilities listed in ignore.
func (Requirement) String ¶
func (r Requirement) String() string
type State ¶
type State struct {
Packages map[string]Installed
// APIs holds served group versions, e.g. "cert-manager.io/v1".
APIs map[string]bool
}
State is what the cluster has: installed packages and served APIs.
type Unmet ¶
type Unmet struct {
Requirement Requirement
Reason string
}
Unmet is a requirement that is not satisfied, with the reason.
func Check ¶
func Check(reqs []Requirement, st State) ([]Unmet, error)
Check evaluates requirements against the cluster. A requirement is met only by a Ready package, because the operator uses this to gate installation: something that exists but is not working yet does not count. Optional requirements are reported only when present but not ready.