Documentation
¶
Overview ¶
Package fileoverride redirects the file downloads a distro definition declares to an internal mirror or to a directory of pre-staged assets, the way images.RegistryOverride redirects image pulls.
It differs from the registry case in one way worth knowing. A registry override matches on a raw string prefix, which is survivable for a registry reference but not for a URL: an override for "https://github.com" would otherwise also capture "https://github.com.example.invalid/...". Matching here is done on the parsed URL, and the prefix has to end on a path-segment boundary.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Match ¶
type Match struct {
// Override is the entry that matched.
Override Override
// Resolved is the effective source: a rewritten URL, or an absolute local path.
Resolved string
}
Match is a resolved override: which Override applied, and the source to actually read.
type Override ¶
type Override struct {
// Source is the URL prefix a file source is matched against, for example
// "https://rpm.rancher.io" or "https://github.com/rancher".
Source string
// Target is the replacement as it was written: either an http/https URL prefix, or a
// path to a local directory of pre-staged files.
Target string
// LocalDir is set, and absolute, when Target names a directory rather than a URL. It is
// resolved once at parse time so a rewritten source can never be taken for a relative
// path and re-resolved against the distro definition directory.
LocalDir string
}
Override redirects every file source under Source to Target.
func Parse ¶
Parse converts "source=target" pairs into a structured type. The result is sorted in descending order by Source, which puts the longest prefix first -- so an override for "https://github.com/rancher" wins over a broader "https://github.com" -- matching how cmd.ParseRegistryOverrides orders registry overrides for the same reason.
Input is of the following form: []string{"https://github.com/rancher=https://mirror.example.com/rancher", "https://rpm.rancher.io=/srv/staged"}