Merge pull request #366 from fanyangyang/fix/nolog

Fix/nolog
This commit is contained in:
barnettZQG 2019-08-18 18:27:23 +08:00 committed by GitHub
commit bf3039df95
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 79 additions and 152 deletions

View File

@ -1,4 +1,4 @@
<img src="./docs/rainbond_logo.png" width="100%">
<img src="https://grstatic.oss-cn-shanghai.aliyuncs.com/images/rainbond%20log_full.png" width="80%">
[![Go Report Card](https://goreportcard.com/badge/github.com/goodrain/rainbond)](https://goreportcard.com/report/github.com/goodrain/rainbond)
[![GitHub stars](https://img.shields.io/github/stars/goodrain/rainbond.svg?style=flat-square)](https://github.com/goodrain/rainbond/stargazers)
@ -6,15 +6,19 @@
[![Build Status](https://travis-ci.org/goodrain/rainbond.svg?branch=master)](https://travis-ci.org/goodrain/rainbond)
[![GoDoc](https://godoc.org/github.com/goodrain/rainbond?status.svg)](https://godoc.org/github.com/goodrain/rainbond)
[项目官网](http://www.rainbond.com) • [文档](https://www.rainbond.com/docs/) • [README in English](https://github.com/goodrain/rainbond/blob/master/README_EN.md)
[项目官网](http://www.rainbond.com) • [文档](https://www.rainbond.com/docs/)
**Rainbond** 企业应用云操作系统
Rainbond云帮是企业应用的操作系统。 Rainbond支撑企业应用的开发、架构、交付和运维的全流程通过“无侵入”架构无缝衔接各类企业应用底层资源可以对接和管理IaaS、虚拟机和物理服务器。
Rainbond云帮是云原生下企业应用操作系统。 Rainbond支撑企业应用的开发、架构、交付和运维的全流程通过“无侵入”架构无缝衔接各类企业应用底层资源可以对接和管理IaaS、虚拟机和物理服务器。
```
企业应用包括:
各类信息系统、OA、CRM、ERP、数据库、大数据、物联网、互联网平台、微服务架构等运行在企业内部的各种系统
各类信息系统、OA、CRM、ERP、数据库、大数据、物联网、互联网平台、微服务架构等运行在企业内部的各种系统
```
<img src="https://grstatic.oss-cn-shanghai.aliyuncs.com/images/Rainbond%E4%BA%A7%E5%93%81%E6%9E%B6%E6%9E%84.png" width="100%">
## 应用场景
* 企业应用开发
@ -33,21 +37,22 @@ DevOps开发流水线、微服务架构、服务治理及各类技术工具“
| 特性 | 描述 |
| -------------------------- | ------------------------------------------------------------ |
| 超越Kubernetes | 平台底层基于Kubernetes但用户无需学习和编辑复杂的yaml文件通过应用级图形界面操作使用实现业务流程开箱即用。 |
| 原生Service Mesh微服务架构 | 跨语言、跨协议、代码无侵入的Service Mesh微服务架构原生支持传统应用直接变成微服务架构。同时支持常见微服务架构Spring Cloud、Dubbo等通过插件扩展架构能力及治理功能。 |
| Kubernetes | 平台底层基于Kubernetes但用户无需学习和编辑复杂的yaml文件通过应用级图形界面操作使用实现业务流程开箱即用。 |
| Service Mesh微服务架构 | 内置跨语言、跨协议、代码无侵入的Service Mesh微服务架构原生支持传统应用直接变成微服务架构。同时支持常见微服务架构Spring Cloud、Dubbo等通过插件扩展架构能力及治理功能。 |
| 一体化DevOps | 衔接需求、开发、测试、构建、上线、运维的一体化DevOps。支持对接第三方软件Jira、Sonar、Jenkins、Gitlab等 |
| 企业级应用市场 | 非镜像市场和服务目录,支持各类企业级应用,像手机应用一样即点即用,全流程管理(应用开发、应用发布、应用展示、应用离线导入/导出、应用安装/升级、应用运维) |
| 自动化运维 | 应用自动化运维。节点自动安装、扩容、监控、容错。平台支持高可用、多数据中心管理、多租户管理。 |
| Serverless PaaS | 以应用为核心使用过程不需要了解服务器相关概念简单灵活。通过对接行业应用快速构建行业专有PaaS。 |
| 应用网关 | 基于HTTP、HTTPs、TCP、UDP等协议应用访问控制策略轻松操作应用灰度发布、A/B测试。 |
| 异构服务统一管理 | 支持集群内外不同架构服务统一管理和通信治理 |
| 异构服务统一管理 | 支持集群内外不同架构服务统一管理、监控和通信治理。 |
更多功能特性详见: [Rainbond功能特性说明](https://www.rainbond.com/docs/quick-start/edition/)
## 快速开始
1. [安装 Rainbond 集群](https://www.rainbond.com/docs/quick-start/rainbond_install/)
1. [快速安装 Rainbond 集群](https://www.rainbond.com/docs/quick-start/rainbond_install/)
2. [创建第一个应用(服务)](https://www.rainbond.com/docs/user-manual/app-creation/)
3. [搭建 ServiceMesh 微服务架构](https://www.rainbond.com/docs/advanced-scenarios/micro/)
3. [观看教程视频快速学习Rainbond](https://www.rainbond.com/video.html)
4. [搭建 ServiceMesh 微服务架构](https://www.rainbond.com/docs/advanced-scenarios/micro/)
## 社区
@ -55,40 +60,28 @@ DevOps开发流水线、微服务架构、服务治理及各类技术工具“
[Rainbond 项目官网](https://www.rainbond.com)
<center><img width="200px" src="https://t.goodrain.com/uploads/default/original/2X/6/6591ae9e78a9c7d65bfb260f741ac3985662cc51.jpg"/></center>
<center><img width="200px" src="https://grstatic.oss-cn-shanghai.aliyuncs.com/images/12141565594759_.pic_hd.jpg"/></center>
<center> 添加微信申请加入微信群了解Rainbond更多资讯 </center>
## 开发路线计划
点击查看 Rainbond 版本开发计划 [Roadmap](https://www.rainbond.com/docs/quick-start/roadmap/)
## 架构
<img src="https://static.goodrain.com/images/docs/5.0/architecture/architecture.svg" href="https://www.rainbond.com/docs/architecture/architecture/">
## 产品图示
<img src="https://grstatic.oss-cn-shanghai.aliyuncs.com/images/docs/5.0/readme/connect.gif" href="http://www.rainbond.com/docs">
- 应用组装部署示意图
<img src="https://grstatic.oss-cn-shanghai.aliyuncs.com/images/docs/5.0/readme/gateway.gif" href="http://www.rainbond.com/docs">
- 应用网关管理示意图
## 参与贡献
你可以参与Rainbond社区关于平台、应用、插件等领域的贡献和分享。
[参与Rainbond项目](https://www.rainbond.com/docs/contribution/)
[Rainbond 贡献者社区](https://t.goodrain.com/c/contribution)
## 相关项目
* [Rainbond-Console](https://github.com/goodrain/rainbond-console) Rainbond控制台业务层
* [Rainbond-Console-UI](https://github.com/goodrain/rainbond-ui) Rainbond控制台UI组件
* [Rainbond-Install](https://github.com/goodrain/rainbond-ansible) Rainbond安装工具
当前仓库为Rainbond数据中心端核心服务实现代码项目还包括以下子项目
* [Rainbond-Console](https://github.com/goodrain/rainbond-console) Rainbond控制台服务端
* [Rainbond-Console-UI](https://github.com/goodrain/rainbond-ui) Rainbond控制台前端
* [Rainbond-Ansible](https://github.com/goodrain/rainbond-ansible) Rainbond安装工具
* [Rainbond-Builder](https://github.com/goodrain/builder) Rainbond源码构建工具集
* [Rainbond-Docs](https://github.com/goodrain/rainbond-docs) Rainbond文档
* Rainbond-Resource/UI (企业版)
* Rainbond-APP-Store (企业版)
## License

View File

@ -1,115 +0,0 @@
<img src="./docs/rainbond_logo.png" width="100%">
[![Go Report Card](https://goreportcard.com/badge/github.com/goodrain/rainbond)](https://goreportcard.com/report/github.com/goodrain/rainbond)
[![GitHub stars](https://img.shields.io/github/stars/goodrain/rainbond.svg?style=flat-square)](https://github.com/goodrain/rainbond/stargazers)
![Rainbond version](https://img.shields.io/badge/version-v5.1-brightgreen.svg)
[![Build Status](https://travis-ci.org/goodrain/rainbond.svg?branch=master)](https://travis-ci.org/goodrain/rainbond)
[![GoDoc](https://godoc.org/github.com/goodrain/rainbond?status.svg)](https://godoc.org/github.com/goodrain/rainbond)
[项目官网](http://www.rainbond.com) • [文档](https://www.rainbond.com/docs/) • [README in English](https://github.com/goodrain/rainbond/blob/master/README_EN.md)
## **Rainbond** ENTERPRISE APPLICATION CLOUD OS
Rainbond云帮是企业应用的操作系统。 Rainbond支撑企业应用的开发、架构、交付和运维的全流程通过“无侵入”架构无缝衔接各类企业应用底层资源可以对接和管理IaaS、虚拟机和物理服务器。
Rainbond is a cloud OS for enterprise applications. It provides complete set of supports for enterprise applications' development, architecture, delivery and operation, can seamlessly docking almost all kinds of enterprise applications through "non-invasive" platform architecture, interface and manage underlying computing resources such as IaaS, virtual machine and physical servers.
```
Enterprise Applications include
information system, OA, CRM, ERP, database, big data, IOT, internet platform and microservice architecture etc.
```
## Be applied to
* Enterprise Application Developement
The development environment, micro-service architecture, service governance and various technical tools are “out of the box”, without changing development habits, allowing companies to focus on their business and improving efficiency by 10 times.
* Enterprise Application Delivery
Support continuous delivery, enterprise application market delivery, SaaS, enterprise application sales, secondary development and other delivery processes, unified customer management, and balanced delivery and personalized delivery.
* Enterprise Application Operation
Transparently interfaces and manages a variety of computing resources, naturally achieves cloudy and hybrid clouds, enterprise application automation and operation, and doubles resource utilization.
## Features
| Features | Description |
| -------------------------- | ------------------------------------------------------------ |
| beyond Kubernetes | based on kubernetes, but users do not need to learn and edit complex yaml files, achieved "out-of-the-box" business process by application-level graphical interface |
| native Service Mesh microservice architecture | Thanks to the cross-language, cross-protocol, code-free service Mesh microservices architecture native support, traditional applications can become microservice architecture directly. Support Spring Cloud, Dubbo, etc., and can easily expand the architectural capabilities and governance functions by adding plug-ins. |
| Integrated DevOps | Integrate DevOps for demand, development, testing, construction, online, and operation and maintenance. Support for docking third party software (Jira, Sonar, Jenkins, Gitlab, etc.) |
| Enterpeise-level application market | Not a simple mirror market and service catalog, but supports all kinds of enterprise-level applications, just like install and manage mobile apps, click-to-use, full process management (application development, application publishing, application display, application offline import/export, application installation/upgrade, application operation and maintenance) |
| Automated operation and maintenance | Automated application operation and maintenance. Nodes are automatically installed, expanded, monitored, and fault tolerant. The platform supports high availability, multiple data center management, and multi-tenant management. |
| Serverless PaaS | With the application-centric design philosophy, users do not need to understand the server-related concepts, and is simple and flexible. Quickly build industry-specific PaaS through docking industry applications. |
| Application Gateway | Applying access control policies based on protocols such as HTTP, HTTPs, TCP, and UDP, it is easy to operate grayscale publishing and A/B testing. |
More features [Rainbond features description](https://www.rainbond.com/docs/quick-start/edition/)
## Quick Start
1. [install Rainbond cluster](https://www.rainbond.com/docs/quick-start/rainbond_install/)
2. [create the first application / service](https://www.rainbond.com/docs/user-manual/app-creation/service_create/)
3. [build ServiceMesh microservice architecture](https://www.rainbond.com/docs/advanced-scenarios/micro/)
## Community
[Rainbond forum](https://t.goodrain.com)
[Rainbond website](https://www.rainbond.com)
## Roadmap
See [Rainbond Roadmap](https://www.rainbond.com/docs/quick-start/roadmap/)
## Architecture
<img src="https://static.goodrain.com/images/docs/5.0/architecture/architecture.svg" href="https://www.rainbond.com/docs/architecture/architecture/">
## Snapshot
<img src="https://grstatic.oss-cn-shanghai.aliyuncs.com/images/docs/5.0/readme/connect.gif" href="http://www.rainbond.com/docs/">
- Application assembly deployment diagram
<img src="https://grstatic.oss-cn-shanghai.aliyuncs.com/images/docs/5.0/readme/gateway.gif" href="http://www.rainbond.com/docs/">
- Application gateway management schematic diagram
## Contribution
You can participate in the Rainbond community's contributions and sharing on platforms, applications, plugins, and more.
[Participate in Rainbond Project](https://www.rainbond.com/docs/contribution/)
[Rainbond Contribution](https://t.goodrain.com/c/contribution)
## Related Projects
* [Rainbond-Console](https://github.com/goodrain/rainbond-console)
* [Rainbond-Console-UI](https://github.com/goodrain/rainbond-ui)
* [Rainbond-Install](https://github.com/goodrain/rainbond-ansible)
* [Rainbond-Builder](https://github.com/goodrain/builder)
* [Rainbond-Docs](https://github.com/goodrain/rainbond-docs)
## License
Rainbond is released under LGPL-3.0 license, see [LICENSE](https://github.com/goodrain/rainbond/blob/master/LICENSE) and [Licensing](https://github.com/goodrain/rainbond/blob/master/Licensing.md)。
## Special THANKS
Thanks to the following open source projects
- [Kubernetes](https://github.com/kubernetes/kubernetes)
- [Docker/Moby](https://github.com/moby/moby)
- [Heroku Buildpacks](https://github.com/heroku?utf8=%E2%9C%93&q=buildpack&type=&language=)
- [OpenResty](https://github.com/openresty/)
- [Calico](https://github.com/projectcalico)
- [Midonet](https://github.com/midonet/midonet)
- [Etcd](https://github.com/coreos/etcd)
- [Prometheus](https://github.com/prometheus/prometheus)
- [GlusterFS](https://github.com/gluster/glusterfs)
- [Ceph](https://github.com/ceph/ceph)
- [CockroachDB](https://github.com/cockroachdb/cockroach)
- [MySQL](https://github.com/mysql/mysql-server)
- [Weave Scope](https://github.com/weaveworks/scope)
- [Ant Design](https://github.com/ant-design/ant-design)

View File

@ -49,6 +49,8 @@ type Manager interface {
Close() error
ReleaseLogger(Logger)
}
// EventConfig event config struct
type EventConfig struct {
EventLogServers []string
DiscoverAddress []string
@ -263,6 +265,7 @@ func (m *manager) getLBChan() chan []byte {
m.qos = atomic.AddInt32(&(m.qos), 1)
server := m.eventServer[index]
if _, ok := m.abnormalServer[server]; ok {
logrus.Warnf("server[%s] is abnormal, skip it", server)
continue
}
if h, ok := m.handles[server]; ok {
@ -431,6 +434,7 @@ func (l *loggerWriter) Write(b []byte) (n int, err error) {
if l.fmt != "" {
message = fmt.Sprintf(l.fmt, message)
}
logrus.Debugf("step: %s, level: %s;write message : %v", l.step, l.level, message)
l.l.send(message, map[string]string{"step": l.step, "level": l.level})
}
return len(b), nil

View File

@ -50,6 +50,7 @@ type NodeService struct {
func CreateNodeService(c *option.Conf, nodecluster *node.Cluster, kubecli kubecache.KubeClient) *NodeService {
if err := event.NewManager(event.EventConfig{
DiscoverAddress: c.Etcd.Endpoints,
EventLogServers: c.EventLogServer,
}); err != nil {
logrus.Errorf("create event manager faliure")
}
@ -157,11 +158,6 @@ func (n *NodeService) AsynchronousInstall(node *client.HostNode, eventID string)
logrus.Error("write hosts file error ", err.Error())
return
}
if err := event.NewManager(event.EventConfig{
DiscoverAddress: n.c.Etcd.Endpoints,
}); err != nil {
logrus.Errorf("create event manager faliure")
}
// start add node script
logrus.Infof("Begin install node %s", node.ID)
// write log to event log
@ -177,9 +173,10 @@ func (n *NodeService) AsynchronousInstall(node *client.HostNode, eventID string)
Stdout: logger.GetWriter("node-install", "info"),
Stderr: logger.GetWriter("node-install", "err"),
}
err = ansibleUtil.RunNodeInstallCmd(option)
if err != nil {
logrus.Error("Error executing shell script", err)
logrus.Error("Error executing shell script : ", err)
node.Status = client.InstallFailed
node.NodeStatus.Status = client.InstallFailed
n.nodecluster.UpdateNode(node)

View File

@ -0,0 +1,38 @@
package service
import (
"testing"
"github.com/goodrain/rainbond/cmd/node/option"
"github.com/goodrain/rainbond/event"
etcdClient "github.com/coreos/etcd/clientv3"
"github.com/goodrain/rainbond/node/core/store"
"github.com/goodrain/rainbond/node/masterserver"
"github.com/goodrain/rainbond/node/masterserver/node"
"github.com/goodrain/rainbond/node/nodem/client"
)
func TestAsynchronousInstall(t *testing.T) {
config := &option.Conf{
Etcd: etcdClient.Config{Endpoints: []string{"192.168.195.1:2379"}},
EventLogServer: []string{"192.168.195.1:6366"},
}
store.NewClient(config)
// node *client.HostNode, eventID string
eventID := "fanyangyang"
// nodemanager := nodem.NewNodeManager(&option.Conf{})
currentNode := client.HostNode{
ID: "123",
Role: []string{"manage"},
InternalIP: "127.0.0.1",
RootPass: "password",
}
cluster := node.CreateCluster(nil, &currentNode, nil)
cluster.CacheNode(&currentNode)
ms := &masterserver.MasterServer{Cluster: cluster}
nodeService := CreateNodeService(config, ms.Cluster, nil)
nodeService.AsynchronousInstall(&currentNode, eventID)
event.GetManager().Close()
}

View File

@ -938,7 +938,17 @@ func (a *appRuntimeStore) GetTenantResource(tenantID string) *v1.TenantResource
}
calculateResourcesfunc := func(pod *corev1.Pod, res map[string]int64) {
runningC := make(map[string]struct{})
cstatus := append(pod.Status.ContainerStatuses, pod.Status.InitContainerStatuses...)
for _, c := range cstatus {
if c.State.Running != nil {
runningC[c.Name] = struct{}{}
}
}
for _, container := range pod.Spec.Containers {
if _, ok := runningC[container.Name]; !ok {
continue
}
cpulimit := container.Resources.Limits.Cpu()
memorylimit := container.Resources.Limits.Memory()
cpurequest := container.Resources.Requests.Cpu()