Documentation ¶
Overview ¶
该 visitor 处理 diceyml 中一些字段的默认值
原本的parser会把 global env 塞到各个 service 的 env 去
找出依赖却不存在的 service
找出没有被其他service依赖的后端service, 前端service不考虑(也就是有expose的service)
检查 service name 合法性
Index ¶
- Constants
- func CompatibleExpose(obj *Object)
- func Compose(obj, envObj *Object, env string)
- func ComposeIntPortsFromServicePorts(servicePorts []ServicePort) []int
- func ExpandGlobalEnv(obj *Object)
- func FindCycle(obj *Object) (has bool, chain []string)
- func FindOrphan(obj *Object) []string
- func InsertAddonOptions(obj *Object, env EnvType, addonPlan string, options map[string]string)
- func InsertImage(obj *Object, images map[string]string, envs map[string]map[string]string) error
- func InsertSideCarImage(obj *Object, images map[string]map[string]string) error
- func MergeEnv(obj *Object, env string)
- func SetDefaultValue(obj *Object)
- type AddOn
- type AddOns
- type BasicValidateVisitor
- func (o *BasicValidateVisitor) VisitAddOn(v DiceYmlVisitor, obj *AddOn)
- func (o *BasicValidateVisitor) VisitAddOns(v DiceYmlVisitor, obj *AddOns)
- func (o *BasicValidateVisitor) VisitBinds(v DiceYmlVisitor, obj *Binds)
- func (o *BasicValidateVisitor) VisitDeployments(v DiceYmlVisitor, obj *Deployments)
- func (o *BasicValidateVisitor) VisitObject(v DiceYmlVisitor, obj *Object)
- func (o *BasicValidateVisitor) VisitResources(v DiceYmlVisitor, obj *Resources)
- func (o *BasicValidateVisitor) VisitService(v DiceYmlVisitor, obj *Service)
- type Bind
- type Binds
- type CheckEnvSizeVisitor
- type CompatibleExposeVisitor
- type ComposeVisitor
- type DefaultValueVisitor
- type DefaultVisitor
- func (*DefaultVisitor) VisitAddOn(v DiceYmlVisitor, obj *AddOn)
- func (*DefaultVisitor) VisitAddOns(v DiceYmlVisitor, obj *AddOns)
- func (*DefaultVisitor) VisitBinds(v DiceYmlVisitor, obj *Binds)
- func (*DefaultVisitor) VisitDeployments(v DiceYmlVisitor, obj *Deployments)
- func (*DefaultVisitor) VisitEnvObject(v DiceYmlVisitor, obj *EnvObject)
- func (*DefaultVisitor) VisitEnvObjects(v DiceYmlVisitor, obj *EnvObjects)
- func (*DefaultVisitor) VisitExecCheck(v DiceYmlVisitor, obj *ExecCheck)
- func (*DefaultVisitor) VisitHTTPCheck(v DiceYmlVisitor, obj *HTTPCheck)
- func (*DefaultVisitor) VisitHealthCheck(v DiceYmlVisitor, obj *HealthCheck)
- func (o *DefaultVisitor) VisitJob(v DiceYmlVisitor, obj *Job)
- func (o *DefaultVisitor) VisitJobs(v DiceYmlVisitor, obj *Jobs)
- func (*DefaultVisitor) VisitObject(v DiceYmlVisitor, obj *Object)
- func (*DefaultVisitor) VisitResources(v DiceYmlVisitor, obj *Resources)
- func (*DefaultVisitor) VisitService(v DiceYmlVisitor, obj *Service)
- func (o *DefaultVisitor) VisitServices(v DiceYmlVisitor, obj *Services)
- type Deployments
- type DiceYaml
- func (d *DiceYaml) Compose(env string, yml *DiceYaml) error
- func (d *DiceYaml) InsertAddonOptions(env EnvType, addon string, options map[string]string) error
- func (d *DiceYaml) InsertImage(images map[string]string, envs map[string]map[string]string) error
- func (d *DiceYaml) InsertSideCarImage(images map[string]map[string]string) error
- func (d *DiceYaml) JSON() (string, error)
- func (d *DiceYaml) MergeEnv(env string) error
- func (d *DiceYaml) Obj() *Object
- func (d *DiceYaml) Parse(validate bool) error
- func (d *DiceYaml) Validate() ValidateError
- func (d *DiceYaml) YAML() (string, error)
- type DiceYmlVisitor
- func NewBasicValidateVisitor() DiceYmlVisitor
- func NewCheckEnvSizeVisitor() DiceYmlVisitor
- func NewCompatibleExposeVisitor() DiceYmlVisitor
- func NewComposeVisitor(envObj *Object, env string) DiceYmlVisitor
- func NewDefaultValueVisitor() DiceYmlVisitor
- func NewEnvVisitor() DiceYmlVisitor
- func NewFieldnameValidateVisitor(raw []byte) (DiceYmlVisitor, error)
- func NewFindCycleVisitor() DiceYmlVisitor
- func NewFindLackServiceVisitor() DiceYmlVisitor
- func NewFindOrphanVisitor() DiceYmlVisitor
- func NewInsertAddonOptionsVisitor(env EnvType, addonPlan string, options map[string]string) DiceYmlVisitor
- func NewInsertImageVisitor(images map[string]string, envs map[string]map[string]string) DiceYmlVisitor
- func NewInsertSideCarImageVisitor(images map[string]map[string]string) DiceYmlVisitor
- func NewMergeEnvVisitor(envObj *EnvObject) DiceYmlVisitor
- func NewServiceNameVisitor() DiceYmlVisitor
- type Endpoint
- type EndpointPolicies
- type EnvMap
- type EnvObject
- type EnvObjects
- type EnvType
- type EnvVisitor
- type ExecCheck
- type FieldnameValidateVisitor
- func (o *FieldnameValidateVisitor) VisitAddOns(v DiceYmlVisitor, obj *AddOns)
- func (o *FieldnameValidateVisitor) VisitDeployments(v DiceYmlVisitor, obj *Deployments)
- func (o *FieldnameValidateVisitor) VisitExecCheck(v DiceYmlVisitor, obj *ExecCheck)
- func (o *FieldnameValidateVisitor) VisitHTTPCheck(v DiceYmlVisitor, obj *HTTPCheck)
- func (o *FieldnameValidateVisitor) VisitHealthCheck(v DiceYmlVisitor, obj *HealthCheck)
- func (o *FieldnameValidateVisitor) VisitObject(v DiceYmlVisitor, obj *Object)
- func (o *FieldnameValidateVisitor) VisitResources(v DiceYmlVisitor, obj *Resources)
- func (o *FieldnameValidateVisitor) VisitService(v DiceYmlVisitor, obj *Service)
- func (o *FieldnameValidateVisitor) VisitServices(v DiceYmlVisitor, obj *Services)
- type FindCycleVisitor
- type FindLackServiceVisitor
- type FindOrphanVisitor
- type HTTPCheck
- type HealthCheck
- type InitContainer
- type InsertAddonOptionsVisitor
- func (o *InsertAddonOptionsVisitor) VisitAddOn(v DiceYmlVisitor, obj *AddOn)
- func (o *InsertAddonOptionsVisitor) VisitAddOns(v DiceYmlVisitor, obj *AddOns)
- func (o *InsertAddonOptionsVisitor) VisitEnvObject(v DiceYmlVisitor, obj *EnvObject)
- func (o *InsertAddonOptionsVisitor) VisitEnvObjects(v DiceYmlVisitor, obj *EnvObjects)
- type InsertImageVisitor
- type InsertSideCarImageVisitor
- type Job
- type Jobs
- type MergeEnvVisitor
- func (o *MergeEnvVisitor) VisitAddOns(v DiceYmlVisitor, obj *AddOns)
- func (o *MergeEnvVisitor) VisitDeployments(v DiceYmlVisitor, obj *Deployments)
- func (o *MergeEnvVisitor) VisitExecCheck(v DiceYmlVisitor, obj *ExecCheck)
- func (o *MergeEnvVisitor) VisitHTTPCheck(v DiceYmlVisitor, obj *HTTPCheck)
- func (o *MergeEnvVisitor) VisitObject(v DiceYmlVisitor, obj *Object)
- func (o *MergeEnvVisitor) VisitResources(v DiceYmlVisitor, obj *Resources)
- func (o *MergeEnvVisitor) VisitService(v DiceYmlVisitor, obj *Service)
- func (o *MergeEnvVisitor) VisitServices(v DiceYmlVisitor, obj *Services)
- type Object
- type Resources
- type Selector
- type Selectors
- type Service
- type ServiceNameVisitor
- type ServicePort
- type Services
- type SharedDir
- type SideCar
- type TrafficSecurity
- type ValidateError
- type ValueMap
- type ValueObjects
- type Volume
- type Volumes
- type WorkspaceStr
Constants ¶
const ( WS_DEV WorkspaceStr = "development" WS_TEST = "test" WS_STAGING = "staging" WS_PROD = "production" )
Variables ¶
This section is empty.
Functions ¶
func CompatibleExpose ¶
func CompatibleExpose(obj *Object)
func ComposeIntPortsFromServicePorts ¶
func ComposeIntPortsFromServicePorts(servicePorts []ServicePort) []int
func ExpandGlobalEnv ¶
func ExpandGlobalEnv(obj *Object)
func FindOrphan ¶
func InsertAddonOptions ¶
func InsertImage ¶
func InsertSideCarImage ¶
images: map[servicename]map[sidecarname]image
func SetDefaultValue ¶
func SetDefaultValue(obj *Object)
Types ¶
type AddOn ¶
type AddOn struct { Plan string `yaml:"plan,omitempty" json:"plan"` As string `yaml:"as,omitempty" json:"as,omitempty"` Options map[string]string `yaml:"options,omitempty" json:"options,omitempty"` Actions map[string]interface{} `yaml:"actions,omitempty" json:"actions,omitempty"` Image string `yaml:"image,omitempty" json:"image,omitempty"` }
func (*AddOn) Accept ¶
func (obj *AddOn) Accept(v DiceYmlVisitor)
func (*AddOn) MarshalJSON ¶
type BasicValidateVisitor ¶
type BasicValidateVisitor struct { DefaultVisitor // contains filtered or unexported fields }
func (*BasicValidateVisitor) VisitAddOn ¶
func (o *BasicValidateVisitor) VisitAddOn(v DiceYmlVisitor, obj *AddOn)
func (*BasicValidateVisitor) VisitAddOns ¶
func (o *BasicValidateVisitor) VisitAddOns(v DiceYmlVisitor, obj *AddOns)
func (*BasicValidateVisitor) VisitBinds ¶
func (o *BasicValidateVisitor) VisitBinds(v DiceYmlVisitor, obj *Binds)
func (*BasicValidateVisitor) VisitDeployments ¶
func (o *BasicValidateVisitor) VisitDeployments(v DiceYmlVisitor, obj *Deployments)
func (*BasicValidateVisitor) VisitObject ¶
func (o *BasicValidateVisitor) VisitObject(v DiceYmlVisitor, obj *Object)
func (*BasicValidateVisitor) VisitResources ¶
func (o *BasicValidateVisitor) VisitResources(v DiceYmlVisitor, obj *Resources)
func (*BasicValidateVisitor) VisitService ¶
func (o *BasicValidateVisitor) VisitService(v DiceYmlVisitor, obj *Service)
type Bind ¶
type Bind struct { HostPath string `yaml:"host,omitempty" json:"host"` ContainerPath string `yaml:"container" json:"container"` Type string `yaml:"type" json:"type"` }
func ParseBinds ¶
type Binds ¶
type Binds []string
func (*Binds) Accept ¶
func (obj *Binds) Accept(v DiceYmlVisitor)
func (Binds) MarshalJSON ¶
func (*Binds) UnmarshalJSON ¶
type CheckEnvSizeVisitor ¶
type CheckEnvSizeVisitor struct { DefaultVisitor // contains filtered or unexported fields }
func (*CheckEnvSizeVisitor) VisitObject ¶
func (o *CheckEnvSizeVisitor) VisitObject(v DiceYmlVisitor, obj *Object)
func (*CheckEnvSizeVisitor) VisitService ¶
func (o *CheckEnvSizeVisitor) VisitService(v DiceYmlVisitor, obj *Service)
type CompatibleExposeVisitor ¶
type CompatibleExposeVisitor struct {
DefaultVisitor
}
func (*CompatibleExposeVisitor) VisitServices ¶
func (o *CompatibleExposeVisitor) VisitServices(v DiceYmlVisitor, obj *Services)
type ComposeVisitor ¶
type ComposeVisitor struct { DefaultVisitor // contains filtered or unexported fields }
func (*ComposeVisitor) VisitEnvObjects ¶
func (o *ComposeVisitor) VisitEnvObjects(v DiceYmlVisitor, obj *EnvObjects)
type DefaultValueVisitor ¶
type DefaultValueVisitor struct {
DefaultVisitor
}
func (*DefaultValueVisitor) VisitResources ¶
func (o *DefaultValueVisitor) VisitResources(v DiceYmlVisitor, obj *Resources)
type DefaultVisitor ¶
type DefaultVisitor struct {
// contains filtered or unexported fields
}
func (*DefaultVisitor) VisitAddOn ¶
func (*DefaultVisitor) VisitAddOn(v DiceYmlVisitor, obj *AddOn)
func (*DefaultVisitor) VisitAddOns ¶
func (*DefaultVisitor) VisitAddOns(v DiceYmlVisitor, obj *AddOns)
func (*DefaultVisitor) VisitBinds ¶
func (*DefaultVisitor) VisitBinds(v DiceYmlVisitor, obj *Binds)
func (*DefaultVisitor) VisitDeployments ¶
func (*DefaultVisitor) VisitDeployments(v DiceYmlVisitor, obj *Deployments)
func (*DefaultVisitor) VisitEnvObject ¶
func (*DefaultVisitor) VisitEnvObject(v DiceYmlVisitor, obj *EnvObject)
func (*DefaultVisitor) VisitEnvObjects ¶
func (*DefaultVisitor) VisitEnvObjects(v DiceYmlVisitor, obj *EnvObjects)
func (*DefaultVisitor) VisitExecCheck ¶
func (*DefaultVisitor) VisitExecCheck(v DiceYmlVisitor, obj *ExecCheck)
func (*DefaultVisitor) VisitHTTPCheck ¶
func (*DefaultVisitor) VisitHTTPCheck(v DiceYmlVisitor, obj *HTTPCheck)
func (*DefaultVisitor) VisitHealthCheck ¶
func (*DefaultVisitor) VisitHealthCheck(v DiceYmlVisitor, obj *HealthCheck)
func (*DefaultVisitor) VisitJob ¶
func (o *DefaultVisitor) VisitJob(v DiceYmlVisitor, obj *Job)
func (*DefaultVisitor) VisitJobs ¶
func (o *DefaultVisitor) VisitJobs(v DiceYmlVisitor, obj *Jobs)
func (*DefaultVisitor) VisitObject ¶
func (*DefaultVisitor) VisitObject(v DiceYmlVisitor, obj *Object)
func (*DefaultVisitor) VisitResources ¶
func (*DefaultVisitor) VisitResources(v DiceYmlVisitor, obj *Resources)
func (*DefaultVisitor) VisitService ¶
func (*DefaultVisitor) VisitService(v DiceYmlVisitor, obj *Service)
func (*DefaultVisitor) VisitServices ¶
func (o *DefaultVisitor) VisitServices(v DiceYmlVisitor, obj *Services)
type Deployments ¶
type Deployments struct { Replicas int `yaml:"replicas,omitempty" json:"replicas"` Policies string `yaml:"policies,omitempty" json:"policies"` Labels map[string]string `yaml:"labels,omitempty" json:"labels,omitempty"` // Type indicates the type of Deployments, per-node,stateful and stateless are supported Workload string `yaml:"workload,omitempty" json:"workload,omitempty"` // Selectors available selectors: // [location] Selectors Selectors `yaml:"selectors,omitempty" json:"selectors,omitempty"` }
func (*Deployments) Accept ¶
func (obj *Deployments) Accept(v DiceYmlVisitor)
type DiceYaml ¶
type DiceYaml struct {
// contains filtered or unexported fields
}
func NewDeployable ¶
得到对应部署环境的 DiceYaml,可用于部署
func (*DiceYaml) InsertAddonOptions ¶
func (*DiceYaml) InsertImage ¶
func (*DiceYaml) InsertSideCarImage ¶
images: map[servicename]map[sidecarname]image
func (*DiceYaml) Validate ¶
func (d *DiceYaml) Validate() ValidateError
type DiceYmlVisitor ¶
type DiceYmlVisitor interface { VisitObject(v DiceYmlVisitor, obj *Object) VisitEnvObject(v DiceYmlVisitor, obj *EnvObject) VisitEnvObjects(v DiceYmlVisitor, obj *EnvObjects) VisitService(v DiceYmlVisitor, obj *Service) VisitServices(v DiceYmlVisitor, obj *Services) VisitJobs(v DiceYmlVisitor, obj *Jobs) VisitJob(v DiceYmlVisitor, obj *Job) VisitAddOn(v DiceYmlVisitor, obj *AddOn) VisitAddOns(v DiceYmlVisitor, obj *AddOns) VisitResources(v DiceYmlVisitor, obj *Resources) VisitHealthCheck(v DiceYmlVisitor, obj *HealthCheck) VisitHTTPCheck(v DiceYmlVisitor, obj *HTTPCheck) VisitExecCheck(v DiceYmlVisitor, obj *ExecCheck) VisitDeployments(v DiceYmlVisitor, obj *Deployments) VisitBinds(v DiceYmlVisitor, obj *Binds) }
=========================== default visitor =====================================
func NewBasicValidateVisitor ¶
func NewBasicValidateVisitor() DiceYmlVisitor
func NewCheckEnvSizeVisitor ¶
func NewCheckEnvSizeVisitor() DiceYmlVisitor
func NewCompatibleExposeVisitor ¶
func NewCompatibleExposeVisitor() DiceYmlVisitor
func NewComposeVisitor ¶
func NewComposeVisitor(envObj *Object, env string) DiceYmlVisitor
func NewDefaultValueVisitor ¶
func NewDefaultValueVisitor() DiceYmlVisitor
func NewEnvVisitor ¶
func NewEnvVisitor() DiceYmlVisitor
func NewFieldnameValidateVisitor ¶
func NewFieldnameValidateVisitor(raw []byte) (DiceYmlVisitor, error)
func NewFindCycleVisitor ¶
func NewFindCycleVisitor() DiceYmlVisitor
func NewFindLackServiceVisitor ¶
func NewFindLackServiceVisitor() DiceYmlVisitor
func NewFindOrphanVisitor ¶
func NewFindOrphanVisitor() DiceYmlVisitor
func NewInsertAddonOptionsVisitor ¶
func NewInsertAddonOptionsVisitor(env EnvType, addonPlan string, options map[string]string) DiceYmlVisitor
func NewInsertImageVisitor ¶
func NewInsertSideCarImageVisitor ¶
func NewInsertSideCarImageVisitor(images map[string]map[string]string) DiceYmlVisitor
func NewMergeEnvVisitor ¶
func NewMergeEnvVisitor(envObj *EnvObject) DiceYmlVisitor
func NewServiceNameVisitor ¶
func NewServiceNameVisitor() DiceYmlVisitor
type Endpoint ¶
type Endpoint struct { Domain string `yaml:"domain,omitempty" json:"domain,omitempty"` Path string `yaml:"path,omitempty" json:"path,omitempty"` BackendPath string `yaml:"backend_path,omitempty" json:"backend_path,omitempty"` Policies EndpointPolicies `yaml:"policies,omitempty" json:"policies,omitempty"` }
type EndpointPolicies ¶
type EnvMap ¶
func (*EnvMap) UnmarshalJSON ¶
type EnvObject ¶
type EnvObject struct { Envs EnvMap `yaml:"envs,omitempty" json:"-"` Services Services `yaml:"services,omitempty" json:"services,omitempty"` AddOns AddOns `yaml:"addons,omitempty" json:"addons,omitempty"` }
func (*EnvObject) Accept ¶
func (obj *EnvObject) Accept(v DiceYmlVisitor)
默认不会像 Object 一样默认去遍历 Services, AddOns 比如validate,envobject中的service可能是不全的,但也是正确的 如果需要遍历envobject下的service和addon,需要手动去遍历
type EnvObjects ¶
func (*EnvObjects) Accept ¶
func (obj *EnvObjects) Accept(v DiceYmlVisitor)
type EnvVisitor ¶
type EnvVisitor struct { DefaultVisitor // contains filtered or unexported fields }
func (*EnvVisitor) VisitObject ¶
func (o *EnvVisitor) VisitObject(v DiceYmlVisitor, obj *Object)
func (*EnvVisitor) VisitService ¶
func (o *EnvVisitor) VisitService(v DiceYmlVisitor, obj *Service)
type ExecCheck ¶
type ExecCheck struct { Cmd string `yaml:"cmd,omitempty" json:"cmd,omitempty"` Duration int `yaml:"duration,omitempty" json:"duration,omitempty"` }
func (*ExecCheck) Accept ¶
func (obj *ExecCheck) Accept(v DiceYmlVisitor)
type FieldnameValidateVisitor ¶
type FieldnameValidateVisitor struct { DefaultVisitor RawMap map[interface{}]interface{} // contains filtered or unexported fields }
func (*FieldnameValidateVisitor) VisitAddOns ¶
func (o *FieldnameValidateVisitor) VisitAddOns(v DiceYmlVisitor, obj *AddOns)
func (*FieldnameValidateVisitor) VisitDeployments ¶
func (o *FieldnameValidateVisitor) VisitDeployments(v DiceYmlVisitor, obj *Deployments)
func (*FieldnameValidateVisitor) VisitExecCheck ¶
func (o *FieldnameValidateVisitor) VisitExecCheck(v DiceYmlVisitor, obj *ExecCheck)
func (*FieldnameValidateVisitor) VisitHTTPCheck ¶
func (o *FieldnameValidateVisitor) VisitHTTPCheck(v DiceYmlVisitor, obj *HTTPCheck)
func (*FieldnameValidateVisitor) VisitHealthCheck ¶
func (o *FieldnameValidateVisitor) VisitHealthCheck(v DiceYmlVisitor, obj *HealthCheck)
func (*FieldnameValidateVisitor) VisitObject ¶
func (o *FieldnameValidateVisitor) VisitObject(v DiceYmlVisitor, obj *Object)
func (*FieldnameValidateVisitor) VisitResources ¶
func (o *FieldnameValidateVisitor) VisitResources(v DiceYmlVisitor, obj *Resources)
func (*FieldnameValidateVisitor) VisitService ¶
func (o *FieldnameValidateVisitor) VisitService(v DiceYmlVisitor, obj *Service)
func (*FieldnameValidateVisitor) VisitServices ¶
func (o *FieldnameValidateVisitor) VisitServices(v DiceYmlVisitor, obj *Services)
type FindCycleVisitor ¶
type FindCycleVisitor struct { DefaultVisitor // contains filtered or unexported fields }
func (*FindCycleVisitor) VisitServices ¶
func (o *FindCycleVisitor) VisitServices(v DiceYmlVisitor, obj *Services)
type FindLackServiceVisitor ¶
type FindLackServiceVisitor struct { DefaultVisitor // contains filtered or unexported fields }
func (*FindLackServiceVisitor) VisitServices ¶
func (o *FindLackServiceVisitor) VisitServices(v DiceYmlVisitor, obj *Services)
type FindOrphanVisitor ¶
type FindOrphanVisitor struct { DefaultVisitor // contains filtered or unexported fields }
func (*FindOrphanVisitor) VisitServices ¶
func (o *FindOrphanVisitor) VisitServices(v DiceYmlVisitor, obj *Services)
type HTTPCheck ¶
type HTTPCheck struct { Port int `yaml:"port,omitempty" json:"port,omitempty"` Path string `yaml:"path,omitempty" json:"path,omitempty"` Duration int `yaml:"duration,omitempty" json:"duration,omitempty"` }
func (*HTTPCheck) Accept ¶
func (obj *HTTPCheck) Accept(v DiceYmlVisitor)
type HealthCheck ¶
type HealthCheck struct { HTTP *HTTPCheck `yaml:"http,omitempty" json:"http,omitempty"` Exec *ExecCheck `yaml:"exec,omitempty" json:"exec,omitempty"` }
func (*HealthCheck) Accept ¶
func (obj *HealthCheck) Accept(v DiceYmlVisitor)
type InitContainer ¶
type InsertAddonOptionsVisitor ¶
type InsertAddonOptionsVisitor struct { DefaultVisitor // contains filtered or unexported fields }
func (*InsertAddonOptionsVisitor) VisitAddOn ¶
func (o *InsertAddonOptionsVisitor) VisitAddOn(v DiceYmlVisitor, obj *AddOn)
func (*InsertAddonOptionsVisitor) VisitAddOns ¶
func (o *InsertAddonOptionsVisitor) VisitAddOns(v DiceYmlVisitor, obj *AddOns)
func (*InsertAddonOptionsVisitor) VisitEnvObject ¶
func (o *InsertAddonOptionsVisitor) VisitEnvObject(v DiceYmlVisitor, obj *EnvObject)
func (*InsertAddonOptionsVisitor) VisitEnvObjects ¶
func (o *InsertAddonOptionsVisitor) VisitEnvObjects(v DiceYmlVisitor, obj *EnvObjects)
type InsertImageVisitor ¶
type InsertImageVisitor struct { DefaultVisitor // contains filtered or unexported fields }
func (*InsertImageVisitor) VisitJob ¶
func (o *InsertImageVisitor) VisitJob(v DiceYmlVisitor, obj *Job)
func (*InsertImageVisitor) VisitJobs ¶
func (o *InsertImageVisitor) VisitJobs(v DiceYmlVisitor, obj *Jobs)
func (*InsertImageVisitor) VisitService ¶
func (o *InsertImageVisitor) VisitService(v DiceYmlVisitor, obj *Service)
func (*InsertImageVisitor) VisitServices ¶
func (o *InsertImageVisitor) VisitServices(v DiceYmlVisitor, obj *Services)
type InsertSideCarImageVisitor ¶
type InsertSideCarImageVisitor struct { DefaultVisitor // contains filtered or unexported fields }
func (*InsertSideCarImageVisitor) VisitService ¶
func (o *InsertSideCarImageVisitor) VisitService(v DiceYmlVisitor, obj *Service)
func (*InsertSideCarImageVisitor) VisitServices ¶
func (o *InsertSideCarImageVisitor) VisitServices(v DiceYmlVisitor, obj *Services)
type Job ¶
type Job struct { Image string `yaml:"image,omitempty" json:"image"` Cmd string `yaml:"cmd,omitempty" json:"cmd"` Envs EnvMap `yaml:"envs,omitempty" json:"envs,omitempty"` Resources Resources `yaml:"resources,omitempty" json:"resources"` Labels map[string]string `yaml:"labels,omitempty" json:"labels,omitempty"` Binds Binds `yaml:"binds,omitempty" json:"binds,omitempty"` Volumes Volumes `yaml:"volumes,omitempty" json:"volumes,omitempty"` Hosts []string `yaml:"hosts,omitempty" json:"hosts,omitempty"` }
func (*Job) Accept ¶
func (obj *Job) Accept(v DiceYmlVisitor)
type MergeEnvVisitor ¶
type MergeEnvVisitor struct { DefaultVisitor // contains filtered or unexported fields }
func (*MergeEnvVisitor) VisitAddOns ¶
func (o *MergeEnvVisitor) VisitAddOns(v DiceYmlVisitor, obj *AddOns)
func (*MergeEnvVisitor) VisitDeployments ¶
func (o *MergeEnvVisitor) VisitDeployments(v DiceYmlVisitor, obj *Deployments)
func (*MergeEnvVisitor) VisitExecCheck ¶
func (o *MergeEnvVisitor) VisitExecCheck(v DiceYmlVisitor, obj *ExecCheck)
func (*MergeEnvVisitor) VisitHTTPCheck ¶
func (o *MergeEnvVisitor) VisitHTTPCheck(v DiceYmlVisitor, obj *HTTPCheck)
func (*MergeEnvVisitor) VisitObject ¶
func (o *MergeEnvVisitor) VisitObject(v DiceYmlVisitor, obj *Object)
func (*MergeEnvVisitor) VisitResources ¶
func (o *MergeEnvVisitor) VisitResources(v DiceYmlVisitor, obj *Resources)
func (*MergeEnvVisitor) VisitService ¶
func (o *MergeEnvVisitor) VisitService(v DiceYmlVisitor, obj *Service)
func (*MergeEnvVisitor) VisitServices ¶
func (o *MergeEnvVisitor) VisitServices(v DiceYmlVisitor, obj *Services)
type Object ¶
type Object struct { Version string `yaml:"version" json:"version"` Meta map[string]string `yaml:"meta" json:"meta"` Envs EnvMap `yaml:"envs" json:"envs,omitempty"` Services Services `yaml:"services" json:"services,omitempty"` Jobs Jobs `yaml:"jobs,omitempty" json:"jobs,omitempty"` AddOns AddOns `yaml:"addons" json:"addons,omitempty"` Environments EnvObjects `yaml:"environments,omitempty" json:"-"` Values ValueObjects `yaml:"values" json:"values,omitempty"` }
func (*Object) Accept ¶
func (obj *Object) Accept(v DiceYmlVisitor)
type Resources ¶
type Resources struct { CPU float64 `yaml:"cpu,omitempty" json:"cpu"` Mem int `yaml:"mem,omitempty" json:"mem"` MaxCPU float64 `yaml:"max_cpu,omitempty" json:"max_cpu"` MaxMem int `yaml:"max_mem,omitempty" json:"max_mem"` Disk int `yaml:"disk,omitempty" json:"disk"` Network map[string]string `yaml:"network,omitempty" json:"network"` }
func (*Resources) Accept ¶
func (obj *Resources) Accept(v DiceYmlVisitor)
type Selector ¶
type Selector struct { Not bool `json:"not"` // 由上面的定义可见,Not=true时,len(Values) = 1 Values []string `json:"values"` }
Selector value struct of Selectors Selectors: map[key]value key: [a-zA-Z0-9-]* value: NOT_VALUE
| NORMAL_VALUE { "|" NORMAL_VALUE }
NOT_VALUE: "!" NORMAL_VALUE NORMAL_VALUE: [a-zA-Z0-9-]*
func (Selector) MarshalYAML ¶
func (*Selector) UnmarshalYAML ¶
type Service ¶
type Service struct { Image string `yaml:"image,omitempty" json:"image"` ImageUsername string `yaml:"image_username,omitempty" json:"image_username"` ImagePassword string `yaml:"image_password,omitempty" json:"image_password"` Cmd string `yaml:"cmd,omitempty" json:"cmd"` Ports []ServicePort `yaml:"ports,omitempty" json:"ports,omitempty"` Envs EnvMap `yaml:"envs,omitempty" json:"envs,omitempty"` Hosts []string `yaml:"hosts,omitempty" json:"hosts,omitempty"` Resources Resources `yaml:"resources,omitempty" json:"resources"` Labels map[string]string `yaml:"labels,omitempty" json:"labels,omitempty"` Annotations map[string]string `yaml:"annotations,omitempty" json:"annotations,omitempty"` Binds Binds `yaml:"binds,omitempty" json:"binds,omitempty"` Volumes Volumes `yaml:"volumes,omitempty" json:"volumes,omitempty"` Deployments Deployments `yaml:"deployments,omitempty" json:"deployments"` DependsOn []string `yaml:"depends_on,omitempty" json:"depends_on,omitempty"` Expose []int `yaml:"expose,omitempty" json:"expose,omitempty"` HealthCheck HealthCheck `yaml:"health_check,omitempty" json:"health_check"` SideCars map[string]*SideCar `yaml:"sidecars,omitempty" json:"sidecars,omitempty"` Init map[string]InitContainer `yaml:"init,omitempty" json:"init,omitempty"` MeshEnable *bool `yaml:"mesh_enable,omitempty" json:"mesh_enable,omitempty"` TrafficSecurity TrafficSecurity `yaml:"traffic_security,omitempty" json:"traffic_security,omitempty"` Endpoints []Endpoint `yaml:"endpoints,omitempty" json:"endpoints,omitempty"` }
func (*Service) Accept ¶
func (obj *Service) Accept(v DiceYmlVisitor)
type ServiceNameVisitor ¶
type ServiceNameVisitor struct { DefaultVisitor // contains filtered or unexported fields }
func (*ServiceNameVisitor) VisitObject ¶
func (o *ServiceNameVisitor) VisitObject(v DiceYmlVisitor, obj *Object)
func (*ServiceNameVisitor) VisitService ¶
func (o *ServiceNameVisitor) VisitService(v DiceYmlVisitor, obj *Service)
type ServicePort ¶
type ServicePort struct { Port int `yaml:"port" json:"port"` Protocol string `yaml:"protocol" json:"protocol"` L4Protocol apiv1.Protocol `yaml:"l4_protocol" json:"l4_protocol"` Expose bool `yaml:"expose" json:"expose"` Default bool `yaml:"default" json:"default"` }
func (*ServicePort) UnmarshalJSON ¶
func (sp *ServicePort) UnmarshalJSON(b []byte) error
The ServicePort UnmarshalJSON unmarshal custom json definition which support more protocol and adapted previous version
func (*ServicePort) UnmarshalYAML ¶
func (sp *ServicePort) UnmarshalYAML(unmarshal func(interface{}) error) error
The ServicePort UnmarshalYAML unmarshal custom yaml definition which support more protocol and adapted previous version
type TrafficSecurity ¶
type TrafficSecurity struct {
Mode string `yaml:"mode,omitempty" json:"mode,omitempty"`
}
type ValidateError ¶
validate result is a map , key: regexp of problem-position-element, value: error info NOTE: why use regex to mark the position of problem-elements ?
because the yaml package not expose the line information
func BasicValidate ¶
func BasicValidate(obj *Object) ValidateError
func CheckEnvSize ¶
func CheckEnvSize(obj *Object) ValidateError
func FieldnameValidate ¶
func FieldnameValidate(obj *Object, raw []byte) ValidateError
func FindLackService ¶
func FindLackService(obj *Object) ValidateError
func ServiceNameCheck ¶
func ServiceNameCheck(obj *Object) ValidateError
type ValueObjects ¶
type ValueObjects map[WorkspaceStr]*ValueMap
type Volume ¶
type Volume struct { ID *string `json:"id"` // nfs, local Storage string `json:"storage"` Path string `json:"path"` }
func (*Volume) UnmarshalYAML ¶
volumes:
- name~storage:/container/path
- name:/container/path # 没有 ~storage 表示使用默认本地默认存储,就是本地磁盘
- /container/path # 没有指定 volume name,默认生成 uuid
- log-volume~nas:/var/logs # ~nas 表示使用 nas 存储
- data-volume~nas:/home/admin/data
type WorkspaceStr ¶
type WorkspaceStr string
Source Files ¶
- basic_validate_visitor.go
- check_env_size.go
- compatible_expose_visitor.go
- compose_visitor.go
- default_value_visitor.go
- define.go
- diceyml.go
- envVisitor.go
- errors.go
- fieldname_validate_visitor.go
- find_cycle_visitor.go
- find_lack_service_visitor.go
- find_orphan_visitor.go
- insert_addon_options_visitor.go
- insert_image_visitor.go
- insert_sidecar_image_visitor.go
- merge_env_visitor.go
- servicename_visitor.go
- utils.go