Merge branch 'master' into V3.6

This commit is contained in:
barnettZQG 2018-06-26 13:33:29 +08:00
commit f0513ce745
8 changed files with 54 additions and 11 deletions

View File

@ -43,11 +43,11 @@ Choose Rainbond for the same reasons disruptive companies do: it serve as a easy
## Architecture
<img src="https://github.com/goodrain/rainbond/blob/master/docs/rainbond_architecture.png" href="http://www.rainbond.com/docs/stable/getting-started/architecture.html">
<img src="https://static.goodrain.com/images/docs/3.6/architecture/architecture.png" href="http://www.rainbond.com/docs/stable/architecture/architecture.html">
## Roadmap
Read the [Roadmap](https://github.com/goodrain/rainbond-docs/blob/master/v3.6/roadmap.md).
Read the [Roadmap](https://github.com/goodrain/rainbond-docs/blob/master/v3.6/architecture/roadmap.md).
## Control UI

View File

@ -77,6 +77,16 @@ func (e *EndpointList) Selec(i int) Endpoint {
return (*e)[i]
}
//HaveEndpoint Whether or not there is a endpoint
func (e *EndpointList) HaveEndpoint(endpoint string) bool {
for _, en := range *e {
if en.String() == endpoint {
return true
}
}
return false
}
//CreateEndpoints CreateEndpoints
func CreateEndpoints(endpoints []string) EndpointList {
var epl EndpointList
@ -138,8 +148,13 @@ func (s *SelectBalance) Select(r *http.Request, endpoints EndpointList) Endpoint
if r.URL != nil {
hostID := r.URL.Query().Get("host_id")
if e, ok := s.hostIDMap[hostID]; ok {
return Endpoint(e)
if endpoints.HaveEndpoint(e) {
return Endpoint(e)
}
}
}
if len(endpoints) > 0 {
return endpoints[0]
}
return Endpoint(s.hostIDMap["local"])
}

View File

@ -116,6 +116,8 @@ func createPluginImageTag(image string, pluginid, version string) string {
} else {
iName = image
}
curImage := fmt.Sprintf("goodrain.me/plugin_%s_%s:%s_%s", iName, pluginid, tag, version)
return curImage
if strings.HasPrefix(iName, "plugin") {
return fmt.Sprintf("goodrain.me/%s:%s_%s", iName, pluginid, version)
}
return fmt.Sprintf("goodrain.me/plugin_%s_%s:%s_%s", iName, pluginid, tag, version)
}

View File

@ -31,8 +31,16 @@ import (
//RainbondFileConfig 云帮源码配置文件
type RainbondFileConfig struct {
Language string `yaml:"language"`
BuildPath string `yaml:"buildpath"`
Language string `yaml:"language"`
BuildPath string `yaml:"buildpath"`
Ports []Port `yaml:"ports"`
Envs map[string]string `yaml:"envs"`
}
//Port Port
type Port struct {
Port int `yaml:"port"`
Protocol string `yaml:"procotol"`
}
//ReadRainbondFile 读取云帮代码配置

View File

@ -241,6 +241,14 @@ func (d *SourceCodeParse) Parse() ParseErrorList {
d.Runtime = code.CheckRuntime(buildPath, lang)
d.memory = getRecommendedMemory(lang)
d.Procfile = code.CheckProcfile(buildPath, lang)
//handle profile env
for k, v := range rbdfileConfig.Envs {
d.envs[k] = &Env{Name: k, Value: v}
}
//handle profile port
for _, port := range rbdfileConfig.Ports {
d.ports[port.Port] = &Port{ContainerPort: port.Port, Protocol: port.Protocol}
}
return d.errors
}
@ -255,6 +263,9 @@ func getRecommendedMemory(lang code.Lang) int {
if lang == code.Nodejs {
return 512
}
if lang == code.PHP {
return 512
}
return 128
}

View File

@ -81,8 +81,8 @@ type TenantPluginBuildVersion struct {
DeployVersion string `gorm:"column:deploy_version;size:32" json:"deploy_version"`
PluginID string `gorm:"column:plugin_id;size:32" json:"plugin_id"`
Kind string `gorm:"column:kind;size:24" json:"kind"`
BaseImage string `gorm:"column:base_image;size:100" json:"base_image"`
BuildLocalImage string `gorm:"column:build_local_image;size:100" json:"build_local_image"`
BaseImage string `gorm:"column:base_image;size:200" json:"base_image"`
BuildLocalImage string `gorm:"column:build_local_image;size:200" json:"build_local_image"`
BuildTime string `gorm:"column:build_time" json:"build_time"`
Repo string `gorm:"column:repo" json:"repo"`
GitURL string `gorm:"column:git_url" json:"git_url"`

View File

@ -217,4 +217,11 @@ func (m *Manager) patchTable() {
}
}
}
//set plugin version image name length
if err := m.db.Exec("alter table tenant_plugin_build_version modify column base_image varchar(200);").Error; err != nil {
logrus.Errorf("alter table tenant_plugin_build_version error %s", err.Error())
}
if err := m.db.Exec("alter table tenant_plugin_build_version modify column build_local_image varchar(200);").Error; err != nil {
logrus.Errorf("alter table tenant_plugin_build_version error %s", err.Error())
}
}

View File

@ -40,11 +40,11 @@ Rainbond深度整合基于Kubernetes的容器管理、Service Mesh微服务架
## 架构
<img src="./docs/rainbond_architecture.png" href="http://www.rainbond.com/docs/stable/getting-started/architecture.html">
<img src="https://static.goodrain.com/images/docs/3.6/architecture/architecture.png" href="http://www.rainbond.com/docs/stable/architecture/architecture.html">
## Roadmap
点击查看Rainbond版本开发计划 [Roadmap](https://github.com/goodrain/rainbond-docs/blob/master/v3.6/roadmap.md)
点击查看Rainbond版本开发计划 [Roadmap](https://github.com/goodrain/rainbond-docs/blob/master/v3.6/architecture/roadmap.md)
## 产品图示