chartserver

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2018 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteError

func WriteError(w http.ResponseWriter, code int, err error)

WriteError writes error to http client

func WriteInternalError

func WriteInternalError(w http.ResponseWriter, err error)

WriteInternalError writes error with statusCode == 500

Types

type BaseHandler

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

BaseHandler defines the handlers related with the chart server itself.

func (*BaseHandler) GetHealthStatus

func (bh *BaseHandler) GetHealthStatus(w http.ResponseWriter, req *http.Request)

GetHealthStatus will return the health status of the backend chart repository server

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) GetContent

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

GetContent get the bytes from the specified url

type ChartInfo

type ChartInfo struct {
	Name          string
	TotalVersions uint32 `json:"total_versions"`
	Created       time.Time
	Icon          string
	Home          string
	Deprecated    bool
}

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

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"`
}

ChartVersionDetails keeps the detailed data info of the chart version

type ContextKey

type ContextKey string

ContextKey is defined for add value in the context of http request

const (
	//NamespaceContextKey is context key for the namespace
	NamespaceContextKey ContextKey = ":repo"
)

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) GetBaseHandler

func (c *Controller) GetBaseHandler() *BaseHandler

GetBaseHandler returns the reference of BaseHandler

func (*Controller) GetManipulationHandler

func (c *Controller) GetManipulationHandler() *ManipulationHandler

GetManipulationHandler returns the reference of ManipulationHandler

func (*Controller) GetRepositoryHandler

func (c *Controller) GetRepositoryHandler() *RepositoryHandler

GetRepositoryHandler returns the reference of RepositoryHandler

func (*Controller) GetUtilityHandler

func (c *Controller) GetUtilityHandler() *UtilityHandler

GetUtilityHandler returns the reference of UtilityHandler

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 ManipulationHandler

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

ManipulationHandler includes all the handler methods for the purpose of manipulating the chart repository

func (*ManipulationHandler) DeleteChartVersion

func (mh *ManipulationHandler) DeleteChartVersion(w http.ResponseWriter, req *http.Request)

DeleteChartVersion will delete the specified version of the chart

func (*ManipulationHandler) GetChart

func (mh *ManipulationHandler) GetChart(w http.ResponseWriter, req *http.Request)

GetChart returns all the chart versions under the specified chart

func (*ManipulationHandler) GetChartVersion

func (mh *ManipulationHandler) GetChartVersion(w http.ResponseWriter, req *http.Request)

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

func (*ManipulationHandler) ListCharts

func (mh *ManipulationHandler) ListCharts(w http.ResponseWriter, req *http.Request)

ListCharts lists all the charts under the specified namespace

func (*ManipulationHandler) UploadChartVersion

func (mh *ManipulationHandler) UploadChartVersion(w http.ResponseWriter, req *http.Request)

UploadChartVersion will save the new version of the chart to the backend storage

func (*ManipulationHandler) UploadProvenanceFile

func (mh *ManipulationHandler) UploadProvenanceFile(w http.ResponseWriter, req *http.Request)

UploadProvenanceFile will save the provenance file of the chart to the backend storage

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 RepositoryHandler

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

RepositoryHandler defines all the handlers to handle the requests related with chart repository e.g: index.yaml and downloading chart objects

func (*RepositoryHandler) DownloadChartObject

func (rh *RepositoryHandler) DownloadChartObject(w http.ResponseWriter, req *http.Request)

DownloadChartObject will download the stored chart object to the client e.g: helm install

func (*RepositoryHandler) GetIndexFile

func (rh *RepositoryHandler) GetIndexFile(w http.ResponseWriter, req *http.Request)

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

func (*RepositoryHandler) GetIndexFileWithNS

func (rh *RepositoryHandler) GetIndexFileWithNS(w http.ResponseWriter, req *http.Request)

GetIndexFileWithNS will read the index.yaml data under the specified namespace

type SecurityReport

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

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

type UtilityHandler

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

UtilityHandler provides utility methods

func (*UtilityHandler) GetChartsByNs

func (uh *UtilityHandler) GetChartsByNs(namespace string) ([]*ChartInfo, error)

GetChartsByNs gets the chart list under the namespace

Jump to

Keyboard shortcuts

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