api

package
v1.9.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultJSONAppfilePath         = "./vela.json"
	DefaultAppfilePath             = "./vela.yaml"
	DefaultUnknowFormatAppfilePath = "./Appfile"
)

DefaultAppfilePath defines the default file path that used by `vela up` command

View Source
const DefaultWorkloadType = "webservice"

DefaultWorkloadType defines the default service type if no type specified in Appfile

Variables

View Source
var (
	ErrImageNotDefined = errors.New("image not defined")
)

error msg used in Appfile

Functions

This section is empty.

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

func JSONToYaml(data []byte, appFile *AppFile) (*AppFile, error)

JSONToYaml will convert JSON format appfile to yaml and load the AppFile struct

func Load

func Load() (*AppFile, error)

Load will load appfile from default path

func LoadFromBytes added in v1.2.0

func LoadFromBytes(b []byte) (*AppFile, error)

LoadFromBytes will load AppFile from bytes

func LoadFromFile

func LoadFromFile(filename string) (*AppFile, error)

LoadFromFile will read the file and load the AppFile struct

func NewAppFile

func NewAppFile() *AppFile

NewAppFile init an empty AppFile struct

func (*AppFile) ConvertToApplication added in v1.2.0

func (app *AppFile) ConvertToApplication(namespace string, io cmdutil.IOStreams, tm template.Manager, silence bool) (*v1beta1.Application, error)

ConvertToApplication renders Appfile into Application, Scopes and other K8s Resources.

func (*AppFile) ExecuteAppfileTasks

func (app *AppFile) ExecuteAppfileTasks(io cmdutil.IOStreams) error

ExecuteAppfileTasks will execute built-in tasks(such as image builder, etc.) and generate locally executed application

func (*AppFile) GetServices

func (af *AppFile) GetServices() map[string]Service

GetServices will get all services defined in AppFile

type Application

type Application struct {
	*AppFile `json:",inline"`
	Tm       template.Manager
}

Application is an implementation level object for Appfile, all vela commands will access AppFile from Appliction struct here.

type Driver

type Driver interface {
	// Save application
	Save(app *Application, envName string) error
	// Delete application
	Delete(envName, appName string) error
	// Name of storage driver
	Name() string
}

Driver is mutli implement interface

type Service

type Service map[string]interface{}

Service defines the service spec for AppFile, it will contain all related information including OAM component, traits, source to image, etc...

func (Service) GetApplicationConfig

func (s Service) GetApplicationConfig() map[string]interface{}

GetApplicationConfig will get OAM workload and trait information exclude inner section('build','type' and 'config')

func (Service) GetType

func (s Service) GetType() string

GetType get type from AppFile

func (Service) GetUserConfigName

func (s Service) GetUserConfigName() string

GetUserConfigName get user config from AppFile, it will contain config file in it.

func (Service) RenderServiceToApplicationComponent

func (s Service) RenderServiceToApplicationComponent(tm template.Manager, serviceName string) (common.ApplicationComponent, error)

RenderServiceToApplicationComponent render all capabilities of a service to CUE values to KubeVela Application.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL