version

package
v1.3.3-0...-f31c912 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureSemver

func EnsureSemver(current string) (string, error)

EnsureSemver adds the 'v' prefix if needed and ensures the provided version is semver-compliant.

func ValidVersionChange

func ValidVersionChange(ctx context.Context, current, next string) bool

ValidVersionChange receives the current version and the candidate next version and evaluates if the version transition is valid.

Types

type BasicHTTPVersionGetter

type BasicHTTPVersionGetter struct {
	// contains filtered or unexported fields
}

BasicHTTPVersionGetter gets the version from an HTTP response containing only the version. This is used typically to get version from a file hosted in a s3 bucket or raw file served over HTTP. BasicHTTPVersionGetter uses basicHTTPVersionClient and wraps it in a cache in order to mitigate the impact of too frequent reconciliations. The structure implements the version.Getter interface.

func (BasicHTTPVersionGetter) GetVersion

func (g BasicHTTPVersionGetter) GetVersion(ctx context.Context) (string, error)

type Getter

type Getter interface {
	GetVersion(context.Context) (string, error)
}

Getter gets the target image version for an external source. It should cache the result to reduce io and avoid potential rate-limits and is safe to call multiple times over a short period. If the version source intentionally returns no version, a NoNewVersionError is returned.

func NewBasicHTTPVersionGetter

func NewBasicHTTPVersionGetter(baseURL *url.URL) Getter

func NewStaticGetter

func NewStaticGetter(version string, err error) Getter

NewStaticGetter creates a StaticGetter

type NoNewVersionError

type NoNewVersionError struct {
	Message        string `json:"message"`
	CurrentVersion string `json:"currentVersion"`
	NextVersion    string `json:"nextVersion"`
}

NoNewVersionError indicates that no new version was found and the controller did not reconcile.

func (*NoNewVersionError) Error

func (e *NoNewVersionError) Error() string

Error returns log friendly description of an error

type StaticGetter

type StaticGetter struct {
	// contains filtered or unexported fields
}

StaticGetter is a fake version.Getter that return a static answer. This is used for testing purposes.

func (StaticGetter) GetVersion

func (v StaticGetter) GetVersion(_ context.Context) (string, error)

GetVersion returns the statically defined version.

Jump to

Keyboard shortcuts

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