imagevector

package
v1.105.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 28, 2024 License: Apache-2.0 Imports: 11 Imported by: 145

Documentation

Index

Constants

View Source
const (
	// OverrideEnv is the name of the containers image vector override environment variable.
	OverrideEnv = "IMAGEVECTOR_OVERWRITE"
	// OverrideChartsEnv is the name of the charts image vector override environment variable.
	OverrideChartsEnv = "IMAGEVECTOR_OVERWRITE_CHARTS"
	// SHA256TagPrefix is the prefix in an image tag for sha256 tags.
	SHA256TagPrefix = "sha256:"
)
View Source
const (
	// ComponentOverrideEnv is the name of the environment variable for image vector overrides of components deployed
	// by Gardener.
	ComponentOverrideEnv = "IMAGEVECTOR_OVERWRITE_COMPONENTS"
)

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.

func ImageMapToValues added in v1.17.0

func ImageMapToValues(m map[string]*Image) map[string]any

ImageMapToValues transforms the given image name to image mapping into chart Values.

func ValidateComponentImageVectors added in v1.21.0

func ValidateComponentImageVectors(componentImageVectors ComponentImageVectors, fldPath *field.Path) field.ErrorList

ValidateComponentImageVectors validates the given ComponentImageVectors.

func ValidateImageVector added in v1.21.0

func ValidateImageVector(imageVector ImageVector, fldPath *field.Path) field.ErrorList

ValidateImageVector validates the given ImageVector.

Types

type ComponentImageVector added in v1.2.0

type ComponentImageVector struct {
	Name                 string `json:"name" yaml:"name"`
	ImageVectorOverwrite string `json:"imageVectorOverwrite" yaml:"imageVectorOverwrite"`
}

ComponentImageVector contains an image vector overwrite for a component deployed by Gardener.

type ComponentImageVectors added in v1.2.0

type ComponentImageVectors map[string]string

ComponentImageVectors maps a component with a given name (key) to the image vector overwrite content (value).

func ReadComponentOverwrite added in v1.2.0

func ReadComponentOverwrite(buf []byte) (ComponentImageVectors, error)

ReadComponentOverwrite reads an ComponentImageVector from the given io.Reader.

func ReadComponentOverwriteFile added in v1.2.0

func ReadComponentOverwriteFile(name string) (ComponentImageVectors, error)

ReadComponentOverwriteFile reads an ComponentImageVector from the file with the given name.

type FindOptionFunc

type FindOptionFunc func(*FindOptions)

FindOptionFunc is a function that mutates FindOptions.

func Architecture added in v1.50.0

func Architecture(arch string) FindOptionFunc

Architecture sets the Architecture of the FindOptions to the given arch.

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

type FindOptions struct {
	RuntimeVersion *string
	TargetVersion  *string
	Architecture   *string
}

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.

func (*FindOptions) String

func (o *FindOptions) String() string

String implements Stringer.

type Image

type Image struct {
	Name       string
	Ref        *string
	Repository *string
	Tag        *string
	Version    *string
}

Image is a concrete, pullable image with a nonempty tag.

func (*Image) String

func (i *Image) String() string

String returns the string representation of the image.

func (*Image) WithOptionalTag added in v1.80.0

func (i *Image) WithOptionalTag(tag string)

WithOptionalTag will set the 'Tag' field of the 'Image' to <tag> in case it is nil and no <ref> is specified for the image. If 'Tag' is already set, nothing happens.

type ImageSource

type ImageSource struct {
	Name           string   `json:"name" yaml:"name"`
	RuntimeVersion *string  `json:"runtimeVersion,omitempty" yaml:"runtimeVersion,omitempty"`
	TargetVersion  *string  `json:"targetVersion,omitempty" yaml:"targetVersion,omitempty"`
	Architectures  []string `json:"architectures,omitempty" yaml:"architectures,omitempty"`

	// Either Ref or Repository must be provided. If Repository is used, Tag can either be a digest only
	// (e.g., `sha256:073...`), or tag+digest combined (e.g., `v1.2.3@sha256:073...`).
	Ref        *string `json:"ref,omitempty" yaml:"ref,omitempty"`
	Repository *string `json:"repository,omitempty" yaml:"repository,omitempty"`
	Tag        *string `json:"tag,omitempty" yaml:"tag,omitempty"`

	// Version is a human-readable version of the image (helpful in case the ref/tag does not specify it because only a
	// digest is used).
	Version *string `json:"version,omitempty" yaml:"version,omitempty"`
}

ImageSource contains the repository and the tag of a Docker container image. If the respective image is only valid for a specific Kubernetes runtime version, then it must also contain the 'runtimeVersion' field describing for which versions it can be used. Similarly, if it is only valid for a specific Kubernetes version to operate on, then it must also contain the 'targetVersion' field describing for which versions it can be used. Examples of these are CSI controllers that run in the seed cluster and act on the shoot cluster. Different versions might be used depending on the seed and the shoot version.

func (*ImageSource) ToImage

func (i *ImageSource) ToImage(targetVersion *string) *Image

ToImage applies the given <targetK8sVersion> to the source to produce an output image. This only works when the image is not specified via 'Ref' and when 'Tag' is not set. If the tag of an image source is empty, it will use the given <targetVersion> 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(buf []byte) (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, env string) (ImageVector, error)

WithEnvOverride checks if an environment variable with the provided key 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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL