Documentation ¶
Index ¶
- Constants
- func ApplyTerraform(app *v1alpha2.Application, k8sClient client.Client, ioStream util.IOStreams, ...) ([]v1alpha2.ApplicationComponent, error)
- func BuildRun(ctx context.Context, app *api.Application, client client.Client, ...) error
- func CreateOrUpdateApplication(ctx context.Context, client client.Client, app *v1alpha2.Application) error
- func CreateOrUpdateObjects(ctx context.Context, client client.Client, objects []oam.Object) error
- func Delete(envName, appName string) error
- func GetAppConfig(ctx context.Context, c client.Client, app *api.Application, env *types.EnvMeta) (*v1alpha2.ApplicationConfiguration, error)
- func GetApplication(ctx context.Context, c client.Client, app *api.Application, env *types.EnvMeta) (*v1alpha2.Application, error)
- func GetComponents(app *api.Application) []string
- func GetServiceConfig(app *api.Application, componentName string) (string, map[string]interface{})
- func GetTraits(app *api.Application, componentName string) (map[string]map[string]interface{}, error)
- func GetTraitsByType(app *api.Application, componentName, traitType string) (map[string]interface{}, error)
- func GetWorkload(app *api.Application, componentName string) (string, map[string]interface{})
- func IsNotFound(appName string, err error) bool
- func List(envName string) ([]*api.Application, error)
- func LoadApplication(envName, appName string) (*api.Application, error)
- func MatchAppByComp(envName, compName string) (*api.Application, error)
- func NewApplication(f *api.AppFile, tm template.Manager) *api.Application
- func NewEmptyApplication() (*api.Application, error)
- func PrepareProcessContext(k8sClient client.Client, wl *Workload, applicationName string, ...) (process.Context, error)
- func RemoveComponent(app *api.Application, componentName string) error
- func RemoveTrait(app *api.Application, componentName, traitType string) error
- func Run(ctx context.Context, client client.Client, app *v1alpha2.Application, ...) error
- func Save(app *api.Application, envName string) error
- func SetTrait(app *api.Application, componentName, traitType string, ...) error
- func SetWorkload(app *api.Application, componentName, workloadType string, ...) error
- func Validate(app *api.Application) error
- type Appfile
- type Parser
- type Scope
- type Storage
- type Trait
- type Workload
- func (wl *Workload) EvalContext(ctx process.Context) error
- func (wl *Workload) EvalHealth(ctx process.Context, client client.Client, namespace string) (bool, error)
- func (wl *Workload) EvalStatus(ctx process.Context, cli client.Client, ns string) (string, error)
- func (wl *Workload) GetUserConfigName() string
Constants ¶
const ( // TerraformBaseLocation is the base directory to store all Terraform JSON files TerraformBaseLocation = ".vela/terraform/" // TerraformLog is the logfile name for terraform TerraformLog = "terraform.log" )
const ( // AppfileBuiltinConfig defines the built-in config variable AppfileBuiltinConfig = "config" // OAMApplicationLabel is application's metadata label tagged on AC and Component OAMApplicationLabel = "application.oam.dev" )
Variables ¶
This section is empty.
Functions ¶
func ApplyTerraform ¶ added in v0.3.1
func ApplyTerraform(app *v1alpha2.Application, k8sClient client.Client, ioStream util.IOStreams, namespace string, dm discoverymapper.DiscoveryMapper) ([]v1alpha2.ApplicationComponent, error)
ApplyTerraform deploys addon resources
func BuildRun ¶ added in v0.3.1
func BuildRun(ctx context.Context, app *api.Application, client client.Client, env *types.EnvMeta, io cmdutil.IOStreams) error
BuildRun will build application and deploy from Appfile
func CreateOrUpdateApplication ¶ added in v0.3.1
func CreateOrUpdateApplication(ctx context.Context, client client.Client, app *v1alpha2.Application) error
CreateOrUpdateApplication will create if not exist and update if exists.
func CreateOrUpdateObjects ¶ added in v0.3.1
CreateOrUpdateObjects will create all scopes
func GetAppConfig ¶ added in v0.3.1
func GetAppConfig(ctx context.Context, c client.Client, app *api.Application, env *types.EnvMeta) (*v1alpha2.ApplicationConfiguration, error)
GetAppConfig will get AppConfig from K8s cluster.
func GetApplication ¶ added in v0.3.1
func GetApplication(ctx context.Context, c client.Client, app *api.Application, env *types.EnvMeta) (*v1alpha2.Application, error)
GetApplication will get Application from K8s cluster.
func GetComponents ¶ added in v0.3.1
func GetComponents(app *api.Application) []string
GetComponents will get oam components from Appfile.
func GetServiceConfig ¶ added in v0.3.1
func GetServiceConfig(app *api.Application, componentName string) (string, map[string]interface{})
GetServiceConfig will get service type and it's configuration
func GetTraits ¶ added in v0.3.1
func GetTraits(app *api.Application, componentName string) (map[string]map[string]interface{}, error)
GetTraits will list all traits and it's configurations attached to the specified component.
func GetTraitsByType ¶ added in v0.3.1
func GetTraitsByType(app *api.Application, componentName, traitType string) (map[string]interface{}, error)
GetTraitsByType will get trait configuration with specified component and trait type, we assume one type of trait can only attach to a component once.
func GetWorkload ¶ added in v0.3.1
func GetWorkload(app *api.Application, componentName string) (string, map[string]interface{})
GetWorkload will get workload type and it's configuration
func IsNotFound ¶ added in v0.3.1
IsNotFound is application not found error
func List ¶ added in v0.3.1
func List(envName string) ([]*api.Application, error)
List will list all apps
func LoadApplication ¶ added in v0.3.1
func LoadApplication(envName, appName string) (*api.Application, error)
LoadApplication will load application with env and name from default vela home dir.
func MatchAppByComp ¶ added in v0.3.1
func MatchAppByComp(envName, compName string) (*api.Application, error)
MatchAppByComp will get application with componentName without AppName.
func NewApplication ¶ added in v0.3.1
NewApplication will create application object
func NewEmptyApplication ¶ added in v0.3.1
func NewEmptyApplication() (*api.Application, error)
NewEmptyApplication new empty application, only set tm
func PrepareProcessContext ¶ added in v0.3.1
func PrepareProcessContext(k8sClient client.Client, wl *Workload, applicationName string, namespace string) (process.Context, error)
PrepareProcessContext prepares a DSL process Context
func RemoveComponent ¶ added in v0.3.1
func RemoveComponent(app *api.Application, componentName string) error
RemoveComponent will remove component from Appfile
func RemoveTrait ¶ added in v0.3.1
func RemoveTrait(app *api.Application, componentName, traitType string) error
RemoveTrait will remove a trait from Appfile
func Run ¶ added in v0.3.1
func Run(ctx context.Context, client client.Client, app *v1alpha2.Application, assistantObjects []oam.Object) error
Run will deploy OAM objects and other assistant K8s Objects including ConfigMap, OAM Scope Custom Resource.
func Save ¶ added in v0.3.1
func Save(app *api.Application, envName string) error
Save will save appfile into default dir.
func SetTrait ¶ added in v0.3.1
func SetTrait(app *api.Application, componentName, traitType string, traitData map[string]interface{}) error
SetTrait will set user trait for Appfile
func SetWorkload ¶ added in v0.3.1
func SetWorkload(app *api.Application, componentName, workloadType string, workloadData map[string]interface{}) error
SetWorkload will set user workload for Appfile
func Validate ¶ added in v0.3.1
func Validate(app *api.Application) error
Validate will validate whether an Appfile is valid.
Types ¶
type Appfile ¶ added in v0.3.1
Appfile describes application
func (*Appfile) TemplateValidate ¶ added in v0.3.1
TemplateValidate validate Template format
type Parser ¶ added in v0.3.1
type Parser struct {
// contains filtered or unexported fields
}
Parser is an application parser
func NewApplicationParser ¶ added in v0.3.1
func NewApplicationParser(cli client.Client, dm discoverymapper.DiscoveryMapper) *Parser
NewApplicationParser create appfile parser
func (*Parser) GenerateAppFile ¶ added in v0.3.1
func (p *Parser) GenerateAppFile(ctx context.Context, name string, app *v1alpha2.Application) (*Appfile, error)
GenerateAppFile converts an application to an Appfile
func (*Parser) GenerateApplicationConfiguration ¶ added in v0.3.1
func (p *Parser) GenerateApplicationConfiguration(app *Appfile, ns string) (*v1alpha2.ApplicationConfiguration, []*v1alpha2.Component, error)
GenerateApplicationConfiguration converts an appFile to applicationConfig & Components
type Scope ¶ added in v0.3.1
type Scope struct { Name string GVK schema.GroupVersionKind }
Scope defines the scope of workload
type Storage ¶ added in v0.3.1
Storage is common storage client,use it to get app and others resource
func GetStorage ¶ added in v0.3.1
func GetStorage() *Storage
GetStorage will create storage driver from the system environment of "STORAGE_DRIVER"
func (*Storage) Get ¶ added in v0.3.1
func (s *Storage) Get(envName, appName string) (*api.Application, error)
Get application storage common implement
type Trait ¶ added in v0.3.1
type Trait struct { // The Name is name of TraitDefinition, actually it's a type of the trait instance Name string CapabilityCategory types.CapabilityCategory Params map[string]interface{} Template string HealthCheckPolicy string CustomStatusFormat string }
Trait is ComponentTrait
func (*Trait) EvalContext ¶ added in v0.3.1
EvalContext eval trait template and set result to context
type Workload ¶ added in v0.3.1
type Workload struct { Name string Type string CapabilityCategory types.CapabilityCategory Params map[string]interface{} Traits []*Trait Scopes []Scope Template string HealthCheckPolicy string CustomStatusFormat string }
Workload is component
func (*Workload) EvalContext ¶ added in v0.3.1
EvalContext eval workload template and set result to context
func (*Workload) EvalHealth ¶ added in v0.3.1
func (wl *Workload) EvalHealth(ctx process.Context, client client.Client, namespace string) (bool, error)
EvalHealth eval workload health check
func (*Workload) EvalStatus ¶ added in v0.3.3
EvalStatus eval workload status
func (*Workload) GetUserConfigName ¶ added in v0.3.1
GetUserConfigName get user config from AppFile, it will contain config file in it.