Documentation ¶
Index ¶
- Variables
- func NewRedisCache() cache.Cache
- type Cache
- func (rc *Cache) ClearAll() error
- func (rc *Cache) Decr(key string) error
- func (rc *Cache) Delete(key string) error
- func (rc *Cache) Get(key string) interface{}
- func (rc *Cache) GetMulti(keys []string) []interface{}
- func (rc *Cache) Incr(key string) error
- func (rc *Cache) IsExist(key string) bool
- func (rc *Cache) Put(key string, val interface{}, timeout time.Duration) error
- func (rc *Cache) StartAndGC(config string) error
- type ChartCache
- type ChartCacheConfig
- type ChartClient
- type ChartInfo
- type ChartOperator
- func (cho *ChartOperator) GetChartData(content []byte) (*chart.Chart, error)
- func (cho *ChartOperator) GetChartDetails(content []byte) (*ChartVersionDetails, error)
- func (cho *ChartOperator) GetChartList(content []byte) ([]*ChartInfo, error)
- func (cho *ChartOperator) GetChartVersions(content []byte) (ChartVersions, error)
- type ChartVersion
- type ChartVersionDetails
- type ChartVersions
- type Controller
- func (c *Controller) APIPrefix(namespace string) string
- func (c *Controller) DeleteChart(namespace, chartName string) error
- func (c *Controller) DeleteChartVersion(namespace, chartName, version string) error
- func (c *Controller) GetChart(namespace, chartName string) (ChartVersions, error)
- func (c *Controller) GetChartVersion(namespace, name, version string) (*helm_repo.ChartVersion, error)
- func (c *Controller) GetChartVersionDetails(namespace, chartName, version string) (*ChartVersionDetails, error)
- func (c *Controller) GetCountOfCharts(namespaces []string) (uint64, error)
- func (c *Controller) GetIndexFile(namespaces []string) (*helm_repo.IndexFile, error)
- func (c *Controller) ListCharts(namespace string) ([]*ChartInfo, error)
- func (c *Controller) ProxyTraffic(w http.ResponseWriter, req *http.Request)
- func (c *Controller) SearchChart(q string, namespaces []string) ([]*search.Result, error)
- type Credential
- type DigitalSignature
- type ProxyEngine
- type ProxyTrafficHandler
- type SecurityReport
- type ServiceHandler
Constants ¶
This section is empty.
Variables ¶
var (
// DefaultKey the collection name of redis for cache adapter.
DefaultKey = "beecacheRedis"
)
Functions ¶
func NewRedisCache ¶
NewRedisCache create new redis cache with default collection name.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is Redis cache adapter.
func (*Cache) StartAndGC ¶
StartAndGC start redis cache adapter. config is like {"key":"collection key","conn":"connection info","dbNum":"0","masterName":"mymaster"} the cache item in redis are stored forever, so no gc operation.
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(credential *Credential) *ChartClient
NewChartClient is constructor of ChartClient credential can be nil
func (*ChartClient) DeleteContent ¶
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) GetChartData ¶
func (cho *ChartOperator) GetChartData(content []byte) (*chart.Chart, error)
GetChartData returns raw data of chart
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 ¶
func (cho *ChartOperator) GetChartVersions(content []byte) (ChartVersions, error)
GetChartVersions returns the chart versions
type ChartVersion ¶
type ChartVersion struct { helm_repo.ChartVersion Labels []*model.Label `json:"labels"` }
ChartVersion extends the helm ChartVersion with additional labels
type ChartVersionDetails ¶
type ChartVersionDetails struct { Metadata *helm_repo.ChartVersion `json:"metadata"` Dependencies []*chart.Dependency `json:"dependencies"` Values map[string]interface{} `json:"values"` Files map[string]string `json:"files"` Security *SecurityReport `json:"security"` Labels []*model.Label `json:"labels"` }
ChartVersionDetails keeps the detailed data info of the chart version
type ChartVersions ¶
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, middlewares ...func(http.Handler) http.Handler) (*Controller, error)
NewController is constructor of the chartserver.Controller
func (*Controller) APIPrefix ¶
func (c *Controller) APIPrefix(namespace string) string
APIPrefix returns the API prefix path of calling backend chart service.
func (*Controller) DeleteChart ¶
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 ¶
func (c *Controller) DeleteChartVersion(namespace, chartName, version string) error
DeleteChartVersion will delete the specified version of the chart See @ServiceHandler.DeleteChartVersion
func (*Controller) GetChart ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
func (c *Controller) ListCharts(namespace string) ([]*ChartInfo, error)
ListCharts gets the chart list under the namespace See @ServiceHandler.ListCharts
func (*Controller) ProxyTraffic ¶
func (c *Controller) ProxyTraffic(w http.ResponseWriter, req *http.Request)
ProxyTraffic implements the interface method.
func (*Controller) SearchChart ¶
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 ¶
Credential keeps the username and password for the basic auth
type DigitalSignature ¶
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, middlewares ...func(http.Handler) http.Handler) *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 ¶
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 ¶
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.