catalog

package
v0.0.0-...-0e2c39a Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: UPL-1.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HelmProtocol        = "helm"
	ArtifacthubProtocol = "artifacthub"
	InternalCatalog     = "embedded"
)
View Source
const (
	SearchPath = "api/v1/packages/search"
)

Variables

This section is empty.

Functions

func NewCommunityCatalog

func NewCommunityCatalog() types.Catalog

NewCommunityCatalog returns the definition for adding the community catalog

func WaitForInternalCatalogInstall

func WaitForInternalCatalogInstall(kubeClient kubernetes.Interface, logFn func(string)) error

WaitForInternalCatalogInstall waits for the internal catalog to be installed

Types

type ArtifacthubConnection

type ArtifacthubConnection struct {
	Kubeconfig            string
	CatalogInfo           *CatalogInfo
	Uri                   *url.URL
	LastSearch            *Catalog
	LastArtifacthubSearch *ArtifacthubQueryResults
}

ArtifacthubConnection implements the "artifacthub" protocol. This protocol interacts with ArtifactHub style repositories.

func (*ArtifacthubConnection) GetChart

func (ac *ArtifacthubConnection) GetChart(chart string, version string) ([]byte, error)

GetChart returns the bytes of the tarball for a given chart/version pair. In general, ArtifactHub does not serve any Helm charts itself. It is primarily a means of aggregating charts into a single, searchable location. As such, this function will usually reach out to some other host to actually fetch the chart data.

func (*ArtifacthubConnection) GetCharts

func (ac *ArtifacthubConnection) GetCharts(query string) (*Catalog, error)

GetCharts returns a Catalog containing the results of a query for Helm charts. artifacthub.io has a huge number of packages, over 10,000, so a query term is required.

type ArtifacthubPackage

type ArtifacthubPackage struct {
	Name       string                       `json:"name"`
	Version    string                       `json:"version"`
	AppVersion string                       `json:"app_version"`
	Repository ArtifacthubPackageRepository `json:"repository"`
}

ArtifacthubPackage contains select fields from a call to the ArtifactHub searchPackages API.

Please see: https://artifacthub.io/docs/api/#/Packages/searchPackages

type ArtifacthubPackageRepository

type ArtifacthubPackageRepository struct {
	Url  string `json:"url"`
	Name string `json:"name"`
}

ArtifacthubPackageRepository contains select fields from the "repository" field in an ArtifactHub searchPackages API call.

Please see: https://artifacthub.io/docs/api/#/Packages/searchPackages

type ArtifacthubQueryResults

type ArtifacthubQueryResults struct {
	Packages []ArtifacthubPackage
}

ArtifacthubQueryResults is the top level structure of the response from a call to the ArtifactHub searchPackages API.

Please see: https://artifacthub.io/docs/api/#/Packages/searchPackages

type Catalog

type Catalog struct {
	ApiVersion   string                 `yaml:"apiVersion"`
	Generated    time.Time              `yaml:"generated"`
	ChartEntries map[string][]ChartMeta `yaml:"entries"`
	RawJSON      []byte
	Connection   CatalogConnection
}

Catalog contains the helm chart index of all the charts in the catalog NOTE: This structure is derived from the JSON return from the catalog service /charts/ endpoint

type CatalogConnection

type CatalogConnection interface {
	// GetCharts fetches charts in a catalog.  A query
	// string is given to limit the search results for
	// some protocols.  Implementations are not required
	// to respect the query string.
	GetCharts(string) (*Catalog, error)

	// GetChart downloads a chart at a specific version
	GetChart(string, string) ([]byte, error)
}

CatalogConnection represents a connection to a catalog

func NewArtifacthubConnection

func NewArtifacthubConnection(kubeconfig string, ci *CatalogInfo) (CatalogConnection, error)

NewArtifacthubConnection returns a Connection that implements the ArtifactHub protocol.

func NewConnection

func NewConnection(kubeconfig string, ci *CatalogInfo) (CatalogConnection, error)

NewConnection creates a connection to the desired catalog.

func NewHelmConnection

func NewHelmConnection(kubeconfig string, ci *CatalogInfo) (CatalogConnection, error)

NewHelmConnection opens a connection to a vanilla Helm repo

func NewInternalConnection

func NewInternalConnection(kubeconfig string, ci *CatalogInfo) (CatalogConnection, error)

NewInternalConnection opens a connection to the internal catalog

type CatalogInfo

type CatalogInfo struct {
	// ServiceNsn is the namespaced name of the Kubernetes service hosting the catalog
	ServiceNsn types.NamespacedName

	// CatalogName is the user visible name that identifies the catalog
	CatalogName string

	// Protocol is the catalog protocol for the catalog
	Protocol string

	// Uri is the URI of the of the catalog
	Uri string

	// Port is the port for the service, if one is defined
	Port int32

	// Scheme is the scheme for the service, if one is defined.
	// This value is taken from the name of the port.
	Scheme string

	// Hostname is the hostname of the catalog
	// for ExternalName services
	Hostname string

	// Type is the type of service
	Type v1.ServiceType
}

CatalogInfo specifies the catalog information

type ChartMeta

type ChartMeta struct {
	Name        string    `yaml:"name"`
	Version     string    `yaml:"version"`
	Description string    `yaml:"description"`
	ApiVersion  string    `yaml:"apiVersion"`
	AppVersion  string    `yaml:"appVersion"`
	Type        string    `yaml:"type"`
	Urls        []string  `yaml:"urls"`
	Created     time.Time `yaml:"created"`
	Digest      string    `yaml:"digest"`
}

ChartMeta represents a single helm chart NOTE: This structure is derived from the JSON return from the catalog service /charts/ endpoint

type ChartWithOverrides

type ChartWithOverrides struct {
	// Chart represents versions of a helm chart. One entry per version.
	Chart ChartMeta

	// Overrides is a list of overrides that get munged together. Later values take precedence over earlier ones.
	Overrides []helm.HelmOverrides
}

type CopyOptions

type CopyOptions struct {
	// KubeConfigPath is the path of the kubeconfig file
	KubeConfigPath string

	// FilePath is the name of the source file
	FilePath string

	// Destination is the name of the destination domain
	Destination string

	// DestinationFilePath is the name of the destination file
	DestinationFilePath string

	// Images is an optional slice of images, if provided, FilePath is ignored
	Images []string
}

CopyOptions are the options for copy

type HelmConnection

type HelmConnection struct {
	Kubeconfig  string
	CatalogInfo *CatalogInfo
	Uri         string
	LastSearch  *Catalog
}

HelmConnection implements the "helm" protocol. This protocol interacts directly with raw Helm repositories.

func (*HelmConnection) GetChart

func (hc *HelmConnection) GetChart(chart string, version string) ([]byte, error)

GetChart returns the bytes of the tarball for the desired chart/version pair.

func (*HelmConnection) GetCharts

func (hc *HelmConnection) GetCharts(query string) (*Catalog, error)

GetCharts returns a Catalog populated with the charts from a particular Helm repository. Most Helm repos are of a reasonable size, and a query pattern is not required. The query parameter is ignored.

type InternalConnection

type InternalConnection struct {
}

InternalConnection implements the CatalogConnection interface for the compiled-in catalog.

func (*InternalConnection) GetChart

func (ic *InternalConnection) GetChart(chart string, version string) ([]byte, error)

GetChart returns the bytes of the tarball for the desired chart/version pair

func (*InternalConnection) GetCharts

func (ic *InternalConnection) GetCharts(query string) (*Catalog, error)

GetCharts returns a Catalog populated with the contents of the embedded catalog

type SearchOptions

type SearchOptions struct {
	// KubeConfigPath is the path of the kubeconfig file
	KubeConfigPath string

	// CatalogName is the name of the catalog to search
	CatalogName string

	// Pattern is a regular expression search pattern
	Pattern string
}

SearchOptions are the options for search

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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