versions

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultControlPlaneVersion is the default version of the ControlPlane to use.
	//
	// NOTE: This needs to be a full semver version (i.e. it needs to include
	// the minor and the patch version). The reason for this is that it's used in the
	// tests, e.g. https://github.com/Kong/gateway-operator/blob/02bd1e11243/test/e2e/environment_test.go#L201-L206
	// and those tests create KIC's URLs for things like roles or CRDs.
	// Since KIC only defines the full tags in its repo (as expected) we cannot use
	// a partial version here, as it would not match KIC's tag.
	DefaultControlPlaneVersion = "3.2.0" // renovate: datasource=docker depName=kong/kubernetes-ingress-controller
)

Variables

View Source
var ErrExpectedSemverVersion = errors.New(`expected "<image>:<tag>" format`)
View Source
var ManifestsVersionsForKICVersions = map[string]semver.Version{
	">=3.2":       semver.MustParse("3.2.0"),
	">=3.1, <3.2": semver.MustParse("3.1.6"),
}

ManifestsVersionsForKICVersions is a map that explicitly sets which manifests version to use upon the KIC version. It is used in /hack/generators/kic to generate the roles and webhook configuration to be used by KIC. This data follows the semver constraint syntax (see https://github.com/Masterminds/semver#basic-comparisons) to set the range of KIC versions to be associated with a specific role version.

e.g., for KIC with a version lower than "2.4", but greater or equal to "2.3", version "2.3" of the role is used.

Whenever the KIC manifests are updated and released, that change should be reflected in this map, and the generators should be run again to produce the new cluster role and webhook config files.

e.g., when in the future KIC, and that update will be included in the release 5.0, a new entry '">=5.0": "5.0"' should be added to this map, and the previous most updated entry should be limited to "<5.0".

Functions

func FromImage

func FromImage(image string) (semver.Version, error)

FromImage takes a container image in the format "<image>:<version>" and returns a semver instance of the version. It supports semver with the extension of enterprise segment, being an additional forth segment on top the standard 3 segment supported by semver. This also supports flavour suffixes which can be supplied after "-" character.

func IsControlPlaneImageVersionSupported

func IsControlPlaneImageVersionSupported(image string) (bool, error)

IsControlPlaneImageVersionSupported is a helper intended to validate the ControlPlane image and indicate if the operator can support it.

Presently only a minimum version is required, there are no limits on the maximum. This may change in the future.

The image is expected to follow the format "<image>:<tag>" and only supports a provided "<tag>" if it is a semver compatible version.

func IsDataPlaneImageVersionSupported

func IsDataPlaneImageVersionSupported(image string) (bool, error)

IsDataPlaneImageVersionSupported is a helper intended to validate the DataPlane image and indicate if the operator can support it.

Presently only a minimum version is required, there are no limits on the maximum. This may change in the future.

The image is expected to follow the format "<image>:<tag>" and only supports a provided "<tag>" if it is a semver compatible version.

Types

type VersionValidationOption

type VersionValidationOption func(version string) (bool, error)

VersionValidationOption is the function signature to be used as option to validate ControlPlane and DataPlane versions

Jump to

Keyboard shortcuts

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