Documentation ¶
Index ¶
- Constants
- func GetRelease(ctx context.Context, k8sClient client.Client, instanceNamespace string) (*v1beta1.Release, error)
- func SemVerPatchesOnly(ignoreBuild bool) func(results VersionLister, currentTag string) (string, error)
- type ImagePatcher
- type Payload
- type RegistryResult
- type Result
- type ValuePath
- type VersionComparisonStrategy
- type VersionLister
Constants ¶
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 ¶
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
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 ¶
NewValuePath returns a new ValuePath
func (*ValuePath) AsSlice ¶
AsSlice will return the path as a slice for the useage in with the unstructured module
func (*ValuePath) GetJSONPatchPath ¶
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.