Documentation ¶
Index ¶
Constants ¶
const OverrideEnv = "IMAGEVECTOR_OVERWRITE"
OverrideEnv is the name of the image vector override environment variable.
Variables ¶
This section is empty.
Functions ¶
func FindImages ¶
func FindImages(v ImageVector, names []string, opts ...FindOptionFunc) (map[string]*Image, error)
FindImages returns an image map with the given <names> from the sources in the image vector. The <k8sVersion> specifies the kubernetes version the image will be running on. The <targetK8sVersion> specifies the kubernetes version the image shall target. If multiple entries were found, the provided <k8sVersion> is compared with the constraints stated in the image definition. In case multiple images match the search, the first which was found is returned. In case no image was found, an error is returned.
Types ¶
type FindOptionFunc ¶
type FindOptionFunc func(*FindOptions)
FindOptionFunc is a function that mutates FindOptions.
func RuntimeVersion ¶
func RuntimeVersion(version string) FindOptionFunc
RuntimeVersion sets the RuntimeVersion of the FindOptions to the given version.
func TargetVersion ¶
func TargetVersion(version string) FindOptionFunc
TargetVersion sets the TargetVersion of the FindOptions to the given version.
type FindOptions ¶
FindOptions are options that can be supplied during either `FindImage` or `FindImages`.
func (*FindOptions) ApplyOptions ¶
func (o *FindOptions) ApplyOptions(opts []FindOptionFunc) *FindOptions
ApplyOptions applies the given FindOptionFuncs to these FindOptions. Returns a pointer to the mutated value.
type ImageSource ¶
type ImageSource struct { Name string `json:"name" yaml:"name"` RuntimeVersion *string `json:"runtimeVersion,omitempty" yaml:"runtimeVersion,omitempty"` Repository string `json:"repository" yaml:"repository"` Tag *string `json:"tag,omitempty" yaml:"tag,omitempty"` }
ImageSource contains the repository and the tag of a Docker container image. If the respective image is only valid for a specific Kubernetes version, then it must also contain the 'versions' field describing for which versions it can be used.
func (*ImageSource) ToImage ¶
func (i *ImageSource) ToImage(targetVersion *string) *Image
ToImage applies the given <targetK8sVersion> to the source to produce an output image. If the tag of an image source is empty, it will use the given <k8sVersion> as tag.
type ImageVector ¶
type ImageVector []*ImageSource
ImageVector is a list of image sources.
func Merge ¶
func Merge(vectors ...ImageVector) ImageVector
Merge merges the given ImageVectors into one.
Images of ImageVectors that are later in the given sequence with the same name override previous images.
func Read ¶
func Read(r io.Reader) (ImageVector, error)
Read reads an ImageVector from the given io.Reader.
func ReadFile ¶
func ReadFile(name string) (ImageVector, error)
ReadFile reads an ImageVector from the file with the given name.
func WithEnvOverride ¶
func WithEnvOverride(vector ImageVector) (ImageVector, error)
WithEnvOverride checks if an environment variable with the key IMAGEVECTOR_OVERWRITE is set. If yes, it reads the ImageVector at the value of the variable and merges it with the given one. Otherwise, it returns the unmodified ImageVector.
func (ImageVector) FindImage ¶
func (v ImageVector) FindImage(name string, opts ...FindOptionFunc) (*Image, error)
FindImage returns an image with the given <name> from the sources in the image vector. The <k8sVersion> specifies the kubernetes version the image will be running on. The <targetK8sVersion> specifies the kubernetes version the image shall target. If multiple entries were found, the provided <k8sVersion> is compared with the constraints stated in the image definition. In case multiple images match the search, the first which was found is returned. In case no image was found, an error is returned.