Documentation
¶
Index ¶
- type ApplicationBuilder
- type ApplicationRequest
- type ClusterBuilder
- type ClusterImageSource
- type ClusterRequest
- type Config
- type Engine
- func (b *Engine) Close() error
- func (b *Engine) CreateApplication(data io.ReadCloser) (*app.Application, error)
- func (b *Engine) GenerateInstaller(manifest *schema.Manifest, application app.Application) (io.ReadCloser, error)
- func (b *Engine) SelectRuntime(manifest *schema.Manifest) (*semver.Version, error)
- func (b *Engine) SyncPackageCache(manifest *schema.Manifest, runtimeVersion *semver.Version) error
- func (b *Engine) Vendor(ctx context.Context, req VendorRequest) (io.ReadCloser, error)
- func (b *Engine) WriteInstaller(data io.ReadCloser, outPath string) error
- type Generator
- type GetRepositoryFunc
- type NewSyncerFunc
- type PackSyncer
- type Syncer
- type VendorRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApplicationBuilder ¶
type ApplicationBuilder struct {
// contains filtered or unexported fields
}
ApplicationBuilder builds an application image
func NewApplicationBuilder ¶
func NewApplicationBuilder(config Config) (*ApplicationBuilder, error)
NewApplicationBuilder returns a builder that produces application images.
func (*ApplicationBuilder) Build ¶
func (b *ApplicationBuilder) Build(ctx context.Context, req ApplicationRequest) error
Build builds an application image according to the provided parameters.
func (*ApplicationBuilder) Close ¶
func (b *ApplicationBuilder) Close() error
Close closes the builder
type ApplicationRequest ¶
type ApplicationRequest struct {
// ChartPath is path to a Helm chart to build an image from.
ChartPath string
// OutputPath is the resulting cluster image output file path.
OutputPath string
// Overwrite is whether to overwrite existing output file.
Overwrite bool
// Vendor combines vendoring parameters.
Vendor service.VendorRequest
}
ApplicationRequest combines parameters for building an application image.
type ClusterBuilder ¶
type ClusterBuilder struct {
// contains filtered or unexported fields
}
func NewClusterBuilder ¶
func NewClusterBuilder(config Config) (*ClusterBuilder, error)
NewClusterBuilder returns a builder that produces cluster images.
func (*ClusterBuilder) Build ¶
func (b *ClusterBuilder) Build(ctx context.Context, req ClusterRequest) error
Build builds a cluster image according to the provided parameters.
type ClusterImageSource ¶
type ClusterImageSource interface {
// Dir is the directory where cluster image source is located.
Dir() string
// Manifest returns an appropriate cluster image manifest for this source.
Manifest() (*schema.Manifest, error)
// Type returns the source type.
Type() string
}
ClusterImageSource defines a source a cluster image can be built from.
It can be either a manifest file or a Helm chart.
func GetClusterImageSource ¶
func GetClusterImageSource(path string) (ClusterImageSource, error)
GetClusterImageSource returns appropriate cluster image source for the path.
The path is expected to be one of the following: * Cluster image manifest file. * Directory with cluster imge manifest file (app.yaml). * Helm chart directory.
type ClusterRequest ¶
type ClusterRequest struct {
// SourcePath specifies the path to build the cluster image out of.
SourcePath string
// OutputPath is the resulting cluster image output file path.
OutputPath string
// Overwrite is whether to overwrite existing output file.
Overwrite bool
// Vendor combines vendoring parameters.
Vendor service.VendorRequest
// BaseImage is optional base image provided on the command line.
BaseImage string
}
ClusterRequest combines parameters for building a cluster image.
type Config ¶
type Config struct {
// StateDir is the configured builder state directory
StateDir string
// Insecure disables client verification of the server TLS certificate chain
Insecure bool
// Repository represents the source package repository
Repository string
// SkipVersionCheck allows to skip tele/runtime compatibility check
SkipVersionCheck bool
// Parallel is the builder's parallelism level
Parallel int
// Generator is used to generate installer
Generator Generator
// NewSyncer is used to initialize package cache syncer for the builder
NewSyncer NewSyncerFunc
// GetRepository is a function that returns package source repository
GetRepository GetRepositoryFunc
// CredentialsService provides access to user credentials
CredentialsService credentials.Service
// Credentials is the credentials set on the CLI
Credentials *credentials.Credentials
// Level is the level at which the progress should be reported
Level utils.ProgressLevel
// Progress allows builder to report build progress
utils.Progress
}
Config is the builder configuration
func (*Config) CheckAndSetDefaults ¶
CheckAndSetDefaults validates builder config and fills in defaults
type Engine ¶
type Engine struct {
// Config is the builder Engine configuration.
Config
// Env is the local build environment.
Env *localenv.LocalEnvironment
// Dir is the directory where build-related data is stored.
Dir string
// Backend is the local backend.
Backend storage.Backend
// Packages is the layered package service with the local cache
// directory serving as a 'read' layer and the temporary directory
// as a 'read-write' layer.
Packages pack.PackageService
// Apps is the application service based on the layered package service.
Apps app.Applications
}
Engine is the builder engine that provides common functionality for building cluster and application images.
func (*Engine) CreateApplication ¶
func (b *Engine) CreateApplication(data io.ReadCloser) (*app.Application, error)
CreateApplication creates a Gravity application from the provided data in the local database
func (*Engine) GenerateInstaller ¶
func (b *Engine) GenerateInstaller(manifest *schema.Manifest, application app.Application) (io.ReadCloser, error)
GenerateInstaller generates an installer tarball for the specified application and returns its data as a stream
func (*Engine) SelectRuntime ¶
SelectRuntime picks an appropriate base image version for the cluster image that's being built
func (*Engine) SyncPackageCache ¶
SyncPackageCache ensures that all system dependencies are present in the local cache directory
func (*Engine) Vendor ¶
func (b *Engine) Vendor(ctx context.Context, req VendorRequest) (io.ReadCloser, error)
Vendor vendors the application images in the provided directory and returns the compressed data stream with the application data
func (*Engine) WriteInstaller ¶
func (b *Engine) WriteInstaller(data io.ReadCloser, outPath string) error
WriteInstaller writes the provided installer tarball data to disk
type Generator ¶
type Generator interface {
// Generate generates an installer tarball for the specified application
// using the provided builder and returns its data as a stream
Generate(*Engine, *schema.Manifest, app.Application) (io.ReadCloser, error)
}
Generator defines a method for generating standalone installers
type GetRepositoryFunc ¶
GetRepositoryFunc defines function that returns package source repository
type NewSyncerFunc ¶
NewSyncerFunc defines function that creates syncer for a builder
type PackSyncer ¶
type PackSyncer struct {
// contains filtered or unexported fields
}
PackSyncer synchronizes local package cache with pack/apps services
func NewPackSyncer ¶
func NewPackSyncer(pack pack.PackageService, apps app.Applications, repo string) *PackSyncer
NewPackSyncer creates a new syncer from provided pack and apps services
type Syncer ¶
type Syncer interface {
// Sync makes sure that local cache has all required dependencies for the
// selected runtime
Sync(*Engine, *schema.Manifest, *semver.Version) error
}
Syncer synchronizes the local package cache from a (remote) repository
type VendorRequest ¶
type VendorRequest struct {
// SourceDir is the cluster or application image source directory.
SourceDir string
// VendorDir is the directory to perform vendoring in.
VendorDir string
// Manifest is the image manifest.
Manifest *schema.Manifest
// Vendor is parameters of the vendorer.
Vendor service.VendorRequest
}
VendorRequest combines vendoring parameters.