image

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2021 License: Apache-2.0 Imports: 15 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

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
	// contains filtered or unexported fields
}

func NewFromIdentifier

func NewFromIdentifier(identifier string) *ContainerImage

NewFromIdentifier parses an image identifier and returns a populated ContainerImage

func (*ContainerImage) GetFullNameWithTag

func (img *ContainerImage) GetFullNameWithTag() string

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) VersionSortMode

GetParameterSort gets and validates the value for the sort 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) Original

func (img *ContainerImage) Original() string

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

func ParseMatchfunc added in v0.8.0

func ParseMatchfunc(val string) (MatchFuncFn, interface{})

ParseMatchfunc returns a matcher function and its argument from given value

type VersionConstraint added in v0.3.0

type VersionConstraint struct {
	Constraint string
	MatchFunc  MatchFuncFn
	MatchArgs  interface{}
	IgnoreList []string
	SortMode   VersionSortMode
}

VersionConstraint defines a constraint for comparing versions

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

type VersionSortMode added in v0.3.0

type VersionSortMode int

VersionSortMode defines the method to sort a list of tags

const (
	// VersionSortSemVer sorts tags using semver sorting (the default)
	VersionSortSemVer VersionSortMode = 0
	// VersionSortLatest sorts tags after their creation date
	VersionSortLatest VersionSortMode = 1
	// VersionSortName sorts tags alphabetically by name
	VersionSortName VersionSortMode = 2
)

func ParseUpdateStrategy added in v0.8.0

func ParseUpdateStrategy(val string) VersionSortMode

Jump to

Keyboard shortcuts

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