...

Package releaseutil

import "helm.sh/helm/v3/pkg/releaseutil"
Overview
Index

Overview ▾

func Reverse

func Reverse(list []*rspb.Release, sortFn func([]*rspb.Release))

Reverse reverses the list of releases sorted by the sort func.

func SortByDate

func SortByDate(list []*rspb.Release)

SortByDate returns the list of releases sorted by a release's last deployed time (in seconds).

func SortByName

func SortByName(list []*rspb.Release)

SortByName returns the list of releases sorted in lexicographical order.

func SortByRevision

func SortByRevision(list []*rspb.Release)

SortByRevision returns the list of releases sorted by a release's revision number (release.Version).

func SplitManifests

func SplitManifests(bigFile string) map[string]string

SplitManifests takes a string of manifest and returns a map contains individual manifests

type ByDate

ByDate sorts releases by date

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

func (ByDate) Len

func (s ByDate) Len() int

func (ByDate) Less

func (s ByDate) Less(i, j int) bool

Less compares to releases

func (ByDate) Swap

func (s ByDate) Swap(i, j int)

type ByName

ByName sorts releases by name

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

func (ByName) Len

func (s ByName) Len() int

func (ByName) Less

func (s ByName) Less(i, j int) bool

Less compares to releases

func (ByName) Swap

func (s ByName) Swap(i, j int)

type ByRevision

ByRevision sorts releases by revision number

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

func (ByRevision) Len

func (s ByRevision) Len() int

func (ByRevision) Less

func (s ByRevision) Less(i, j int) bool

Less compares to releases

func (ByRevision) Swap

func (s ByRevision) Swap(i, j int)

type BySplitManifestsOrder

BySplitManifestsOrder sorts by in-file manifest order, as provided in function `SplitManifests`

type BySplitManifestsOrder []string

func (BySplitManifestsOrder) Len

func (a BySplitManifestsOrder) Len() int

func (BySplitManifestsOrder) Less

func (a BySplitManifestsOrder) Less(i, j int) bool

func (BySplitManifestsOrder) Swap

func (a BySplitManifestsOrder) Swap(i, j int)

type FilterFunc

FilterFunc returns true if the release object satisfies the predicate of the underlying filter func.

type FilterFunc func(*rspb.Release) bool

func All

func All(filters ...FilterFunc) FilterFunc

All returns a FilterFunc that filters a list of releases determined by the predicate 'f0 && f1 && ... && fn'.

func Any

func Any(filters ...FilterFunc) FilterFunc

Any returns a FilterFunc that filters a list of releases determined by the predicate 'f0 || f1 || ... || fn'.

func StatusFilter

func StatusFilter(status rspb.Status) FilterFunc

StatusFilter filters a set of releases by status code.

func (FilterFunc) Check

func (fn FilterFunc) Check(rls *rspb.Release) bool

Check applies the FilterFunc to the release object.

func (FilterFunc) Filter

func (fn FilterFunc) Filter(rels []*rspb.Release) (rets []*rspb.Release)

Filter applies the filter(s) to the list of provided releases returning the list that satisfies the filtering predicate.

type KindSortOrder

KindSortOrder is an ordering of Kinds.

type KindSortOrder []string

InstallOrder is the order in which manifests should be installed (by Kind).

Those occurring earlier in the list get installed before those occurring later in the list.

var InstallOrder KindSortOrder = []string{
    "PriorityClass",
    "Namespace",
    "NetworkPolicy",
    "ResourceQuota",
    "LimitRange",
    "PodSecurityPolicy",
    "PodDisruptionBudget",
    "ServiceAccount",
    "Secret",
    "SecretList",
    "ConfigMap",
    "StorageClass",
    "PersistentVolume",
    "PersistentVolumeClaim",
    "CustomResourceDefinition",
    "ClusterRole",
    "ClusterRoleList",
    "ClusterRoleBinding",
    "ClusterRoleBindingList",
    "Role",
    "RoleList",
    "RoleBinding",
    "RoleBindingList",
    "Service",
    "DaemonSet",
    "Pod",
    "ReplicationController",
    "ReplicaSet",
    "Deployment",
    "HorizontalPodAutoscaler",
    "StatefulSet",
    "Job",
    "CronJob",
    "IngressClass",
    "Ingress",
    "APIService",
}

UninstallOrder is the order in which manifests should be uninstalled (by Kind).

Those occurring earlier in the list get uninstalled before those occurring later in the list.

var UninstallOrder KindSortOrder = []string{
    "APIService",
    "Ingress",
    "IngressClass",
    "Service",
    "CronJob",
    "Job",
    "StatefulSet",
    "HorizontalPodAutoscaler",
    "Deployment",
    "ReplicaSet",
    "ReplicationController",
    "Pod",
    "DaemonSet",
    "RoleBindingList",
    "RoleBinding",
    "RoleList",
    "Role",
    "ClusterRoleBindingList",
    "ClusterRoleBinding",
    "ClusterRoleList",
    "ClusterRole",
    "CustomResourceDefinition",
    "PersistentVolumeClaim",
    "PersistentVolume",
    "StorageClass",
    "ConfigMap",
    "SecretList",
    "Secret",
    "ServiceAccount",
    "PodDisruptionBudget",
    "PodSecurityPolicy",
    "LimitRange",
    "ResourceQuota",
    "NetworkPolicy",
    "Namespace",
    "PriorityClass",
}

type Manifest

Manifest represents a manifest file, which has a name and some content.

type Manifest struct {
    Name    string
    Content string
    Head    *SimpleHead
}

func SortManifests

func SortManifests(files map[string]string, apis chartutil.VersionSet, ordering KindSortOrder) ([]*release.Hook, []Manifest, error)

SortManifests takes a map of filename/YAML contents, splits the file by manifest entries, and sorts the entries into hook types.

The resulting hooks struct will be populated with all of the generated hooks. Any file that does not declare one of the hook types will be placed in the 'generic' bucket.

Files that do not parse into the expected format are simply placed into a map and returned.

type SimpleHead

SimpleHead defines what the structure of the head of a manifest file

type SimpleHead struct {
    Version  string `json:"apiVersion"`
    Kind     string `json:"kind,omitempty"`
    Metadata *struct {
        Name        string            `json:"name"`
        Annotations map[string]string `json:"annotations"`
    } `json:"metadata,omitempty"`
}