Back to godoc.org
github.com/gardener/gardener / pkg / utils / imagevector

package imagevector

v1.7.2
Latest Go to latest
Published: today | Licenses: Apache-2.0, BSD-2-Clause, MIT, MPL-2.0 | Module: github.com/gardener/gardener

Index

Package Files

Constants

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

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.

type ComponentImageVector

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

type ComponentImageVectors map[string]string

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

func ReadComponentOverwrite

func ReadComponentOverwrite(r io.Reader) (ComponentImageVectors, error)

ReadComponentOverwrite reads an ComponentImageVector from the given io.Reader.

func ReadComponentOverwriteFile

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 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
}

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
	Repository string
	Tag        *string
}

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

func (*Image) String

func (i *Image) String() string

String will returns the string representation of the image.

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"`

	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 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. 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 ReadGlobalImageVectorWithEnvOverride

func ReadGlobalImageVectorWithEnvOverride(filePath string) (ImageVector, error)

ReadGlobalImageVectorWithEnvOverride reads the global image vector and applies the env override. Exposed for testing.

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.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier