Documentation ¶
Index ¶
- Variables
- func GetDownloadURLs(rp RegistryProvider, t string) ([]string, error)
- 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
- func ShortTypeToDownloadURLs(rp RegistryProvider, t string) ([]string, error)
- func ShortTypeToPackageDownloadURLs(rp RegistryProvider, t string) ([]string, error)
- type FilebasedCredentialProvider
- type GithubPackageRegistry
- 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
- type GithubRepositoryService
- type GithubTemplateRegistry
- 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 Registry
- type RegistryProvider
- type SecretsCredentialProvider
- type SemVer
- type TestURLAndError
- type Type
Constants ¶
This section is empty.
Variables ¶
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.
Functions ¶
func GetDownloadURLs ¶
func GetDownloadURLs(rp RegistryProvider, t string) ([]string, 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 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)
func NewInmemCredentialProvider ¶
func NewInmemCredentialProvider() common.CredentialProvider
func NewInmemRegistryService ¶
func NewInmemRegistryService() common.RegistryService
func NewSecretsCredentialProvider ¶
func NewSecretsCredentialProvider() common.CredentialProvider
func ParseRegistryFormat ¶
func ParseRegistryFormat(rf common.RegistryFormat) map[common.RegistryFormat]bool
func ShortTypeToDownloadURLs ¶
func ShortTypeToDownloadURLs(rp RegistryProvider, t string) ([]string, 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 ShortTypeToPackageDownloadURLs ¶
func ShortTypeToPackageDownloadURLs(rp RegistryProvider, t string) ([]string, 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
Types ¶
type FilebasedCredentialProvider ¶
type FilebasedCredentialProvider struct {
// contains filtered or unexported fields
}
CredentialProvider provides credentials for registries.
func (*FilebasedCredentialProvider) GetCredential ¶
func (fcp *FilebasedCredentialProvider) GetCredential(name string) (*common.RegistryCredential, error)
func (*FilebasedCredentialProvider) SetCredential ¶
func (fcp *FilebasedCredentialProvider) SetCredential(name string, credential *common.RegistryCredential) error
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, 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
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, 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
}
func (*InmemCredentialProvider) GetCredential ¶
func (fcp *InmemCredentialProvider) GetCredential(name string) (*common.RegistryCredential, error)
func (*InmemCredentialProvider) SetCredential ¶
func (fcp *InmemCredentialProvider) SetCredential(name string, credential *common.RegistryCredential) error
type NamedRegistryCredential ¶
type NamedRegistryCredential struct { Name string `json:"name,omitempty"` common.RegistryCredential }
type Registry ¶
type Registry interface { // 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.
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) RegistryProvider
func NewRegistryProvider ¶
func NewRegistryProvider(rs common.RegistryService, grp GithubRegistryProvider, cp common.CredentialProvider) RegistryProvider
type SecretsCredentialProvider ¶
type SecretsCredentialProvider struct {
// contains filtered or unexported fields
}
CredentialProvider provides credentials for registries.
func (*SecretsCredentialProvider) GetCredential ¶
func (scp *SecretsCredentialProvider) GetCredential(name string) (*common.RegistryCredential, error)
func (*SecretsCredentialProvider) SetCredential ¶
func (scp *SecretsCredentialProvider) SetCredential(name string, credential *common.RegistryCredential) error
type SemVer ¶
func ParseSemVer ¶
type TestURLAndError ¶
type Type ¶
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.