chartserver

package
v1.7.6 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2019 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChartCache

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

ChartCache is designed to cache some processed data for repeated accessing to improve the performance

func NewChartCache

func NewChartCache(config *ChartCacheConfig) *ChartCache

NewChartCache is constructor of ChartCache If return nil, that means no cache is enabled for chart repository server

func (*ChartCache) GetChart

func (chc *ChartCache) GetChart(chartDigest string) *ChartVersionDetails

GetChart trys to retrieve it from the cache If hit, return the cached item; otherwise, nil object is returned

func (*ChartCache) IsEnabled

func (chc *ChartCache) IsEnabled() bool

IsEnabled to indicate if the chart cache is successfully enabled The cache may be disabled if

user does not set
wrong configurations

func (*ChartCache) PutChart

func (chc *ChartCache) PutChart(chart *ChartVersionDetails)

PutChart caches the detailed data of chart version

type ChartCacheConfig

type ChartCacheConfig struct {
	// Only support 'in-memory' and 'redis' now
	DriverType string

	// Align with config
	Config string
}

ChartCacheConfig keeps the configurations of ChartCache

type ChartClient

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

ChartClient is a http client to get the content from the external http server

func NewChartClient

func NewChartClient(credentail *Credential) *ChartClient

NewChartClient is constructor of ChartClient credentail can be nil

func (*ChartClient) DeleteContent added in v1.7.0

func (cc *ChartClient) DeleteContent(addr string) error

DeleteContent sends deleting request to the addr to delete content

func (*ChartClient) GetContent

func (cc *ChartClient) GetContent(addr string) ([]byte, error)

GetContent get the bytes from the specified url

type ChartInfo

type ChartInfo struct {
	Name          string    `json:"name"`
	TotalVersions uint32    `json:"total_versions"`
	LatestVersion string    `json:"latest_version"`
	Created       time.Time `json:"created"`
	Updated       time.Time `json:"updated"`
	Icon          string    `json:"icon"`
	Home          string    `json:"home"`
	Deprecated    bool      `json:"deprecated"`
}

ChartInfo keeps the information of the chart

type ChartOperator

type ChartOperator struct{}

ChartOperator is designed to process the contents of the specified chart version to get more details

func (*ChartOperator) GetChartDetails

func (cho *ChartOperator) GetChartDetails(content []byte) (*ChartVersionDetails, error)

GetChartDetails parse the details from the provided content bytes

func (*ChartOperator) GetChartList

func (cho *ChartOperator) GetChartList(content []byte) ([]*ChartInfo, error)

GetChartList returns a reorganized chart list

func (*ChartOperator) GetChartVersions added in v1.7.0

func (cho *ChartOperator) GetChartVersions(content []byte) (ChartVersions, error)

GetChartVersions returns the chart versions

type ChartVersion added in v1.7.0

type ChartVersion struct {
	helm_repo.ChartVersion
	Labels []*models.Label `json:"labels"`
}

ChartVersion extends the helm ChartVersion with additional labels

type ChartVersionDetails

type ChartVersionDetails struct {
	Metadata     *helm_repo.ChartVersion `json:"metadata"`
	Dependencies []*chartutil.Dependency `json:"dependencies"`
	Values       map[string]interface{}  `json:"values"`
	Files        map[string]string       `json:"files"`
	Security     *SecurityReport         `json:"security"`
	Labels       []*models.Label         `json:"labels"`
}

ChartVersionDetails keeps the detailed data info of the chart version

type ChartVersions added in v1.7.0

type ChartVersions []*ChartVersion

ChartVersions is an array of extended ChartVersion

type Controller

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

Controller is used to handle flows of related requests based on the corresponding handlers A reverse proxy will be created and managed to proxy the related traffics between API and backend chart server

func NewController

func NewController(backendServer *url.URL) (*Controller, error)

NewController is constructor of the chartserver.Controller

func (*Controller) APIPrefix added in v1.7.0

func (c *Controller) APIPrefix(namespace string) string

APIPrefix returns the API prefix path of calling backend chart service.

func (*Controller) DeleteChart added in v1.7.0

func (c *Controller) DeleteChart(namespace, chartName string) error

DeleteChart deletes all the chart versions of the specified chart under the namespace. See @ServiceHandler.DeleteChart

func (*Controller) DeleteChartVersion added in v1.7.0

func (c *Controller) DeleteChartVersion(namespace, chartName, version string) error

DeleteChartVersion will delete the specified version of the chart See @ServiceHandler.DeleteChartVersion

func (*Controller) GetChart added in v1.7.0

func (c *Controller) GetChart(namespace, chartName string) (ChartVersions, error)

GetChart returns all the chart versions under the specified chart See @ServiceHandler.GetChart

func (*Controller) GetChartVersion added in v1.7.0

func (c *Controller) GetChartVersion(namespace, name, version string) (*helm_repo.ChartVersion, error)

GetChartVersion returns the summary of the specified chart version. See @ServiceHandler.GetChartVersion

func (*Controller) GetChartVersionDetails added in v1.7.0

func (c *Controller) GetChartVersionDetails(namespace, chartName, version string) (*ChartVersionDetails, error)

GetChartVersionDetails get the specified version for one chart This handler should return the details of the chart version, maybe including metadata,dependencies and values etc. See @ServiceHandler.GetChartVersionDetails

func (*Controller) GetCountOfCharts added in v1.7.0

func (c *Controller) GetCountOfCharts(namespaces []string) (uint64, error)

GetCountOfCharts calculates and returns the total count of charts under the specified namespaces. See @ServiceHandler.GetCountOfCharts

func (*Controller) GetIndexFile added in v1.7.0

func (c *Controller) GetIndexFile(namespaces []string) (*helm_repo.IndexFile, error)

GetIndexFile will read the index.yaml under all namespaces and merge them as a single one Please be aware that, to support this function, the backend chart repository server should enable multi-tenancies

See @ServiceHandler.GetIndexFile

func (*Controller) ListCharts added in v1.7.0

func (c *Controller) ListCharts(namespace string) ([]*ChartInfo, error)

ListCharts gets the chart list under the namespace See @ServiceHandler.ListCharts

func (*Controller) ProxyTraffic added in v1.7.0

func (c *Controller) ProxyTraffic(w http.ResponseWriter, req *http.Request)

ProxyTraffic implements the interface method.

func (*Controller) SearchChart added in v1.7.0

func (c *Controller) SearchChart(q string, namespaces []string) ([]*search.Result, error)

SearchChart search charts in the specified namespaces with the keyword q. RegExp mode is enabled as default. For each chart, only the latest version will shown in the result list if matched to avoid duplicated entries. Keep consistent with `helm search` command.

type Credential

type Credential struct {
	Username string
	Password string
}

Credential keeps the username and password for the basic auth

type DigitalSignature

type DigitalSignature struct {
	Signed     bool   `json:"signed"`
	Provenance string `json:"prov_file"`
}

DigitalSignature used to indicate if the chart has been signed

type ProxyEngine

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

ProxyEngine is used to proxy the related traffics

func NewProxyEngine

func NewProxyEngine(target *url.URL, cred *Credential) *ProxyEngine

NewProxyEngine is constructor of NewProxyEngine

func (*ProxyEngine) ServeHTTP

func (pe *ProxyEngine) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP serves the incoming http requests

type ProxyTrafficHandler added in v1.7.0

type ProxyTrafficHandler interface {
	// Proxy the traffic to the backended server
	//
	// Req *http.Request     : The incoming http request
	// w http.ResponseWriter : The response writer reference
	ProxyTraffic(w http.ResponseWriter, req *http.Request)
}

ProxyTrafficHandler defines the handler methods to handle the proxy traffic.

type SecurityReport

type SecurityReport struct {
	Signature *DigitalSignature `json:"signature"`
}

SecurityReport keeps the info related with security e.g.: digital signature, vulnerability scanning etc.

type ServiceHandler added in v1.7.0

type ServiceHandler interface {
	// ListCharts lists all the charts under the specified namespace.
	//
	//  namespace string: the chart namespace.
	//
	//  If succeed, a chart info list with nil error will be returned;
	//  otherwise, a non-nil error will be got.
	ListCharts(namespace string) ([]*ChartInfo, error)

	// Get all the chart versions of the specified chart under the namespace.
	//
	// namespace string: the chart namespace.
	// chartName string: the name of the chart, e.g: "harbor"
	//
	// If succeed, a chart version list with nil error will be returned;
	// otherwise, a non-nil error will be got.
	GetChart(namespace, chartName string) (helm_repo.ChartVersions, error)

	// Get the detailed info of the specified chart version under the namespace.
	// The detailed info includes chart summary, dependencies, values and signature status etc.
	//
	// namespace string: the chart namespace.
	// chartName string: the name of the chart, e.g: "harbor"
	// version string: the SemVer version of the chart, e.g: "0.2.0"
	//
	// If succeed, chart version details with nil error will be returned;
	// otherwise, a non-nil error will be got.
	GetChartVersionDetails(namespace, chartName, version string) (*ChartVersionDetails, error)

	// SearchChart search charts in the specified namespaces with the keyword q.
	// RegExp mode is enabled as default.
	// For each chart, only the latest version will shown in the result list if matched to avoid duplicated entries.
	// Keep consistent with `helm search` command.
	//
	// q string            : the searching keyword
	// namespaces []string : the search namespace scope
	//
	// If succeed, a search result list with nil error will be returned;
	// otherwise, a non-nil error will be got.
	SearchChart(q string, namespaces []string) ([]*search.Result, error)

	// GetIndexFile will read the index.yaml under all namespaces and merge them as a single one
	// Please be aware that, to support this function, the backend chart repository server should
	// enable multi-tenancies
	//
	// namespaces []string : all the namespaces with accessing permissions
	//
	// If succeed, a unified merged index file with nil error will be returned;
	// otherwise, a non-nil error will be got.
	GetIndexFile(namespaces []string) (*helm_repo.IndexFile, error)

	// Get the chart summary of the specified chart version.
	//
	// namespace string: the chart namespace.
	// chartName string: the name of the chart, e.g: "harbor"
	// version string: the SemVer version of the chart, e.g: "0.2.0"
	//
	// If succeed, chart version summary with nil error will be returned;
	// otherwise, a non-nil error will be got.
	GetChartVersion(namespace, name, version string) (*helm_repo.ChartVersion, error)

	// DeleteChart deletes all the chart versions of the specified chart under the namespace.
	//
	// namespace string: the chart namespace.
	// chartName string: the name of the chart, e.g: "harbor"
	//
	// If succeed, a nil error will be returned;
	// otherwise, a non-nil error will be got.
	DeleteChart(namespace, chartName string) error

	// GetCountOfCharts calculates and returns the total count of charts under the specified namespaces.
	//
	// namespaces []string : the namespaces to count charts
	//
	// If succeed, a unsigned integer with nil error will be returned;
	// otherwise, a non-nil error will be got.
	GetCountOfCharts(namespaces []string) (uint64, error)
}

ServiceHandler defines the related methods to handle kinds of chart service requests.

Jump to

Keyboard shortcuts

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