helm

package
v0.0.0-...-1709b1e Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindBestArtifactHubMatch

func FindBestArtifactHubMatch(clusterRelease *release.Release, ahubPackages []ArtifactHubHelmPackage) *output.ReleaseOutput

FindBestArtifactHubMatch takes the helm releases found in the cluster and attempts to match those to a package in artifacthub

func IsValidRelease

func IsValidRelease(version string) bool

IsValidRelease returns a bool indicating whether a version string is valid or not.

Types

type ArtifactHubCachedPackage

type ArtifactHubCachedPackage struct {
	Name          string                         `json:"name"`
	Description   string                         `json:"description"`
	HomeURL       string                         `json:"home"`
	Repository    ArtifactHubCachedRepository    `json:"repository"`
	Official      bool                           `json:"official"`
	LatestVersion string                         `json:"latest_version"`
	Versions      []ArtifactHubCachedVersionInfo `json:"versions"`
	Links         []Link                         `json:"links"`
	Maintainers   []Maintainer                   `json:"maintainers"`
	Deprecated    bool                           `json:"deprecated"`
}

ArtifactHubCachedPackage represents a single entry in the API output. It's a single chart registered in AH

type ArtifactHubCachedPackageClient

type ArtifactHubCachedPackageClient struct {
	APIRoot   string
	URL       *url.URL
	Client    *http.Client
	UserAgent string
}

ArtifactHubCachedPackageClient provides the various pieces to interact with the ArtifactHubCached API.

func NewArtifactHubCachedPackageClient

func NewArtifactHubCachedPackageClient(version string) (*ArtifactHubCachedPackageClient, error)

NewArtifactHubCachedPackageClient returns a new client for the unauthenticated paths of the ArtifactHubCached API.

func (*ArtifactHubCachedPackageClient) List

List returns all packages from ArtifactHub

type ArtifactHubCachedPackagesList

type ArtifactHubCachedPackagesList []ArtifactHubCachedPackage

ArtifactHubCachedPackagesList contains the output from the AH cached API

type ArtifactHubCachedRepository

type ArtifactHubCachedRepository struct {
	Name     string `json:"name"`
	URL      string `json:"url"`
	Official bool   `json:"official"`
	Verified bool   `json:"verified"`
}

ArtifactHubCachedRepository is a sub-struct of the Package struct, and represents the repository containing the package.

type ArtifactHubCachedVersionInfo

type ArtifactHubCachedVersionInfo struct {
	Version     string `json:"pkg"`
	AppVersion  string `json:"app"`
	KubeVersion string `json:"kube"`
	Deprecated  bool   `json:"deprecated"`
}

ArtifactHubCachedVersionInfo represents the chart and application version of a package

type ArtifactHubHelmPackage

type ArtifactHubHelmPackage struct {
	Name              string                `json:"name"`
	DisplayName       string                `json:"display_name"`
	Description       string                `json:"description"`
	AppVersion        string                `json:"app_version"`
	KubeVersion       string                `json:"kube_version"`
	Official          bool                  `json:"official"`
	Deprecated        bool                  `json:"deprecated"`
	Repository        ArtifactHubRepository `json:"repository"`
	Version           string                `json:"version"`
	HomeURL           string                `json:"home_url"`
	AvailableVersions []AvailableVersion    `json:"available_versions"`
	Maintainers       []Maintainer          `json:"maintainers"`
	Links             []Link                `json:"links"`
}

ArtifactHubHelmPackage represents a helm package (chart) as provided by the ArtifactHub API.

type ArtifactHubPackageClient

type ArtifactHubPackageClient struct {
	APIRoot   string
	URL       *url.URL
	Client    *http.Client
	UserAgent string
}

ArtifactHubPackageClient provides the various pieces to interact with the ArtifactHub API.

func NewArtifactHubPackageClient

func NewArtifactHubPackageClient(version string) (*ArtifactHubPackageClient, error)

NewArtifactHubPackageClient returns a new client for the unauthenticated paths of the ArtifactHub API.

func (*ArtifactHubPackageClient) GetPackages

GetPackages makes use of the helm package details API: https://artifacthub.io/docs/api/#/Packages/getHelmPackageDetails It sets up the proper query parameters and adds the repo/package name to the path.

func (*ArtifactHubPackageClient) MultiSearch

func (ac *ArtifactHubPackageClient) MultiSearch(searchTerms []string) ([]ArtifactHubPackageRepo, error)

MultiSearch will find all packages that match various search terms (terms are not combined, but searched individually). Returns only the package name and repository information.

func (*ArtifactHubPackageClient) Search

func (ac *ArtifactHubPackageClient) Search(searchTerm string, offset int) (ret ArtifactHubPackagesSearchReturn)

Search makes use of the package search API: https://artifacthub.io/docs/api/#/Packages/searchPackages It sets up the proper query parameters and adds the search tearm to the ts_query_web parameter.

func (*ArtifactHubPackageClient) SearchFirst

SearchFirst will find the first set (page) of packages that match a search term.

func (*ArtifactHubPackageClient) SearchForPackageRepo

func (ac *ArtifactHubPackageClient) SearchForPackageRepo(searchTerm string) ([]ArtifactHubPackageRepo, error)

SearchForPackageRepo calls SearchPackages with a given searchTerm, and then filters the results to only return the package name and repository info.

func (*ArtifactHubPackageClient) SearchPackages

func (ac *ArtifactHubPackageClient) SearchPackages(searchTerm string) ([]ArtifactHubPackageSearch, error)

SearchPackages searches for packages given a search term against the ArtifactHub API.

type ArtifactHubPackageRepo

type ArtifactHubPackageRepo struct {
	PackageName string
	RepoName    string
}

ArtifactHubPackageRepo is a simple struct to show a relationship between a helm package name and its repository.

type ArtifactHubPackageReturn

type ArtifactHubPackageReturn struct {
	Package ArtifactHubHelmPackage
	// contains filtered or unexported fields
}

ArtifactHubPackageReturn is the return type for a specific package.

type ArtifactHubPackageSearch

type ArtifactHubPackageSearch struct {
	PackageID                      string                           `json:"package_id"`
	Name                           string                           `json:"name"`
	NormalizedName                 string                           `json:"normalized_name"`
	LogoImageID                    string                           `json:"logo_image_id"`
	Stars                          int                              `json:"stars"`
	Description                    string                           `json:"description"`
	Version                        string                           `json:"version"`
	AppVersion                     string                           `json:"app_version"`
	Deprecated                     bool                             `json:"deprecated"`
	Signed                         bool                             `json:"signed"`
	SecurityReportSummary          ArtifactHubSecurityReportSummary `json:"security_report_summary"`
	AllContainersImagesWhitelisted bool                             `json:"all_containers_images_whitelisted"`
	ProductionOrganizationsCount   int                              `json:"production_organizations_count"`
	Ts                             int                              `json:"ts"`
	Repository                     ArtifactHubRepository            `json:"repository"`
}

ArtifactHubPackageSearch represents a single search return object from the ArtifactHub `packages/search` API.

type ArtifactHubPackagesSearchReturn

type ArtifactHubPackagesSearchReturn struct {
	Packages []ArtifactHubPackageSearch `json:"packages,omitempty"`
	// contains filtered or unexported fields
}

ArtifactHubPackagesSearchReturn is the return type for SearchPackages.

type ArtifactHubRepository

type ArtifactHubRepository struct {
	URL               string `json:"url"`
	Name              string `json:"name"`
	VerifiedPublisher bool   `json:"verified_publisher"`
	Official          bool   `json:"official"`
}

ArtifactHubRepository is a child struct of ArtifactHubPackageSearch represents a helm chart repository as provided by the ArtifactHub API.

type ArtifactHubSecurityReportSummary

type ArtifactHubSecurityReportSummary struct {
	Low      int `json:"low"`
	High     int `json:"high"`
	Medium   int `json:"medium"`
	Unknown  int `json:"unknown"`
	Critical int `json:"critical"`
}

ArtifactHubSecurityReportSummary is a child struct of ArtifactHubPackageSearch and contains the security report summary for a given package.

type AvailableVersion

type AvailableVersion struct {
	Version string `json:"version"`
}

AvailableVersion is a sub struct of ArtifactHubHelmPackage and provides a version that is available for a given helm chart.

type ChartRelease

type ChartRelease struct {
	APIVersion  string             `yaml:"apiVersion,omitempty"`
	AppVersion  string             `yaml:"appVersion"`
	KubeVersion string             `yaml:"kubeVersion"`
	Created     time.Time          `yaml:"created"`
	Description string             `yaml:"description"`
	Digest      string             `yaml:"digest,omitempty"`
	Maintainers []chart.Maintainer `yaml:"maintainers,omitempty"`
	Name        string             `yaml:"name"`
	Urls        []string           `yaml:"urls"`
	Version     string             `yaml:"version"`
	Home        string             `json:"home"`
	Sources     []string           `json:"sources"`
	Keywords    []string           `json:"keywords"`
	Icon        string             `json:"icon"`
	Deprecated  bool               `json:"deprecated"`
}

ChartRelease is a single chart version in a helm repository

func GetChartInfo

func GetChartInfo(name string, version string, repos []*Repo) *ChartRelease

GetChartInfo returns info about a chart with the version specified

func GetNewestReleaseByName

func GetNewestReleaseByName(name string, repos []*Repo) *ChartRelease

GetNewestReleaseByName will return the newest chart release given a collection of repos

func TryToFindNewestReleaseByChart

func TryToFindNewestReleaseByChart(chart *release.Release, repos []*Repo) *ChartRelease

TryToFindNewestReleaseByChart will return the newest chart release given a collection of repos

type ChartReleases

type ChartReleases struct {
	APIVersion string                    `yaml:"apiVersion"`
	Entries    map[string][]ChartRelease `yaml:"entries"`
}

ChartReleases contains the chart releases of a helm repository

type Dependency

type Dependency struct {
	Name                       string `json:"name"`
	Version                    string `json:"version"`
	Repository                 string `json:"repository"`
	ArtifactHubRespositoryName string `json:"artifacthub_respository_name,omitempty"`
}

Dependency is a child struct of PackageData and provides any helm dependency data for a given chart.

type DesiredVersion

type DesiredVersion struct {
	Name    string
	Version string
}

DesiredVersion is a specific desired version that overrides the latest from the repository

type Helm

type Helm struct {
	Kube            *kube.Connection
	DesiredVersions []DesiredVersion
}

Helm contains a helm version and kubernetes client interface

func NewHelm

func NewHelm(kubeContext string) *Helm

NewHelm returns a basic helm struct with the version of helm requested

func (*Helm) GetHelmReleases

func (h *Helm) GetHelmReleases(namespace string, releaseIgnoreList []string, chartIgnoreList []string) ([]*release.Release, error)

GetHelmReleases returns a list of helm releases from the cluster

func (*Helm) GetHelmReleasesVersion

func (h *Helm) GetHelmReleasesVersion(helmRepos []*Repo, helmReleases []*release.Release) []output.ReleaseOutput

GetHelmReleasesVersion returns a collection of deployed helm version 3 charts in a cluster.

func (*Helm) GetReleaseOutput

func (h *Helm) GetReleaseOutput(namespace string, releaseIgnoreList []string, chartIgnoreList []string) ([]*release.Release, []string, error)

GetReleaseOutput returns releases and chart names

func (*Helm) OverrideDesiredVersion

func (h *Helm) OverrideDesiredVersion(rls *output.ReleaseOutput)

OverrideDesiredVersion accepts a list of releases and overrides the version stored in the helm struct where required

type Link struct {
	URL  string `json:"url"`
	Name string `json:"name"`
}

Link is child struct of ArtifactHubHelmPackage

type Maintainer

type Maintainer struct {
	Name         string `json:"name"`
	MaintainerID string `json:"maintainer_id"`
	Email        string `json:"email"`
}

Maintainer is a child struct of ArtifactHubHelmPackage and provides information about maintainers of a helm chart.

type PackageData

type PackageData struct {
	APIVersion   string       `json:"apiVersion"`
	Type         string       `json:"type"`
	KubeVersion  string       `json:"kubeVersion"`
	Dependencies []Dependency `json:"dependencies"`
}

PackageData is a child struct of ArtifactHubHelmPackage and provides some metadata for a helm chart

type Repo

type Repo struct {
	URL    string
	Charts *ChartReleases
}

Repo represents a Helm chart Repo

func IsRepoIncluded

func IsRepoIncluded(chartName string, repos []*Repo) []*Repo

IsRepoIncluded check if the repo is included in the list of repos

func NewRepos

func NewRepos(urls []string) []*Repo

NewRepos returns data about a helm chart repository, given its url

func (*Repo) NewestChartVersion

func (r *Repo) NewestChartVersion(currentChart *chart.Metadata) *ChartRelease

NewestChartVersion returns the newest chart release for the provided release name and version

func (*Repo) NewestVersion

func (r *Repo) NewestVersion(releaseName string) *ChartRelease

NewestVersion returns the newest chart release for the provided release name

Jump to

Keyboard shortcuts

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