helm

package
v4.83.1 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ImageContentType name of the image type in the docker registry API
	ImageContentType = "image"
	// ActiveTagStatus indicates that the image is active
	ActiveTagStatus = "active"
)

Variables

This section is empty.

Functions

func GetRelease

func GetRelease(ctx context.Context, k8sClient client.Client, instanceNamespace string) (*v1beta1.Release, error)

GetRelease will get the first release it finds in the given instanceNamespace

func SemVerPatchesOnly

func SemVerPatchesOnly(ignoreBuild bool) func(results VersionLister, currentTag string) (string, error)

SemVerPatchesOnly is a VersionComparisonStrategy that will determine if the latest version as long as it adheres to semver It will only update the patch part of the version, it will not consider the Major or Minor version. It's able to either ignore the build information appended to the semver version, or not.

Types

type ImagePatcher

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

ImagePatcher is a generic maintenance runner for helm based services It can handle semver images as well as images that don't adhere to semver.

func NewImagePatcher

func NewImagePatcher(c client.Client, hc *http.Client, l logr.Logger) ImagePatcher

NewImagePatcher returns a new ImagePatcher It will patch the image tag of any given helm release.

func (*ImagePatcher) DoMaintenance

func (h *ImagePatcher) DoMaintenance(ctx context.Context, tagURL string, tagPath ValuePath, versionComp VersionComparisonStrategy) error

DoMaintenance will run a helm semver maintenance script. tagURL should be the url of the docker repository where the image resides. It has to be publicly available. The expected format of the url is `https://hub.docker.com/v2/repositories/myorg/myservice/tags/?page_size=100` tagPath should be the specific path in the helm values where the tag is specified. It must not be nil and needs to be initialized at least with an empty string. versionComp contains the function to compare if a given list of versions actually contains a valid new version or not.

type Payload

type Payload struct {
	Results []Result `json:"results,omitempty"`
}

Payload contains the response body of a docker image tags

func (*Payload) GetVersions added in v4.57.0

func (p *Payload) GetVersions() []string

GetVersions returns all found image tags from the payload

type RegistryResult added in v4.57.0

type RegistryResult struct {
	Name string   `json:"name,omitempty"`
	Tags []string `json:"tags,omitempty"`
}

RegistryResult contains the result for querying a v2 docker registry

func (RegistryResult) GetVersions added in v4.57.0

func (v RegistryResult) GetVersions() []string

GetVersions returns the underlying list of versions

type Result

type Result struct {
	// Name is the tag
	Name string `json:"name,omitempty"`
	// TagStatus indicates if the tag is active
	TagStatus string `json:"tag_status,omitempty"`
	// ContentType indicates whether this Result is an image
	ContentType string `json:"content_type,omitempty"`
}

Result is the object that has details of a docker image tag

type ValuePath

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

ValuePath describes a generic path within a release's values. It can generate various different representations of the fields, depending on the use case.

func NewValuePath

func NewValuePath(path ...string) ValuePath

NewValuePath returns a new ValuePath

func (*ValuePath) AsSlice

func (h *ValuePath) AsSlice() []string

AsSlice will return the path as a slice for the useage in with the unstructured module

func (*ValuePath) GetJSONPatchPath

func (h *ValuePath) GetJSONPatchPath() string

GetJSONPatchPath returns the representation of the path as used in for patching the release

type VersionComparisonStrategy

type VersionComparisonStrategy func(VersionLister, string) (string, error)

VersionComparisonStrategy is a function that actually determines if a given release needs to be updated The returned string should contain the latest version, or the same version, if there's no latest.

type VersionLister added in v4.57.0

type VersionLister interface {
	GetVersions() []string
}

VersionLister provides a list of viable versions to compare against.

Jump to

Keyboard shortcuts

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