Documentation ¶
Index ¶
- Constants
- func ConvertBytes(b []byte) (map[string]interface{}, error)
- func ConvertStructure(in interface{}) (map[string]interface{}, error)
- func ErrReleaseNotFound(err error) bool
- type AlreadyExistsError
- type ChartConfig
- type ChartDetails
- type ChartFilter
- func (cf ChartFilter) KeywordFilter() string
- func (cf ChartFilter) NameFilter() string
- func (cf ChartFilter) RepoFilter() string
- func (cf ChartFilter) StrictNameFilter() string
- func (cf ChartFilter) StrictRepoFilter() string
- func (cf ChartFilter) StrictVersionFilter() string
- func (cf ChartFilter) String() string
- func (cf ChartFilter) VersionFilter() string
- type ChartList
- type ChartNotFoundError
- type ClusterDataProvider
- type ClusterKubeConfigFunc
- type ClusterService
- type Config
- type DetailedRelease
- type EnvReconciler
- type EnvResolver
- type EnvService
- type HelmEnv
- type KubeConfigBytes
- type ListerUninstaller
- type Logger
- type NotFoundError
- type Options
- type OrgService
- type PasswordSecret
- type Release
- type ReleaseDeleter
- type ReleaseFilter
- type ReleaseInfo
- type ReleaseResource
- type ReleaseSecurityInfo
- type Releaser
- type RepoValidator
- type RepoValidators
- type Repository
- type RestAPI
- type SecretStore
- type SecurityInfoService
- type Service
- type Store
- type TlsSecret
- type UnifiedReleaser
- type ValidationError
Constants ¶
const (
PlatformHelmHome = "platform"
)
Variables ¶
This section is empty.
Functions ¶
func ConvertBytes ¶
func ConvertStructure ¶
func ErrReleaseNotFound ¶
Types ¶
type AlreadyExistsError ¶
AlreadyExistsError is returned when a helm repository already exists in the store.
func (AlreadyExistsError) Conflict ¶
func (AlreadyExistsError) Conflict() bool
Conflict tells the consumer that this error is related to a conflicting request. Can be used to translate the error to the consumer's response format (eg. status codes).
func (AlreadyExistsError) Details ¶
func (e AlreadyExistsError) Details() []interface{}
Details returns error details.
func (AlreadyExistsError) Error ¶
func (e AlreadyExistsError) Error() string
Error implements the error interface.
func (AlreadyExistsError) ServiceError ¶
func (AlreadyExistsError) ServiceError() bool
ServiceError tells the consumer that this is a business error and it should be returned to the client. Non-service errors are usually translated into "internal" errors.
type ChartConfig ¶
type ChartConfig struct { Name string `json:"name" mapstructure:"name" yaml:"name"` Version string `json:"version" mapstructure:"version" yaml:"version"` Repository string `json:"repository" mapstructure:"repository" yaml:"repository"` Values map[string]interface{} `json:"values,omitempty" mapstructure:"values,omitempty" yaml:"values,omitempty"` NonChartValues map[string]interface{} `json:"nonChartValues,omitempty" mapstructure:"nonChartValues,omitempty" yaml:"nonChartValues,omitempty"` }
ChartConfig describes a Helm chart configuration.
func (ChartConfig) IsLessThan ¶
func (config ChartConfig) IsLessThan(otherConfig ChartConfig) bool
IsLessThan determines whether the receiver is ordered less than the specified chart config.
type ChartDetails ¶
type ChartDetails map[string]interface{}
decouples helm lib types from the api
func (ChartDetails) GetDescription ¶
func (c ChartDetails) GetDescription(version string) (string, error)
type ChartFilter ¶
ChartFilter filter data for chart retrieval all fields are slices in order to support forthcoming filtering on multiple values Filter values are expected to be used through functions
func (ChartFilter) KeywordFilter ¶
func (cf ChartFilter) KeywordFilter() string
func (ChartFilter) NameFilter ¶
func (cf ChartFilter) NameFilter() string
func (ChartFilter) RepoFilter ¶
func (cf ChartFilter) RepoFilter() string
RepoFilter gets the string filter eventually trims leading and trailing regexp chars
func (ChartFilter) StrictNameFilter ¶
func (cf ChartFilter) StrictNameFilter() string
func (ChartFilter) StrictRepoFilter ¶
func (cf ChartFilter) StrictRepoFilter() string
StrictRepoFilter wraps the filter with regexp markers for exact match
func (ChartFilter) StrictVersionFilter ¶
func (cf ChartFilter) StrictVersionFilter() string
func (ChartFilter) String ¶
func (cf ChartFilter) String() string
func (ChartFilter) VersionFilter ¶
func (cf ChartFilter) VersionFilter() string
type ChartNotFoundError ¶
ChartNotFoundError signals that the chart is not found
func (ChartNotFoundError) Details ¶
func (e ChartNotFoundError) Details() []interface{}
func (ChartNotFoundError) Error ¶
func (e ChartNotFoundError) Error() string
func (ChartNotFoundError) NotFound ¶
func (ChartNotFoundError) NotFound() bool
func (ChartNotFoundError) ServiceError ¶
func (ChartNotFoundError) ServiceError() bool
type ClusterDataProvider ¶
type ClusterKubeConfigFunc ¶
func (ClusterKubeConfigFunc) GetKubeConfig ¶
type ClusterService ¶
type ClusterService interface { // Retrieves the kuebernetes configuration as a slice of bytes GetKubeConfig(ctx context.Context, clusterID uint) ([]byte, error) }
Cluster collects operations to extract cluster related information
type DetailedRelease ¶
type DetailedRelease struct { Release Supported bool `json:"supported"` Whitelisted bool `json:"whitelisted"` Rejected bool `json:"rejected"` }
DetailedRelease wraps a release and adds additional information to it
type EnvReconciler ¶
EnvReconciler component interface for reconciling helm environments
func NewBuiltinEnvReconciler ¶
func NewBuiltinEnvReconciler(builtinRepos map[string]string, envService EnvService, logger Logger) EnvReconciler
NewBuiltinEnvReconciler creates a new platform helm env reconciler instance
type EnvResolver ¶
type EnvResolver interface { // ResolveHelmEnv resolves the helm home for the passed in organization ID // if the orgName parameter is empty the platform helm env home is returned ResolveHelmEnv(ctx context.Context, organizationID uint) (HelmEnv, error) // ResolvePlatformEnv resolves the helm environment dedicated for the platform user ResolvePlatformEnv(ctx context.Context) (HelmEnv, error) }
HelmEnvResolver interface to abstract resolving helm homes
func NewEnsuringEnvResolver ¶
func NewEnsuringEnvResolver(envResolver EnvResolver, envService EnvService, store Store, defaultRepos map[string]string, logger Logger) EnvResolver
func NewHelm3EnvResolver ¶
func NewHelm3EnvResolver(helmHomesDir string, orgService OrgService, logger Logger) EnvResolver
type EnvService ¶
type EnvService interface { // AddRepository adds a new Helm chart repository. AddRepository(ctx context.Context, helmEnv HelmEnv, repository Repository) error // ListRepositories lists Helm repositories. ListRepositories(ctx context.Context, helmEnv HelmEnv) (repos []Repository, err error) // ListRepositories deletes a Helm repository DeleteRepository(ctx context.Context, helmEnv HelmEnv, repoName string) error // PatchRepository patches an existing repository PatchRepository(ctx context.Context, helmEnv HelmEnv, repository Repository) error // UpdateRepository updates an existing repository UpdateRepository(ctx context.Context, helmEnv HelmEnv, repository Repository) error // ListCharts lists charts matching the given filter ListCharts(ctx context.Context, helmEnv HelmEnv, chartFilter ChartFilter) (chartList ChartList, err error) // GetChart retrieves the details of the passed in chart GetChart(ctx context.Context, helmEnv HelmEnv, chartFilter ChartFilter) (chartDetails ChartDetails, err error) // CheckReleaseCharts checks whether the charts for the passed in release can be found in the org's helm env CheckReleaseCharts(ctx context.Context, helmEnv HelmEnv, releases []Release) (map[string]bool, error) // EnsureEnv ensures the helm environment represented by the input. // If theh environment exists (on the filesystem) it does nothing EnsureEnv(ctx context.Context, helmEnv HelmEnv, defaultRepos []Repository) (HelmEnv, bool, error) }
Service manages Helm chart repositories.
type HelmEnv ¶
type HelmEnv struct {
// contains filtered or unexported fields
}
HelmEnv helm environment settings abstraction
func (HelmEnv) GetCacheDir ¶
func (HelmEnv) GetRepoCache ¶
func (HelmEnv) IsPlatform ¶
type KubeConfigBytes ¶
type KubeConfigBytes = []byte
type ListerUninstaller ¶
type NotFoundError ¶
func (NotFoundError) Details ¶
func (e NotFoundError) Details() []interface{}
Details returns error details.
func (NotFoundError) Error ¶
func (e NotFoundError) Error() string
Error implements the error interface.
func (NotFoundError) NotFound ¶
func (NotFoundError) NotFound() bool
func (NotFoundError) ServiceError ¶
func (NotFoundError) ServiceError() bool
ServiceError tells the consumer that this is a business error and it should be returned to the client. Non-service errors are usually translated into "internal" errors.
type Options ¶
type Options struct { Namespace string `json:"namespace,omitempty"` DryRun bool `json:"dryRun,omitempty"` GenerateName bool `json:"generateName,omitempty"` Wait bool `json:"wait,omitempty"` Timeout int64 `json:"timeout,omitempty"` ReuseValues bool `json:"reuseValues,omitempty"` Install bool `json:"install,omitempty"` Filter *string `json:"filter,omitempty"` SkipCRDs bool `json:"skipCRDs,omitempty"` }
Options struct holding directives for driving helm operations (similar to command line flags) extend this as required eventually build a more sophisticated solution for it
type OrgService ¶
type OrgService interface { // GetOrgNameByOrgID retrieves organization name for the provided ID GetOrgNameByOrgID(ctx context.Context, orgID uint) (string, error) }
OrgService interface for decoupling organization related operations
type PasswordSecret ¶
type Release ¶
type Release struct { // ReleaseInput struct encapsulating information about the release to be created ReleaseName string ChartName string Namespace string Values map[string]interface{} // json representation Version string ReleaseInfo ReleaseInfo ReleaseVersion int32 ReleaseResources []ReleaseResource }
Release represents information related to a helm chart release
func (Release) NameAndChartSlice ¶
utility for providing input arguments ...
type ReleaseDeleter ¶
type ReleaseDeleter interface { // DeleteReleases deletes all releases in the provided namespaces; all namespaces are considered when no namespaces provided DeleteReleases(ctx context.Context, orgID uint, kubeConfig []byte, namespaces []string) error }
ReleaseDeleter abstraction of the operations
type ReleaseFilter ¶
type ReleaseFilter struct { TagFilter string `json:"tag" mapstructure:"tag"` Filter *string `json:"filter,omitempty" mapstructure:"filter"` }
ReleaseFilter struct for release filter data
type ReleaseInfo ¶
type ReleaseInfo struct { // FirstDeployed is when the release was first deployed. FirstDeployed time.Time `json:"first_deployed,omitempty"` // LastDeployed is when the release was last deployed. LastDeployed time.Time `json:"last_deployed,omitempty"` // Deleted tracks when this object was deleted. Deleted time.Time `json:"deleted"` // Description is human-friendly "log entry" about this release. Description string `json:"description,omitempty"` // Status is the current state of the release Status string // Contains the rendered templates/NOTES.txt if available Notes string // Contains override values provided to the release Values map[string]interface{} }
ReleaseInfo copy of the struct form the helm library
type ReleaseResource ¶
type ReleaseSecurityInfo ¶
type Releaser ¶
type Releaser interface { // Install installs the specified chart using to a cluster identified by the kubeConfig argument Install(ctx context.Context, helmEnv HelmEnv, kubeConfig KubeConfigBytes, releaseInput Release, options Options) (Release, error) // Uninstall removes the specified release from the cluster Uninstall(ctx context.Context, helmEnv HelmEnv, kubeConfig KubeConfigBytes, releaseName string, options Options) error // List lists releases List(ctx context.Context, helmEnv HelmEnv, kubeConfig KubeConfigBytes, options Options) ([]Release, error) // Get gets the given release details Get(ctx context.Context, helmEnv HelmEnv, kubeConfig KubeConfigBytes, releaseInput Release, options Options) (Release, error) // Upgrade upgrades the given release Upgrade(ctx context.Context, helmEnv HelmEnv, kubeConfig KubeConfigBytes, releaseInput Release, options Options) (release Release, err error) // Resources retrieves the kubernetes resources belonging to the release Resources(ctx context.Context, helmEnv HelmEnv, kubeConfig KubeConfigBytes, releaseInput Release, options Options) ([]ReleaseResource, error) }
Releaser interface collecting operations related to releases It manages releases on the cluster
type RepoValidator ¶
type RepoValidator interface { // Validate performs helpm repository validation Validate(ctx context.Context, repository Repository) error }
RepoValidator interface for helm repository validation
func NewHelmRepoValidator ¶
func NewHelmRepoValidator() RepoValidator
NewHelmRepoValidator creates a new helm repo validator
type RepoValidators ¶
type RepoValidators []RepoValidator
Composite validator type
func (RepoValidators) Validate ¶
func (r RepoValidators) Validate(ctx context.Context, repository Repository) error
type Repository ¶
type Repository struct { // Name is a unique identifier for the repository. Name string `json:"name"` // URL is the repository URL. URL string `json:"url"` // PasswordSecretID is the identifier of a password type secret that contains the credentials for a repository. PasswordSecretID string `json:"passwordSecretId,omitempty"` // TlsSecretID is the identifier of a TLS secret. // // If there is a Certificate Authority in the secret, // it will be used to verify the certificate presented by the repository server. // // If there is a client key pair in the secret, // it will be presented to the repository server. TlsSecretID string `json:"tlsSecretId,omitempty"` }
Repository represents a Helm chart repository.
type RestAPI ¶
type RestAPI interface { // Gets releases and decorates the re GetReleases(ctx context.Context, organizationID uint, clusterID uint, filters ReleaseFilter, options Options) (releaseList []DetailedRelease, err error) }
HelmAPI interface intended to gather all the helm operations exposed as rest services The abstraction layer is intended to aggregate information from different specialized components TODO move all exposed operations to this interface (currently the Service interface methods are exposed)
func NewRestAPIService ¶
func NewRestAPIService(helmService Service, securityInfoService SecurityInfoService) RestAPI
type SecretStore ¶
type SecretStore interface { // CheckPasswordSecret checks the existence and the type of the secret CheckPasswordSecret(ctx context.Context, secretID string) error // CheckTLSSecret checks the existence and the type of the secret CheckTLSSecret(ctx context.Context, secretID string) error // ResolvePasswordSecrets resolves the password type secret values ResolvePasswordSecrets(ctx context.Context, secretID string) (PasswordSecret, error) // ResolveTlsSecrets resolves the tls type secret values ResolveTlsSecrets(ctx context.Context, secretID string) (TlsSecret, error) }
SecretStore abstracts secret related operations
type SecurityInfoService ¶
type SecurityInfoService interface { // GetSecurityInfo gets security information for the provided releases GetSecurityInfo(ctx context.Context, clusterId uint, releases []Release) (map[string]ReleaseSecurityInfo, error) }
SecurityInfoService provides security resource information for releases
type Service ¶
type Service interface {
// contains filtered or unexported methods
}
Service manages Helm repositories, charts and releases
func NewService ¶
func NewService( config Config, clusterCharts []ChartConfig, store Store, secretStore SecretStore, validator RepoValidator, envResolver EnvResolver, envService EnvService, releaser Releaser, clusterService ClusterService, logger Logger, ) Service
NewService returns a new Service.
type Store ¶
type Store interface { // Create persists the repository item for the given organisation Create(ctx context.Context, organizationID uint, repository Repository) error // Delete persists the repository item for the given organisation Delete(ctx context.Context, organizationID uint, repository Repository) error // List retrieves persisted repositories for the given organisation List(ctx context.Context, organizationID uint) ([]Repository, error) // Getretrieves a repository entry Get(ctx context.Context, organizationID uint, repository Repository) (Repository, error) // Update patches the given repository Update(ctx context.Context, organizationID uint, repository Repository) error }
Store interface abstracting persistence operations
type UnifiedReleaser ¶
type UnifiedReleaser interface { // integrated services style ApplyDeployment( ctx context.Context, clusterID uint, namespace string, chartName string, releaseName string, values []byte, upgradeschartVersion string, ) error ApplyDeploymentReuseValues( ctx context.Context, clusterID uint, namespace string, chartName string, releaseName string, values []byte, chartVersion string, reuseValues bool, ) error ApplyDeploymentSkipCRDs( ctx context.Context, clusterID uint, namespace string, chartName string, releaseName string, values []byte, upgradeschartVersion string, ) error // cluster setup style InstallDeployment( ctx context.Context, clusterID uint, namespace string, chartName string, releaseName string, values []byte, chartVersion string, wait bool, ) error // DeleteDeployment deletes a deployment from a specific cluster. DeleteDeployment(ctx context.Context, clusterID uint, releaseName, namespace string) error // GetDeployment gets a deployment by release name from a specific cluster. GetDeployment(ctx context.Context, clusterID uint, releaseName, namespace string) (*pkgHelm.GetDeploymentResponse, error) // Covers Federation and Backyards style implementation InstallOrUpgrade( orgID uint, c ClusterDataProvider, release Release, opts Options, ) error GetRelease(c ClusterDataProvider, releaseName, namespace string) (Release, error) Delete(c ClusterDataProvider, releaseName, namespace string) error }
UnifiedReleaser unifies different helm release interfaces into a single interface
type ValidationError ¶
type ValidationError struct {
// contains filtered or unexported fields
}
ValidationError is returned when a request is semantically invalid.
func NewValidationError ¶
func NewValidationError(message string, violations []string) ValidationError
NewValidationError returns a new ValidationError.
func (ValidationError) Error ¶
func (e ValidationError) Error() string
Error implements the error interface.
func (ValidationError) ServiceError ¶
func (ValidationError) ServiceError() bool
ServiceError tells the consumer whether this error is caused by invalid input supplied by the client. Client errors are usually returned to the consumer without retrying the operation.
func (ValidationError) Validation ¶
func (ValidationError) Validation() bool
Validation tells a client that this error is related to a semantic validation of the request. Can be used to translate the error to status codes for example.
func (ValidationError) Violations ¶
func (e ValidationError) Violations() []string
Violations returns details of the failed validation.