Documentation ¶
Index ¶
- Variables
- func IsGCSShortType(t string) bool
- func IsGithubShortPackageType(t string) bool
- func IsGithubShortType(t string) bool
- func NewFilebasedCredentialProvider(filename string) (common.CredentialProvider, error)
- func NewInmemCredentialProvider() common.CredentialProvider
- func NewInmemRegistryService() common.RegistryService
- func NewSecretsCredentialProvider() common.CredentialProvider
- func ParseRegistryFormat(rf common.RegistryFormat) map[common.RegistryFormat]bool
- type DownloadResponse
- type FilebasedCredentialProvider
- type GCSRegistry
- func (g GCSRegistry) Do(req *http.Request) (resp *http.Response, err error)
- func (g GCSRegistry) GetBucket() string
- func (g GCSRegistry) GetDownloadURLs(t Type) ([]*url.URL, error)
- func (g GCSRegistry) GetRegistryFormat() common.RegistryFormat
- func (g GCSRegistry) GetRegistryName() string
- func (g GCSRegistry) GetRegistryShortURL() string
- func (g GCSRegistry) GetRegistryType() common.RegistryType
- func (g GCSRegistry) ListTypes(regex *regexp.Regexp) ([]Type, error)
- type GCSRegistryProvider
- type GithubPackageRegistry
- func (g GithubPackageRegistry) Do(req *http.Request) (resp *http.Response, err error)
- func (g GithubPackageRegistry) GetDownloadURLs(t Type) ([]*url.URL, error)
- func (g GithubPackageRegistry) GetRegistryFormat() common.RegistryFormat
- func (g GithubPackageRegistry) GetRegistryName() string
- func (g GithubPackageRegistry) GetRegistryOwner() string
- func (g GithubPackageRegistry) GetRegistryPath() string
- func (g GithubPackageRegistry) GetRegistryRepository() string
- func (g GithubPackageRegistry) GetRegistryShortURL() string
- func (g GithubPackageRegistry) GetRegistryType() common.RegistryType
- func (g GithubPackageRegistry) ListTypes(regex *regexp.Regexp) ([]Type, error)
- func (g GithubPackageRegistry) MakeRepositoryPath(t Type) (string, error)
- type GithubRegistry
- type GithubRegistryProvider
- func NewGithubRegistryProvider(cp common.CredentialProvider) GithubRegistryProvider
- func NewTestGithubRegistryProvider(shortURL string, responses map[Type]TestURLAndError) GithubRegistryProvider
- func NewTestGithubRegistryProviderWithDownloads(shortURL string, responses map[Type]TestURLAndError, ...) GithubRegistryProvider
- type GithubRepositoryService
- type GithubTemplateRegistry
- func (g GithubTemplateRegistry) Do(req *http.Request) (resp *http.Response, err error)
- func (g GithubTemplateRegistry) GetDownloadURLs(t Type) ([]*url.URL, error)
- func (g GithubTemplateRegistry) GetRegistryFormat() common.RegistryFormat
- func (g GithubTemplateRegistry) GetRegistryName() string
- func (g GithubTemplateRegistry) GetRegistryOwner() string
- func (g GithubTemplateRegistry) GetRegistryPath() string
- func (g GithubTemplateRegistry) GetRegistryRepository() string
- func (g GithubTemplateRegistry) GetRegistryShortURL() string
- func (g GithubTemplateRegistry) GetRegistryType() common.RegistryType
- func (g GithubTemplateRegistry) ListTypes(regex *regexp.Regexp) ([]Type, error)
- func (g GithubTemplateRegistry) MakeRepositoryPath(t Type) (string, error)
- type InmemCredentialProvider
- type NamedRegistryCredential
- type ObjectStorageRegistry
- type Registry
- func GetDownloadURLs(rp RegistryProvider, t string) ([]string, Registry, error)
- func ShortTypeToDownloadURLs(rp RegistryProvider, t string) ([]string, Registry, error)
- func ShortTypeToGCSDownloadUrls(rp RegistryProvider, t string) ([]string, Registry, error)
- func ShortTypeToPackageDownloadURLs(rp RegistryProvider, t string) ([]string, Registry, error)
- type RegistryProvider
- type SecretsCredentialProvider
- type SemVer
- type TestURLAndError
- type Type
Constants ¶
This section is empty.
Variables ¶
var ChartFormatMatcher = regexp.MustCompile("(.*)-(.*).tgz")
ChartFormatMatcher matches the chart name format
var GCSRegistryMatcher = regexp.MustCompile("gs://(.*)/(.*)")
RE for GCS storage
var PackageRegistryMatcher = regexp.MustCompile("github.com/(.*)/(.*)/(.*)")
RE for a registry type that does not support versions and does not have collections.
var TemplateRegistryMatcher = regexp.MustCompile("github.com/(.*)/(.*)/(.*)/(.*):(.*)")
RE for a registry type that does support versions and has collections.
var URLFormatMatcher = regexp.MustCompile("gs://(.*)")
URLFormatMatcher matches the GCS URL format (gs:).
Functions ¶
func IsGCSShortType ¶
IsGCSShortType returns whether a given type is a type description in a short format to GCS
func IsGithubShortPackageType ¶
IsGithubShortPackageType returns whether a given type is a type description in a short format to a github package repository type. For now, this means using github types: github.com/owner/repo/type for example: github.com/helm/charts/cassandra
func IsGithubShortType ¶
IsGithubShortType returns whether a given type is a type description in a short format to a github repository type. For now, this means using github types: github.com/owner/repo/qualifier/type:version for example: github.com/kubernetes/application-dm-templates/storage/redis:v1
func NewFilebasedCredentialProvider ¶
func NewFilebasedCredentialProvider(filename string) (common.CredentialProvider, error)
NewFilebasedCredentialProvider creates a file based credential provider.
func NewInmemCredentialProvider ¶
func NewInmemCredentialProvider() common.CredentialProvider
NewInmemCredentialProvider creates a new memory based credential provider.
func NewInmemRegistryService ¶
func NewInmemRegistryService() common.RegistryService
NewInmemRegistryService returns a new memory based registry service.
func NewSecretsCredentialProvider ¶
func NewSecretsCredentialProvider() common.CredentialProvider
NewSecretsCredentialProvider creates a new secrets credential provider.
func ParseRegistryFormat ¶
func ParseRegistryFormat(rf common.RegistryFormat) map[common.RegistryFormat]bool
ParseRegistryFormat creates a map from a registry format string.
Types ¶
type DownloadResponse ¶
DownloadResponse holds a mock http response for testing.
type FilebasedCredentialProvider ¶
type FilebasedCredentialProvider struct {
// contains filtered or unexported fields
}
FilebasedCredentialProvider provides credentials for registries.
func (*FilebasedCredentialProvider) GetCredential ¶
func (fcp *FilebasedCredentialProvider) GetCredential(name string) (*common.RegistryCredential, error)
GetCredential returns a credential by name.
func (*FilebasedCredentialProvider) SetCredential ¶
func (fcp *FilebasedCredentialProvider) SetCredential(name string, credential *common.RegistryCredential) error
SetCredential sets a credential by name.
type GCSRegistry ¶
type GCSRegistry struct {
// contains filtered or unexported fields
}
GCSRegistry implements the ObbectStorageRegistry interface and implements a Deployment Manager templates registry.
A registry root must be a directory that contains all the available charts, one or two files per template. name-version.tgz name-version.prov
func NewGCSRegistry ¶
func NewGCSRegistry(name, shortURL string, httpClient *http.Client, gcsService *storage.Service) (*GCSRegistry, error)
NewGCSRegistry creates a GCS registry.
func (GCSRegistry) GetBucket ¶
func (g GCSRegistry) GetBucket() string
GetBucket returns the registry bucket.
func (GCSRegistry) GetDownloadURLs ¶
func (g GCSRegistry) GetDownloadURLs(t Type) ([]*url.URL, error)
GetDownloadURLs fetches the download URLs for a given Chart
func (GCSRegistry) GetRegistryFormat ¶
func (g GCSRegistry) GetRegistryFormat() common.RegistryFormat
GetRegistryFormat returns the registry format.
func (GCSRegistry) GetRegistryName ¶
func (g GCSRegistry) GetRegistryName() string
GetRegistryName returns the name of the registry.
func (GCSRegistry) GetRegistryShortURL ¶
func (g GCSRegistry) GetRegistryShortURL() string
GetRegistryShortURL returns the short URL for the registry.
func (GCSRegistry) GetRegistryType ¶
func (g GCSRegistry) GetRegistryType() common.RegistryType
GetRegistryType returns the registry type.
type GCSRegistryProvider ¶
type GCSRegistryProvider interface {
GetGCSRegistry(cr common.Registry) (ObjectStorageRegistry, error)
}
GCSRegistryProvider is a factory for GCS Registry instances.
func NewGCSRegistryProvider ¶
func NewGCSRegistryProvider(cp common.CredentialProvider) GCSRegistryProvider
NewGCSRegistryProvider creates a GCSRegistryProvider.
func NewTestGCSRegistryProvider ¶
func NewTestGCSRegistryProvider(shortURL string, responses map[Type]TestURLAndError) GCSRegistryProvider
NewTestGCSRegistryProvider creates a test GCS registry provider.
type GithubPackageRegistry ¶
type GithubPackageRegistry struct {
// contains filtered or unexported fields
}
GithubPackageRegistry implements the Registry interface that talks to github and expects packages in helm format without versioning and no collection in the path. Format of the directory for a type is like so: package/
Chart.yaml manifests/ foo.yaml bar.yaml ...
func NewGithubPackageRegistry ¶
func NewGithubPackageRegistry(name, shortURL string, service GithubRepositoryService, httpClient *http.Client, client *github.Client) (*GithubPackageRegistry, error)
NewGithubPackageRegistry creates a GithubPackageRegistry.
func (GithubPackageRegistry) GetDownloadURLs ¶
func (g GithubPackageRegistry) GetDownloadURLs(t Type) ([]*url.URL, error)
GetDownloadURLs fetches the download URLs for a given Type.
func (GithubPackageRegistry) GetRegistryFormat ¶
func (g GithubPackageRegistry) GetRegistryFormat() common.RegistryFormat
GetRegistryFormat returns the format of this registry.
func (GithubPackageRegistry) GetRegistryName ¶
func (g GithubPackageRegistry) GetRegistryName() string
GetRegistryName returns the name of this registry
func (GithubPackageRegistry) GetRegistryOwner ¶
func (g GithubPackageRegistry) GetRegistryOwner() string
GetRegistryOwner returns the owner name for this registry
func (GithubPackageRegistry) GetRegistryPath ¶
func (g GithubPackageRegistry) GetRegistryPath() string
GetRegistryName returns the name of this registry
func (GithubPackageRegistry) GetRegistryRepository ¶
func (g GithubPackageRegistry) GetRegistryRepository() string
GetRegistryRepository returns the repository name for this registry.
func (GithubPackageRegistry) GetRegistryShortURL ¶
func (g GithubPackageRegistry) GetRegistryShortURL() string
GetRegistryShortURL returns the short URL for this registry.
func (GithubPackageRegistry) GetRegistryType ¶
func (g GithubPackageRegistry) GetRegistryType() common.RegistryType
GetRegistryType returns the type of this registry.
func (GithubPackageRegistry) ListTypes ¶
func (g GithubPackageRegistry) ListTypes(regex *regexp.Regexp) ([]Type, error)
ListTypes lists types in this registry whose string values conform to the supplied regular expression, or all types, if the regular expression is nil.
func (GithubPackageRegistry) MakeRepositoryPath ¶
func (g GithubPackageRegistry) MakeRepositoryPath(t Type) (string, error)
MakeRepositoryPath constructs a github path to a given type based on a repository, and type name. The returned repository path will be of the form: Type.Name/manifests
type GithubRegistry ¶
type GithubRegistry interface { Registry // A GithubRegistry is a Registry. // GetRegistryOwner returns the owner name for this registry GetRegistryOwner() string // GetRegistryRepository returns the repository name for this registry. GetRegistryRepository() string // GetRegistryPath returns the path to the registry in the repository. GetRegistryPath() string }
GithubRegistry abstracts a registry that resides in a Github repository.
type GithubRegistryProvider ¶
type GithubRegistryProvider interface {
GetGithubRegistry(cr common.Registry) (GithubRegistry, error)
}
GithubRegistryProvider is a factory for GithubRegistry instances.
func NewGithubRegistryProvider ¶
func NewGithubRegistryProvider(cp common.CredentialProvider) GithubRegistryProvider
NewGithubRegistryProvider creates a GithubRegistryProvider.
func NewTestGithubRegistryProvider ¶
func NewTestGithubRegistryProvider(shortURL string, responses map[Type]TestURLAndError) GithubRegistryProvider
NewTestGithubRegistryProvider creates a test github registry provider.
func NewTestGithubRegistryProviderWithDownloads ¶
func NewTestGithubRegistryProviderWithDownloads(shortURL string, responses map[Type]TestURLAndError, downloadResponses map[string]DownloadResponse) GithubRegistryProvider
NewTestGithubRegistryProviderWithDownloads creates a test github registry provider with download responses.
type GithubRepositoryService ¶
type GithubRepositoryService interface { GetContents( owner, repo, path string, opt *github.RepositoryContentGetOptions, ) ( fileContent *github.RepositoryContent, directoryContent []*github.RepositoryContent, resp *github.Response, err error, ) }
GithubRepositoryService defines the interface that's defined in github.com/go-github/repos_contents.go GetContents method.
type GithubTemplateRegistry ¶
type GithubTemplateRegistry struct {
// contains filtered or unexported fields
}
GithubTemplateRegistry implements the Registry interface and implements a Deployment Manager templates registry. A registry root must be a directory that contains all the available templates, one directory per template. Each template directory then contains version directories, each of which in turn contains all the files necessary for that version of the template.
For example, a template registry containing two versions of redis (implemented in jinja), and one version of replicatedservice (implemented in python) would have a directory structure that looks something like this: qualifier [optional] prefix to a virtual root within the repository. /redis
/v1 redis.jinja redis.jinja.schema /v2 redis.jinja redis.jinja.schema
/replicatedservice
/v1 replicatedservice.python replicatedservice.python.schema
func NewGithubTemplateRegistry ¶
func NewGithubTemplateRegistry(name, shortURL string, service GithubRepositoryService, httpClient *http.Client, client *github.Client) (*GithubTemplateRegistry, error)
NewGithubTemplateRegistry creates a GithubTemplateRegistry.
func (GithubTemplateRegistry) GetDownloadURLs ¶
func (g GithubTemplateRegistry) GetDownloadURLs(t Type) ([]*url.URL, error)
GetDownloadURLs fetches the download URLs for a given Type and checks for existence of a schema file.
func (GithubTemplateRegistry) GetRegistryFormat ¶
func (g GithubTemplateRegistry) GetRegistryFormat() common.RegistryFormat
GetRegistryFormat returns the format of this registry.
func (GithubTemplateRegistry) GetRegistryName ¶
func (g GithubTemplateRegistry) GetRegistryName() string
GetRegistryName returns the name of this registry
func (GithubTemplateRegistry) GetRegistryOwner ¶
func (g GithubTemplateRegistry) GetRegistryOwner() string
GetRegistryOwner returns the owner name for this registry
func (GithubTemplateRegistry) GetRegistryPath ¶
func (g GithubTemplateRegistry) GetRegistryPath() string
GetRegistryName returns the name of this registry
func (GithubTemplateRegistry) GetRegistryRepository ¶
func (g GithubTemplateRegistry) GetRegistryRepository() string
GetRegistryRepository returns the repository name for this registry.
func (GithubTemplateRegistry) GetRegistryShortURL ¶
func (g GithubTemplateRegistry) GetRegistryShortURL() string
GetRegistryShortURL returns the short URL for this registry.
func (GithubTemplateRegistry) GetRegistryType ¶
func (g GithubTemplateRegistry) GetRegistryType() common.RegistryType
GetRegistryType returns the type of this registry.
func (GithubTemplateRegistry) ListTypes ¶
func (g GithubTemplateRegistry) ListTypes(regex *regexp.Regexp) ([]Type, error)
ListTypes lists types in this registry whose string values conform to the supplied regular expression, or all types, if the regular expression is nil.
func (GithubTemplateRegistry) MakeRepositoryPath ¶
func (g GithubTemplateRegistry) MakeRepositoryPath(t Type) (string, error)
MakeRepositoryPath constructs a github path to a given type based on a repository, and type name and version. The returned repository path will be of the form: [GithubTemplateRegistry.path/][Type.Collection]/Type.Name/Type.Version Type.Collection will be mapped using mapCollection in the future, for now it's a straight 1:1 mapping (if given)
type InmemCredentialProvider ¶
type InmemCredentialProvider struct {
// contains filtered or unexported fields
}
InmemCredentialProvider is a memory based credential provider.
func (*InmemCredentialProvider) GetCredential ¶
func (fcp *InmemCredentialProvider) GetCredential(name string) (*common.RegistryCredential, error)
GetCredential returns a credential by name.
func (*InmemCredentialProvider) SetCredential ¶
func (fcp *InmemCredentialProvider) SetCredential(name string, credential *common.RegistryCredential) error
SetCredential sets a credential by name.
type NamedRegistryCredential ¶
type NamedRegistryCredential struct { Name string `json:"name,omitempty"` common.RegistryCredential }
NamedRegistryCredential associates a name with a RegistryCredential.
type ObjectStorageRegistry ¶
type ObjectStorageRegistry interface { Registry // An ObjectStorageRegistry is a Registry. GetBucket() string }
ObjectStorageRegistry abstracts a registry that resides in an Object Storage, for example Google Cloud Storage or AWS S3, etc.
type Registry ¶
type Registry interface { // Also handles http.Client.Do method for authenticated File accesses util.HTTPDoer // GetRegistryName returns the name of this registry GetRegistryName() string // GetRegistryType returns the type of this registry. GetRegistryType() common.RegistryType // GetRegistryShortURL returns the short URL for this registry. GetRegistryShortURL() string // GetRegistryFormat returns the format of this registry. GetRegistryFormat() common.RegistryFormat // ListTypes lists types in this registry whose string values conform to the // supplied regular expression, or all types, if the regular expression is nil. ListTypes(regex *regexp.Regexp) ([]Type, error) // GetDownloadURLs returns the URLs required to download the type contents. GetDownloadURLs(t Type) ([]*url.URL, error) }
Registry abstracts a registry that holds charts, which can be used in a Deployment Manager configuration. There can be multiple registry implementations.
func GetDownloadURLs ¶
func GetDownloadURLs(rp RegistryProvider, t string) ([]string, Registry, error)
GetDownloadURLs checks a type to see if it is either a short git hub url or a fully specified URL and returns the URLs that should be used to fetch it. If the url is not fetchable (primitive type for example), it returns an empty slice.
func ShortTypeToDownloadURLs ¶
func ShortTypeToDownloadURLs(rp RegistryProvider, t string) ([]string, Registry, error)
ShortTypeToDownloadURLs converts a github URL into downloadable URL from github. Input must be of the type and is assumed to have been validated before this call: github.com/owner/repo/qualifier/type:version for example: github.com/kubernetes/application-dm-templates/storage/redis:v1
func ShortTypeToGCSDownloadUrls ¶
func ShortTypeToGCSDownloadUrls(rp RegistryProvider, t string) ([]string, Registry, error)
ShortTypeToGCSDownloadUrls returns the download URLs for a short type name.
func ShortTypeToPackageDownloadURLs ¶
func ShortTypeToPackageDownloadURLs(rp RegistryProvider, t string) ([]string, Registry, error)
ShortTypeToPackageDownloadURLs converts a github URL into downloadable URLs from github. Input must be of the type and is assumed to have been validated before this call: github.com/owner/repo/type for example: github.com/helm/charts/cassandra
type RegistryProvider ¶
type RegistryProvider interface { GetRegistryByShortURL(URL string) (Registry, error) GetRegistryByName(registryName string) (Registry, error) }
RegistryProvider is a factory for Registry instances.
func NewDefaultRegistryProvider ¶
func NewDefaultRegistryProvider(cp common.CredentialProvider, rs common.RegistryService) RegistryProvider
NewDefaultRegistryProvider creates a default registry provider with the supplied credential.
func NewRegistryProvider ¶
func NewRegistryProvider(rs common.RegistryService, grp GithubRegistryProvider, gcsrp GCSRegistryProvider, cp common.CredentialProvider) RegistryProvider
NewRegistryProvider creates a new registry provider using the supplied arguments.
type SecretsCredentialProvider ¶
type SecretsCredentialProvider struct {
// contains filtered or unexported fields
}
SecretsCredentialProvider provides credentials for registries from Kubernertes secrets.
func (*SecretsCredentialProvider) GetCredential ¶
func (scp *SecretsCredentialProvider) GetCredential(name string) (*common.RegistryCredential, error)
GetCredential returns a credential by name.
func (*SecretsCredentialProvider) SetCredential ¶
func (scp *SecretsCredentialProvider) SetCredential(name string, credential *common.RegistryCredential) error
SetCredential sets a credential by name.
type SemVer ¶
SemVer holds a semantic version as defined by semver.io.
func ParseSemVer ¶
ParseSemVer parses a semantic version string.
type TestURLAndError ¶
TestURLAndError associates a URL with an error string for testing.
type Type ¶
Type describes a type stored in a registry.
func NewTypeOrDie ¶
NewTypeOrDie initializes a type and panics if initialization fails
func ParseType ¶
ParseType takes a registry type string and parses it into a *registry.Type. TODO: needs better validation that this is actually a registry type.
func (Type) GetVersion ¶
GetVersion returns the type version with the letter "v" prepended.
func (*Type) SetVersion ¶
SetVersion strips the letter "v" from version, if present, and sets the the version of the type to the result.