Documentation
¶
Index ¶
- Variables
- func ValidateChartTgz(filepath string) error
- type ChartMuseumClient
- func (c *ChartMuseumClient) ChartExists(name string, version string, index *helmRepo.IndexFile) (bool, error)
- func (c *ChartMuseumClient) Fetch(filepath string, name string, version string, sourceRepo *api.Repo, ...) error
- func (c *ChartMuseumClient) Push(filepath string, targetRepo *api.Repo) error
- type ClassicHelmClient
- func (c *ClassicHelmClient) ChartExists(name string, version string, index *helmRepo.IndexFile) (bool, error)
- func (c *ClassicHelmClient) Fetch(filepath string, name string, version string, sourceRepo *api.Repo, ...) error
- func (c *ClassicHelmClient) Push(filepath string, targetRepo *api.Repo) error
- type Client
- type ClientV2
- type HarborClient
- type Reader
- type Writer
Constants ¶
This section is empty.
Variables ¶
var NewClient = func(repo *api.Repo) (Client, error) { switch repo.Kind { case api.Kind_HELM: return NewClassicHelmClient(repo), nil case api.Kind_CHARTMUSEUM: return NewChartMuseumClient(repo), nil case api.Kind_HARBOR: return NewHarborClient(repo), nil default: return nil, fmt.Errorf("unsupported repo kind %q", repo.Kind) } }
NewClient returns a client implementation for the given repo.
The func is exposed as a var to allow tests to temporarily replace its implementation, e.g. to return a fake.
var NewClientV2 = func(repo *api.Repo, opts ...types.Option) (ClientV2, error) { copts := &types.ClientOpts{} for _, o := range opts { o(copts) } cacheDir := copts.GetCache() if cacheDir == "" { dir, err := ioutil.TempDir("", "client") if err != nil { return nil, errors.Annotatef(err, "creating temporary dir") } cacheDir = dir } c, err := cache.New(cacheDir, repo.GetUrl()) if err != nil { return nil, errors.Annotatef(err, "allocating cache") } switch repo.Kind { case api.Kind_HELM: return helmclassic.New(repo, c) case api.Kind_CHARTMUSEUM: return chartmuseum.New(repo, c) case api.Kind_HARBOR: return harbor.New(repo, c) case api.Kind_OCI: return oci.New(repo, c) case api.Kind_LOCAL: return local.New(repo.Path) default: return nil, errors.Errorf("unsupported repo kind %q", repo.Kind) } }
NewClientV2 returns a ClientV2 object
The func is exposed as a var to allow tests to temporarily replace its implementation, e.g. to return a fake.
Functions ¶
func ValidateChartTgz ¶
ValidateChartTgz validates if a chart is a valid tgz file
Types ¶
type ChartMuseumClient ¶
type ChartMuseumClient struct {
// contains filtered or unexported fields
}
ChartMuseumClient implements Client for a ChartMuseum implementation.
func NewChartMuseumClient ¶
func NewChartMuseumClient(repo *api.Repo) *ChartMuseumClient
NewChartMuseumClient creates a new `ChartMuseumClient`.
func (*ChartMuseumClient) ChartExists ¶
func (c *ChartMuseumClient) ChartExists(name string, version string, index *helmRepo.IndexFile) (bool, error)
ChartExists checks if a chart exists in the repo.
type ClassicHelmClient ¶
type ClassicHelmClient struct {
// contains filtered or unexported fields
}
ClassicHelmClient implements Client for a Helm classic implementation.
func NewClassicHelmClient ¶
func NewClassicHelmClient(repo *api.Repo) *ClassicHelmClient
NewClassicHelmClient creates a new `ClassicHelmClient`.
func (*ClassicHelmClient) ChartExists ¶
func (c *ClassicHelmClient) ChartExists(name string, version string, index *helmRepo.IndexFile) (bool, error)
ChartExists checks if a chart exists in the repo.
type Client ¶
type Client interface {
Fetch(filepath string, name string, version string, sourceRepo *api.Repo, index *helmRepo.IndexFile) error
Push(filepath string, targetRepo *api.Repo) error
ChartExists(name string, version string, index *helmRepo.IndexFile) (bool, error)
}
Client defines the methods that a chart client should implement.
type HarborClient ¶
type HarborClient struct {
// contains filtered or unexported fields
}
HarborClient implements Client for a Harbor implementation.
func NewHarborClient ¶
func NewHarborClient(repo *api.Repo) *HarborClient
NewHarborClient creates a new `HarborClient`.
func (*HarborClient) ChartExists ¶
func (c *HarborClient) ChartExists(name string, version string, index *helmRepo.IndexFile) (bool, error)
ChartExists checks if a chart exists in the repo.
type Reader ¶
type Reader interface {
Fetch(name string, version string) (string, error)
List() ([]string, error)
ListChartVersions(name string) ([]string, error)
Has(name string, version string) (bool, error)
GetChartDetails(name string, version string) (*types.ChartDetails, error)
// Reload reloads or refresh the client-side data, in case it needs it
Reload() error
}
Reader defines the methods that a ReadOnly chart client should implement.