image

package
v0.12.2 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2023 License: Apache-2.0 Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MatchFuncAny added in v0.4.0

func MatchFuncAny(tagName string, args interface{}) bool

MatchFuncAny matches any pattern, i.e. always returns true

func MatchFuncNone added in v0.4.0

func MatchFuncNone(tagName string, args interface{}) bool

MatchFuncNone matches no pattern, i.e. always returns false

func MatchFuncRegexp added in v0.4.0

func MatchFuncRegexp(tagName string, args interface{}) bool

MatchFuncRegexp matches the tagName against regexp pattern and returns the result

func ParsePlatform added in v0.12.0

func ParsePlatform(platformID string) (string, string, string, error)

Types

type ConstraintMatchMode added in v0.3.0

type ConstraintMatchMode int

ConstraintMatchMode defines how the constraint should be matched

const (
	// ConstraintMatchSemVer uses semver to match a constraint
	ConstraintMatchSemver ConstraintMatchMode = 0
	// ConstraintMatchRegExp uses regexp to match a constraint
	ConstraintMatchRegExp ConstraintMatchMode = 1
	// ConstraintMatchNone does not enforce a constraint
	ConstraintMatchNone ConstraintMatchMode = 2
)

type ContainerImage

type ContainerImage struct {
	RegistryURL           string
	ImageName             string
	ImageTag              *tag.ImageTag
	ImageAlias            string
	HelmParamImageName    string
	HelmParamImageVersion string
	KustomizeImage        *ContainerImage
	// contains filtered or unexported fields
}

func NewFromIdentifier

func NewFromIdentifier(identifier string) *ContainerImage

NewFromIdentifier parses an image identifier and returns a populated ContainerImage

func (*ContainerImage) DiffersFrom added in v0.10.2

func (img *ContainerImage) DiffersFrom(other *ContainerImage, checkVersion bool) bool

func (*ContainerImage) GetFullNameWithTag

func (img *ContainerImage) GetFullNameWithTag() string

GetFullNameWithTag returns the complete image slug, including the registry and any tag digest or tag name set for the image.

func (*ContainerImage) GetFullNameWithoutTag

func (img *ContainerImage) GetFullNameWithoutTag() string

func (*ContainerImage) GetNewestVersionFromTags

func (img *ContainerImage) GetNewestVersionFromTags(vc *VersionConstraint, tagList *tag.ImageTagList) (*tag.ImageTag, error)

GetNewestVersionFromTags returns the latest available version from a list of tags while optionally taking a semver constraint into account. Returns the original version if no new version could be found from the list of tags.

func (*ContainerImage) GetParameterHelmImageName added in v0.3.0

func (img *ContainerImage) GetParameterHelmImageName(annotations map[string]string) string

GetParameterHelmImageName gets the value for image-name option for the image from a set of annotations

func (*ContainerImage) GetParameterHelmImageSpec added in v0.3.0

func (img *ContainerImage) GetParameterHelmImageSpec(annotations map[string]string) string

GetParameterHelmImageSpec gets the value for image-spec option for the image from a set of annotations

func (*ContainerImage) GetParameterHelmImageTag added in v0.3.0

func (img *ContainerImage) GetParameterHelmImageTag(annotations map[string]string) string

GetParameterHelmImageTag gets the value for image-tag option for the image from a set of annotations

func (*ContainerImage) GetParameterIgnoreTags added in v0.7.0

func (img *ContainerImage) GetParameterIgnoreTags(annotations map[string]string) []string

GetParameterIgnoreTags retrieves a list of tags to ignore from a comma-separated string

func (*ContainerImage) GetParameterKustomizeImageName added in v0.3.0

func (img *ContainerImage) GetParameterKustomizeImageName(annotations map[string]string) string

GetParameterKustomizeImageName gets the value for image-spec option for the image from a set of annotations

func (*ContainerImage) GetParameterMatch added in v0.4.0

func (img *ContainerImage) GetParameterMatch(annotations map[string]string) (MatchFuncFn, interface{})

GetParameterMatch returns the match function and pattern to use for matching tag names. If an invalid option is found, it returns MatchFuncNone as the default, to prevent accidental matches.

func (*ContainerImage) GetParameterPullSecret added in v0.4.0

func (img *ContainerImage) GetParameterPullSecret(annotations map[string]string) *CredentialSource

GetParameterPullSecret retrieves an image's pull secret credentials

func (*ContainerImage) GetParameterUpdateStrategy added in v0.3.0

func (img *ContainerImage) GetParameterUpdateStrategy(annotations map[string]string) UpdateStrategy

GetParameterSort gets and validates the value for the sort option for the image from a set of annotations

func (*ContainerImage) GetPlatformOptions added in v0.12.0

func (img *ContainerImage) GetPlatformOptions(annotations map[string]string, unrestricted bool) *options.ManifestOptions

GetPlatformOptions sets up platform constraints for an image. If no platform is specified in the annotations, we restrict the platform for images to the platform we're executed on unless unrestricted is set to true, in which case we do not setup a platform restriction if no platform annotation is found.

func (*ContainerImage) GetTagWithDigest added in v0.12.0

func (img *ContainerImage) GetTagWithDigest() string

GetTagWithDigest returns tag name along with any tag digest set for the image

func (*ContainerImage) HasForceUpdateOptionAnnotation added in v0.10.2

func (img *ContainerImage) HasForceUpdateOptionAnnotation(annotations map[string]string) bool

HasForceUpdateOptionAnnotation gets the value for force-update option for the image from a set of annotations

func (*ContainerImage) IsUpdatable

func (img *ContainerImage) IsUpdatable(newTag, tagSpec string) bool

IsUpdatable checks whether the given image can be updated with newTag while taking tagSpec into account. tagSpec must be given as a semver compatible version spec, i.e. ^1.0 or ~2.1

func (*ContainerImage) LogContext added in v0.12.0

func (img *ContainerImage) LogContext() *log.LogContext

LogContext returns a log context for the given image, with required fields set to the image's information.

func (*ContainerImage) Original

func (img *ContainerImage) Original() string

func (*ContainerImage) ParseMatchfunc added in v0.12.0

func (img *ContainerImage) ParseMatchfunc(val string) (MatchFuncFn, interface{})

ParseMatchfunc returns a matcher function and its argument from given value

func (*ContainerImage) ParseUpdateStrategy added in v0.12.0

func (img *ContainerImage) ParseUpdateStrategy(val string) UpdateStrategy

func (*ContainerImage) String

func (img *ContainerImage) String() string

String returns the string representation of given ContainerImage

func (*ContainerImage) WithTag

func (img *ContainerImage) WithTag(newTag *tag.ImageTag) *ContainerImage

WithTag returns a copy of img with new tag information set

type ContainerImageList

type ContainerImageList []*ContainerImage

func (*ContainerImageList) ContainsImage

func (list *ContainerImageList) ContainsImage(img *ContainerImage, checkVersion bool) *ContainerImage

ContainsImage checks whether img is contained in a list of images

func (*ContainerImageList) Originals added in v0.10.2

func (list *ContainerImageList) Originals() []string

func (*ContainerImageList) String

func (list *ContainerImageList) String() string

String Returns the name of all images as a string, separated using comma

type Credential

type Credential struct {
	Username string
	Password string
}

type CredentialSource

type CredentialSource struct {
	Type            CredentialSourceType
	Registry        string
	SecretNamespace string
	SecretName      string
	SecretField     string
	EnvName         string
	ScriptPath      string
}

func ParseCredentialSource

func ParseCredentialSource(credentialSource string, requirePrefix bool) (*CredentialSource, error)

func (*CredentialSource) FetchCredentials

func (src *CredentialSource) FetchCredentials(registryURL string, kubeclient *kube.KubernetesClient) (*Credential, error)

FetchCredentials fetches the credentials for a given registry according to the credential source.

type CredentialSourceType

type CredentialSourceType int
const (
	CredentialSourceUnknown    CredentialSourceType = 0
	CredentialSourcePullSecret CredentialSourceType = 1
	CredentialSourceSecret     CredentialSourceType = 2
	CredentialSourceEnv        CredentialSourceType = 3
	CredentialSourceExt        CredentialSourceType = 4
)

type KustomizeImage

type KustomizeImage string

func (KustomizeImage) Match

func (i KustomizeImage) Match(j KustomizeImage) bool

if the image name matches (i.e. up to the first delimiter)

type KustomizeImages

type KustomizeImages []KustomizeImage

func (KustomizeImages) Find

func (images KustomizeImages) Find(image KustomizeImage) int

find the image or -1

type MatchFuncFn added in v0.4.0

type MatchFuncFn func(tagName string, pattern interface{}) bool

type UpdateStrategy added in v0.12.0

type UpdateStrategy int

VersionSortMode defines the method to sort a list of tags

const (
	// VersionSortSemVer sorts tags using semver sorting (the default)
	StrategySemVer UpdateStrategy = 0
	// VersionSortLatest sorts tags after their creation date
	StrategyLatest UpdateStrategy = 1
	// VersionSortName sorts tags alphabetically by name
	StrategyName UpdateStrategy = 2
	// VersionSortDigest uses latest digest of an image
	StrategyDigest UpdateStrategy = 3
)

func (UpdateStrategy) IsCacheable added in v0.12.0

func (s UpdateStrategy) IsCacheable() bool

IsCacheable returns true if we can safely cache tags for strategy s

func (UpdateStrategy) NeedsMetadata added in v0.12.0

func (s UpdateStrategy) NeedsMetadata() bool

NeedsMetadata returns true if strategy s requires image metadata to work correctly

func (UpdateStrategy) NeedsVersionConstraint added in v0.12.0

func (s UpdateStrategy) NeedsVersionConstraint() bool

NeedsVersionConstraint returns true if strategy s requires a version constraint to be defined

func (UpdateStrategy) String added in v0.12.0

func (us UpdateStrategy) String() string

func (UpdateStrategy) WantsOnlyConstraintTag added in v0.12.0

func (s UpdateStrategy) WantsOnlyConstraintTag() bool

WantsOnlyConstraintTag returns true if strategy s only wants to inspect the tag specified by the constraint

type VersionConstraint added in v0.3.0

type VersionConstraint struct {
	Constraint string
	MatchFunc  MatchFuncFn
	MatchArgs  interface{}
	IgnoreList []string
	Strategy   UpdateStrategy
	Options    *options.ManifestOptions
}

VersionConstraint defines a constraint for comparing versions

func NewVersionConstraint added in v0.12.0

func NewVersionConstraint() *VersionConstraint

func (*VersionConstraint) IsTagIgnored added in v0.7.0

func (vc *VersionConstraint) IsTagIgnored(tag string) bool

IsTagIgnored matches tag against the patterns in IgnoreList and returns true if one of them matches

func (*VersionConstraint) String added in v0.3.0

func (vc *VersionConstraint) String() string

String returns the string representation of VersionConstraint

Jump to

Keyboard shortcuts

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