appfile

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2020 License: Apache-2.0 Imports: 26 Imported by: 1

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

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 Load

func Load() (*AppFile, error)

Load will load appfile from default path

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) BuildOAM

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) GetType

func (s Service) GetType() string

GetType get type from AppFile

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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