registry

package
v3.6.9 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2022 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// HelmChartConfigMediaType is the reserved media type for the Helm chart manifest config
	HelmChartConfigMediaType = "application/vnd.cncf.helm.config.v1+json"

	// HelmChartContentLayerMediaType is the reserved media type for Helm chart package content
	HelmChartContentLayerMediaType = "application/tar+gzip"
)
View Source
const (
	// CacheRootDir is the root directory for a cache
	CacheRootDir = "cache"
)
View Source
const (
	// CredentialsFileBasename is the filename for auth credentials file
	CredentialsFileBasename = "config.json"
)

Variables

This section is empty.

Functions

func KnownMediaTypes

func KnownMediaTypes() []string

KnownMediaTypes returns a list of layer mediaTypes that the Helm client knows about

Types

type Authorizer

type Authorizer struct {
	auth.Client
}

Authorizer handles registry auth operations

type Cache

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

Cache handles local/in-memory storage of Helm charts, compliant with OCI Layout

func NewCache

func NewCache(opts ...CacheOption) (*Cache, error)

NewCache returns a new OCI Layout-compliant cache with config

func (*Cache) AddManifest

func (cache *Cache) AddManifest(ref *Reference, manifest *ocispec.Descriptor) error

AddManifest provides a manifest to the cache index.json

func (*Cache) DeleteReference

func (cache *Cache) DeleteReference(ref *Reference) (*CacheRefSummary, error)

DeleteReference deletes a chart ref from cache TODO: garbage collection, only manifest removed

func (*Cache) FetchReference

func (cache *Cache) FetchReference(ref *Reference) (*CacheRefSummary, error)

FetchReference retrieves a chart ref from cache

func (*Cache) Ingester

func (cache *Cache) Ingester() content.Ingester

Ingester provides a valid containerd Ingester

func (*Cache) ListReferences

func (cache *Cache) ListReferences() ([]*CacheRefSummary, error)

ListReferences lists all chart refs in a cache

func (*Cache) ProvideIngester

func (cache *Cache) ProvideIngester() orascontent.ProvideIngester

ProvideIngester provides a valid oras ProvideIngester

func (*Cache) Provider

func (cache *Cache) Provider() content.Provider

Provider provides a valid containerd Provider

func (*Cache) StoreReference

func (cache *Cache) StoreReference(ref *Reference, ch *chart.Chart) (*CacheRefSummary, error)

StoreReference stores a chart ref in cache

type CacheOption

type CacheOption func(*Cache)

CacheOption allows specifying various settings configurable by the user for overriding the defaults used when creating a new default cache

func CacheOptDebug

func CacheOptDebug(debug bool) CacheOption

CacheOptDebug returns a function that sets the debug setting on cache options set

func CacheOptRoot

func CacheOptRoot(rootDir string) CacheOption

CacheOptRoot returns a function that sets the root directory setting on cache options set

func CacheOptWriter

func CacheOptWriter(out io.Writer) CacheOption

CacheOptWriter returns a function that sets the writer setting on cache options set

type CacheRefSummary

type CacheRefSummary struct {
	Name         string
	Repo         string
	Tag          string
	Exists       bool
	Manifest     *ocispec.Descriptor
	Config       *ocispec.Descriptor
	ContentLayer *ocispec.Descriptor
	Size         int64
	Digest       digest.Digest
	CreatedAt    time.Time
	Chart        *chart.Chart
}

CacheRefSummary contains as much info as available describing a chart reference in cache Note: fields here are sorted by the order in which they are set in FetchReference method

type Client

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

Client works with OCI-compliant registries and local Helm chart cache

func NewClient

func NewClient(opts ...ClientOption) (*Client, error)

NewClient returns a new registry client with config

func (*Client) LoadChart

func (c *Client) LoadChart(ref *Reference) (*chart.Chart, error)

LoadChart retrieves a chart object by reference

func (*Client) Login

func (c *Client) Login(hostname string, username string, password string, insecure bool) error

Login logs into a registry

func (*Client) Logout

func (c *Client) Logout(hostname string) error

Logout logs out of a registry

func (*Client) PrintChartTable

func (c *Client) PrintChartTable() error

PrintChartTable prints a list of locally stored charts

func (*Client) PullChart

func (c *Client) PullChart(ref *Reference) (*bytes.Buffer, error)

PullChart downloads a chart from a registry

func (*Client) PullChartToCache

func (c *Client) PullChartToCache(ref *Reference) error

PullChartToCache pulls a chart from an OCI Registry to the Registry Cache. This function is needed for `helm chart pull`, which is experimental and will be deprecated soon. Likewise, the Registry cache will soon be deprecated as will this function.

func (*Client) PushChart

func (c *Client) PushChart(ref *Reference) error

PushChart uploads a chart to a registry

func (*Client) RemoveChart

func (c *Client) RemoveChart(ref *Reference) error

RemoveChart deletes a locally saved chart

func (*Client) SaveChart

func (c *Client) SaveChart(ch *chart.Chart, ref *Reference) error

SaveChart stores a copy of chart in local cache

type ClientOption

type ClientOption func(*Client)

ClientOption allows specifying various settings configurable by the user for overriding the defaults used when creating a new default client

func ClientOptAuthorizer

func ClientOptAuthorizer(authorizer *Authorizer) ClientOption

ClientOptAuthorizer returns a function that sets the authorizer setting on client options set

func ClientOptCache

func ClientOptCache(cache *Cache) ClientOption

ClientOptCache returns a function that sets the cache setting on a client options set

func ClientOptCredentialsFile

func ClientOptCredentialsFile(credentialsFile string) ClientOption

ClientOptCredentialsFile returns a function that sets the cache setting on a client options set

func ClientOptDebug

func ClientOptDebug(debug bool) ClientOption

ClientOptDebug returns a function that sets the debug setting on client options set

func ClientOptResolver

func ClientOptResolver(resolver *Resolver) ClientOption

ClientOptResolver returns a function that sets the resolver setting on client options set

func ClientOptWriter

func ClientOptWriter(out io.Writer) ClientOption

ClientOptWriter returns a function that sets the writer setting on client options set

type Reference

type Reference struct {
	Tag  string
	Repo string
}

Reference defines the main components of a reference specification

func ParseReference

func ParseReference(s string) (*Reference, error)

ParseReference converts a string to a Reference

func (*Reference) FullName

func (ref *Reference) FullName() string

FullName the full name of a reference (repo:tag)

type Resolver

type Resolver struct {
	remotes.Resolver
}

Resolver provides remotes based on a locator

Jump to

Keyboard shortcuts

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