Documentation
¶
Index ¶
- Constants
- Variables
- func FormatDefaultHealthScopeName(appName string) string
- type AppFile
- type Build
- type Docker
- type Push
- type Service
- func (s Service) GetBuild() *Build
- func (s Service) GetConfig() map[string]interface{}
- func (s Service) GetType() string
- func (s Service) GetUserConfigName() string
- func (s Service) RenderService(tm template.Manager, name, ns string, cg configGetter) (*v1alpha2.ApplicationConfigurationComponent, *v1alpha2.Component, error)
Constants ¶
const (
DefaultJSONAppfilePath = "./vela.json"
DefaultAppfilePath = "./vela.yaml"
DefaultUnknowFormatAppfilePath = "./Appfile"
)
DefaultAppfilePath defines the default file path that used by `vela up` command
const DefaultWorkloadType = "webservice"
DefaultWorkloadType defines the default service type if no type specified in Appfile
Variables ¶
var (
ErrImageNotDefined = errors.New("image not defined")
)
error msg used in Appfile
Functions ¶
func FormatDefaultHealthScopeName ¶ added in v0.0.9
func FormatDefaultHealthScopeName(appName string) string
FormatDefaultHealthScopeName will create a default health scope name.
Types ¶
type AppFile ¶
type AppFile struct {
Name string `json:"name"`
CreateTime time.Time `json:"createTime,omitempty"`
UpdateTime time.Time `json:"updateTime,omitempty"`
Services map[string]Service `json:"services"`
Secrets map[string]string `json:"secrets,omitempty"`
// contains filtered or unexported fields
}
AppFile defines the spec of KubeVela Appfile
func JSONToYaml ¶ added in v0.2.0
func JSONToYaml(data []byte, appFile *AppFile) (*AppFile, error)
JSONToYaml will convert JSON format appfile to yaml and load the AppFile struct
func LoadFromFile ¶
func LoadFromFile(filename string) (*AppFile, error)
LoadFromFile will read the file and load the AppFile struct
func (*AppFile) BuildOAM ¶
func (app *AppFile) BuildOAM(ns string, io cmdutil.IOStreams, tm template.Manager, slience bool) (
[]*v1alpha2.Component, *v1alpha2.ApplicationConfiguration, []oam.Object, error)
BuildOAM renders Appfile into AppConfig, Components. It also builds images for services if defined.
func (*AppFile) GetServices ¶
func (af *AppFile) GetServices() map[string]Service
GetServices will get all services defined in AppFile
type Build ¶
type Build struct {
Push Push `json:"push,omitempty"`
Docker Docker `json:"docker,omitempty"`
}
Build defines the build section of AppFile
func (*Build) BuildImage ¶
func (b *Build) BuildImage(io cmdutil.IOStreams, image string) error
BuildImage will build a image with name and context.
type Docker ¶
type Docker struct {
File string `json:"file"`
Context string `json:"context"`
}
Docker defines the docker build section
type Push ¶
type Push struct {
Local string `json:"local,omitempty"`
Registry string `json:"registry,omitempty"`
}
Push defines where to push your image
type Service ¶
type Service map[string]interface{}
Service defines the service spec for AppFile, it will contain all information a service realted including OAM component, traits, source to image, etc...
func (Service) GetBuild ¶
func (s Service) GetBuild() *Build
GetBuild will get source to image build info
func (Service) GetConfig ¶
func (s Service) GetConfig() map[string]interface{}
GetConfig will get OAM workload and trait information exclude inner section('build','type' and 'config')
func (Service) GetUserConfigName ¶ added in v0.0.9
func (s Service) GetUserConfigName() string
GetUserConfigName get user config from AppFile, it will contain config file in it.
func (Service) RenderService ¶
func (s Service) RenderService(tm template.Manager, name, ns string, cg configGetter) (*v1alpha2.ApplicationConfigurationComponent, *v1alpha2.Component, error)
RenderService render all capabilities of a service to CUE values of a Component. It outputs a Component which will be marshaled as standalone Component and also returned AppConfig Component section.