mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-12-02 19:57:42 +08:00
Merge branch 'master' of code.goodrain.com:goodrain/rainbond
This commit is contained in:
commit
4f0c73c3c7
41
Makefile
41
Makefile
@ -8,6 +8,7 @@ clean:
|
||||
@rm -rf ./build/api/${BASE_NAME}_api
|
||||
@rm -rf ./build/node/${BASE_NAME}_node
|
||||
@rm -rf ./build/builder/${BASE_NAME}_builder
|
||||
@rm -rf ./release/
|
||||
|
||||
run-api:build-api
|
||||
./build/api/${BASE_NAME}_api --log-level=debug --mysql="admin:admin@tcp(127.0.0.1:3306)/region" --kube-config="`PWD`/admin.kubeconfig"
|
||||
@ -58,23 +59,32 @@ build-grctl:
|
||||
build-api:
|
||||
go build ${GO_LDFLAGS} -o ./build/api/${BASE_NAME}_api ./cmd/api
|
||||
build-webcli:
|
||||
go build ${GO_LDFLAGS} -o ./build/webcli/${BASE_NAME}_webcli ./cmd/webcli
|
||||
go build ${GO_LDFLAGS} -o ./build/webcli/${BASE_NAME}_webcli ./cmd/webcli
|
||||
|
||||
build-deb:
|
||||
@bash ./release.sh build
|
||||
@bash ./release.sh deb
|
||||
build-rpm:
|
||||
@bash ./release.sh build
|
||||
@bash ./release.sh rpm
|
||||
build-pkg:
|
||||
@bash ./release.sh
|
||||
|
||||
all-image: build-image-worker build-image-mq build-image-builder build-image-entrance build-image-eventlog build-image-api build-image-webcli
|
||||
build-image-worker:
|
||||
@echo "🐳 $@"
|
||||
@docker run -v `pwd`:${WORK_DIR} -w ${WORK_DIR} -it golang:1.8.3 go build ${GO_LDFLAGS} -o ./build/worker/${BASE_NAME}_worker ./cmd/worker
|
||||
@docker build -t hub.goodrain.com/dc-deploy/${BASE_NAME}_worker:${VERSION} ./build/worker
|
||||
@docker build -t hub.goodrain.com/${BASE_NAME}/worker:${VERSION} ./build/worker
|
||||
@rm -f ./build/worker/${BASE_NAME}_worker
|
||||
build-image-mq:
|
||||
@echo "🐳 $@"
|
||||
@docker run -v `pwd`:${WORK_DIR} -w ${WORK_DIR} -it golang:1.8.3 go build ${GO_LDFLAGS} -o ./build/mq/${BASE_NAME}_mq ./cmd/mq
|
||||
@docker build -t hub.goodrain.com/dc-deploy/${BASE_NAME}_mq:${VERSION} ./build/mq
|
||||
@docker build -t hub.goodrain.com/${BASE_NAME}/mq:${VERSION} ./build/mq
|
||||
@rm -f ./build/mq/${BASE_NAME}_mq
|
||||
build-image-builder:
|
||||
@echo "🐳 $@"
|
||||
@docker run -v `pwd`:${WORK_DIR} -w ${WORK_DIR} -it golang:1.8.3 go build ${GO_LDFLAGS} -o ./build/builder/${BASE_NAME}_builder ./cmd/builder
|
||||
@docker build -t hub.goodrain.com/dc-deploy/${BASE_NAME}_chaos:${VERSION} ./build/builder
|
||||
@docker build -t hub.goodrain.com/${BASE_NAME}/chaos:${VERSION} ./build/builder
|
||||
@rm -f ./build/builder/${BASE_NAME}_builder
|
||||
build-image-node:
|
||||
@echo "🐳 $@"
|
||||
@ -83,7 +93,7 @@ build-image-entrance:
|
||||
@echo "🐳 $@"
|
||||
@docker run -v `pwd`:${WORK_DIR} -w ${WORK_DIR} -it golang:1.8.3 go build ${GO_LDFLAGS} -o ./build/entrance/${BASE_NAME}_entrance ./cmd/entrance
|
||||
@cp -r ./build/dist ./build/entrance/dist
|
||||
@docker build -t hub.goodrain.com/dc-deploy/${BASE_NAME}_entrance:${VERSION} ./build/entrance
|
||||
@docker build -t hub.goodrain.com/${BASE_NAME}/entrance:${VERSION} ./build/entrance
|
||||
@rm -rf ./build/entrance/dist
|
||||
@rm -f ./build/entrance/${BASE_NAME}_entrance
|
||||
build-image-eventlog:
|
||||
@ -92,27 +102,26 @@ build-image-eventlog:
|
||||
@echo "building..."
|
||||
@docker run --rm -v `pwd`:${WORK_DIR} -w ${WORK_DIR} goodraim.me/event-build:v1 go build ${GO_LDFLAGS} -o ./build/eventlog/${BASE_NAME}_eventlog ./cmd/eventlog
|
||||
@echo "build done."
|
||||
@docker build -t hub.goodrain.com/dc-deploy/${BASE_NAME}_eventlog:${VERSION} ./build/eventlog
|
||||
@docker build -t hub.goodrain.com/${BASE_NAME}/eventlog:${VERSION} ./build/eventlog
|
||||
@rm -f ./build/entrance/${BASE_NAME}_eventlog
|
||||
build-image-api:
|
||||
@echo "🐳 $@"
|
||||
@docker run -v `pwd`:${WORK_DIR} -w ${WORK_DIR} -it golang:1.8.3 go build ${GO_LDFLAGS} -o ./build/api/${BASE_NAME}_api ./cmd/api
|
||||
@docker build -t hub.goodrain.com/dc-deploy/${BASE_NAME}_api:${VERSION} ./build/api
|
||||
@docker build -t hub.goodrain.com/${BASE_NAME}/api:${VERSION} ./build/api
|
||||
@rm -f ./build/api/${BASE_NAME}_api
|
||||
build-image-webcli:
|
||||
@echo "🐳 $@"
|
||||
@docker run -v `pwd`:${WORK_DIR} -w ${WORK_DIR} -it golang:1.8.3 go build ${GO_LDFLAGS} -o ./build/webcli/${BASE_NAME}_webcli ./cmd/webcli
|
||||
@docker build -t hub.goodrain.com/dc-deploy/${BASE_NAME}_webcli:${VERSION} ./build/webcli
|
||||
@docker build -t hub.goodrain.com/${BASE_NAME}/webcli:${VERSION} ./build/webcli
|
||||
@rm -f ./build/webcli/${BASE_NAME}_webcli
|
||||
push-image:
|
||||
docker push hub.goodrain.com/dc-deploy/${BASE_NAME}_eventlog:${VERSION}
|
||||
docker push hub.goodrain.com/dc-deploy/${BASE_NAME}_entrance:${VERSION}
|
||||
docker push hub.goodrain.com/dc-deploy/${BASE_NAME}_chaos:${VERSION}
|
||||
docker push hub.goodrain.com/dc-deploy/${BASE_NAME}_mq:${VERSION}
|
||||
docker push hub.goodrain.com/dc-deploy/${BASE_NAME}_worker:${VERSION}
|
||||
docker push hub.goodrain.com/dc-deploy/${BASE_NAME}_webcli:${VERSION}
|
||||
docker push hub.goodrain.com/dc-deploy/${BASE_NAME}_api:${VERSION}
|
||||
|
||||
docker push hub.goodrain.com/${BASE_NAME}/eventlog:${VERSION}
|
||||
docker push hub.goodrain.com/${BASE_NAME}/entrance:${VERSION}
|
||||
docker push hub.goodrain.com/${BASE_NAME}/chaos:${VERSION}
|
||||
docker push hub.goodrain.com/${BASE_NAME}/mq:${VERSION}
|
||||
docker push hub.goodrain.com/${BASE_NAME}/worker:${VERSION}
|
||||
docker push hub.goodrain.com/${BASE_NAME}/webcli:${VERSION}
|
||||
docker push hub.goodrain.com/${BASE_NAME}/api:${VERSION}
|
||||
|
||||
|
||||
|
||||
|
@ -7,7 +7,7 @@ if [ -z $NODE_TYPE ];then
|
||||
eval $(ssh-agent) > /dev/null
|
||||
eval $(ssh-add) > /dev/null
|
||||
#eval $(ssh-add /path/key) > /dev/null
|
||||
ACP_NODE_OPTS="--static-task-path=/usr/share/gr-rainbond-node/gaops/tasks/ --etcd=http://$ETCD_ADDR:2379 --hostIP=$HOSTIP --kube-conf=/etc/goodrain/kubernetes/kubeconfig --run-mode master --noderule manage"
|
||||
ACP_NODE_OPTS="--static-task-path=/usr/share/gr-rainbond-node/gaops/tasks/ --etcd=http://$ETCD_ADDR:2379 --hostIP=$HOSTIP --kube-conf=/etc/goodrain/kubernetes/kubeconfig --run-mode master --noderule manage,compute"
|
||||
else
|
||||
ACP_NODE_OPTS='--log-level=debug'
|
||||
fi
|
||||
|
@ -7,7 +7,7 @@ if [ -z $NODE_TYPE ];then
|
||||
eval $(ssh-agent) > /dev/null
|
||||
eval $(ssh-add) > /dev/null
|
||||
#eval $(ssh-add /path/key) > /dev/null
|
||||
ACP_NODE_OPTS="--static-task-path=/usr/share/gr-rainbond-node/gaops/tasks/ --etcd=http://$ETCD_ADDR:2379 --kube-conf=/etc/goodrain/kubernetes/kubeconfig --hostIP=$HOSTIP --run-mode master --noderule manage"
|
||||
ACP_NODE_OPTS="--static-task-path=/usr/share/gr-rainbond-node/gaops/tasks/ --etcd=http://$ETCD_ADDR:2379 --kube-conf=/etc/goodrain/kubernetes/kubeconfig --hostIP=$HOSTIP --run-mode master --noderule manage,compute"
|
||||
else
|
||||
ACP_NODE_OPTS='--log-level=debug'
|
||||
fi
|
||||
|
@ -129,10 +129,10 @@ type PieceHTTPVirtualHost struct {
|
||||
|
||||
//PieceHTTPRoutes PieceHTTPRoutes
|
||||
type PieceHTTPRoutes struct {
|
||||
TimeoutMS int `json:"timeout_ms"`
|
||||
Prefix string `json:"prefix"`
|
||||
Cluster string `json:"cluster"`
|
||||
Headers []*PieceHeader `json:"headers"`
|
||||
TimeoutMS int `json:"timeout_ms"`
|
||||
Prefix string `json:"prefix"`
|
||||
Cluster string `json:"cluster"`
|
||||
//Headers []*PieceHeader `json:"headers"`
|
||||
}
|
||||
|
||||
//PieceHeader PieceHeader
|
||||
|
@ -175,17 +175,19 @@ func (d *DiscoverAction) DiscoverListeners(
|
||||
envName := fmt.Sprintf("%s_%d", destServiceAlias, port)
|
||||
var sr api_model.NetDownStreamRules
|
||||
mr, err := d.ToolsGetStreamRules(namespace, node_model.DOWNSTREAM, envName, &sr)
|
||||
if err != nil {
|
||||
if err != nil && !strings.Contains(err.Error(), "is not exist") {
|
||||
logrus.Warnf("get env %s error, %v", envName, err)
|
||||
continue
|
||||
}
|
||||
sr = mr.(api_model.NetDownStreamRules)
|
||||
if mr != nil {
|
||||
sr = mr.(api_model.NetDownStreamRules)
|
||||
}
|
||||
prs := &node_model.PieceHTTPRoutes{
|
||||
TimeoutMS: 0,
|
||||
Prefix: d.ToolsGetRouterItem(destServiceAlias, node_model.PREFIX, &sr).(string),
|
||||
Cluster: fmt.Sprintf("%s_%s_%d", namespace, destServiceAlias, port),
|
||||
Headers: d.ToolsGetRouterItem(destServiceAlias,
|
||||
node_model.HEADERS, &sr).([]*node_model.PieceHeader),
|
||||
//Headers: d.ToolsGetRouterItem(destServiceAlias,
|
||||
// node_model.HEADERS, &sr).([]*node_model.PieceHeader),
|
||||
}
|
||||
pvh := &node_model.PieceHTTPVirtualHost{
|
||||
Name: fmt.Sprintf("%s_%s_%d", namespace, destServiceAlias, port),
|
||||
@ -212,16 +214,22 @@ func (d *DiscoverAction) DiscoverListeners(
|
||||
return nil, util.CreateAPIHandleError(500, err)
|
||||
}
|
||||
}
|
||||
if httpPort == nil {
|
||||
httpPort = 80
|
||||
}
|
||||
hsf := &node_model.HTTPSingleFileter{
|
||||
Type: "decoder",
|
||||
Name: "router",
|
||||
Config: make(map[string]string),
|
||||
}
|
||||
rcg := &node_model.RouteConfig{
|
||||
VirtualHosts: vhL,
|
||||
}
|
||||
lhc := &node_model.LDSHTTPConfig{
|
||||
CodecType: "auto",
|
||||
StatPrefix: "ingress_http",
|
||||
//RouteConfig: rcg,
|
||||
Filters: []*node_model.HTTPSingleFileter{hsf},
|
||||
CodecType: "auto",
|
||||
StatPrefix: "ingress_http",
|
||||
RouteConfig: rcg,
|
||||
Filters: []*node_model.HTTPSingleFileter{hsf},
|
||||
}
|
||||
lfs := &node_model.LDSFilters{
|
||||
Name: "http_connection_manager",
|
||||
@ -271,12 +279,14 @@ func (d *DiscoverAction) DiscoverClusters(
|
||||
envName := fmt.Sprintf("%s_%d", destServiceAlias, port.Port)
|
||||
var sr api_model.NetDownStreamRules
|
||||
mr, err := d.ToolsGetStreamRules(namespace, node_model.DOWNSTREAM, envName, &sr)
|
||||
if err != nil {
|
||||
if err != nil && !strings.Contains(err.Error(), "is not exist") {
|
||||
logrus.Warnf("trans k %v error, %v", envName, err)
|
||||
continue
|
||||
}
|
||||
mc := mr.(*api_model.NetDownStreamRules)
|
||||
circuits := d.ToolsGetRouterItem(destServiceAlias, node_model.LIMITS, mc).(int)
|
||||
if mr != nil {
|
||||
sr = mr.(api_model.NetDownStreamRules)
|
||||
}
|
||||
circuits := d.ToolsGetRouterItem(destServiceAlias, node_model.LIMITS, &sr).(int)
|
||||
cb := &node_model.CircuitBreakers{
|
||||
Default: &node_model.MaxConnections{
|
||||
MaxConnections: circuits,
|
||||
@ -373,6 +383,9 @@ func (d *DiscoverAction) ToolsGetRouterItem(
|
||||
return "/"
|
||||
case node_model.LIMITS:
|
||||
if sr.Limit != 0 {
|
||||
if sr.Limit == 1025 {
|
||||
return 0
|
||||
}
|
||||
return sr.Limit
|
||||
}
|
||||
return 1024
|
||||
@ -388,8 +401,8 @@ func (d *DiscoverAction) ToolsGetRouterItem(
|
||||
}
|
||||
}
|
||||
ph := &node_model.PieceHeader{
|
||||
Name: "host",
|
||||
Value: destAlias,
|
||||
Name: "Connection",
|
||||
Value: "keep-alive",
|
||||
}
|
||||
phL = append(phL, ph)
|
||||
return phL
|
||||
@ -397,7 +410,7 @@ func (d *DiscoverAction) ToolsGetRouterItem(
|
||||
if sr.Domain != nil {
|
||||
return sr.Domain
|
||||
}
|
||||
return []string{destAlias}
|
||||
return []string{"*"}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
@ -420,8 +433,8 @@ func (d *DiscoverAction) ToolsGetStreamRules(
|
||||
return nil, util.CreateAPIHandleError(500, err)
|
||||
}
|
||||
} else {
|
||||
logrus.Errorf("key %s is not exist,", envName)
|
||||
return nil, util.CreateAPIHandleError(404, fmt.Errorf("key %s is not exist, ", envName))
|
||||
logrus.Debugf("key %s is not exist,", envName)
|
||||
return nil, nil
|
||||
}
|
||||
if err := ffjson.Unmarshal([]byte(ss.SourceBody.EnvVal), rule); err != nil {
|
||||
logrus.Errorf("umashal value error, %v", err)
|
||||
|
@ -692,7 +692,7 @@ func (p *PodTemplateSpecBuild) createEnv() (*[]v1.EnvVar, error) {
|
||||
func (p *PodTemplateSpecBuild) createPluginsContainer(mainEnvs *[]v1.EnvVar) ([]v1.Container, []v1.Container, error) {
|
||||
var containers []v1.Container
|
||||
var initContainers []v1.Container
|
||||
if len(p.pluginsRelation) == 0 {
|
||||
if len(p.pluginsRelation) == 0 && !p.needProxy {
|
||||
return nil, containers, nil
|
||||
}
|
||||
netPlugin := false
|
||||
|
@ -34,7 +34,7 @@ function prepare() {
|
||||
cd $releasedir/tmp
|
||||
rm -rf .git
|
||||
|
||||
tar zcvf ../dist/usr/share/gr-rainbond-node/gaops/gaops.tgz ./
|
||||
tar zcf ../dist/usr/share/gr-rainbond-node/gaops/gaops.tgz ./
|
||||
cd $path
|
||||
rm -rf $releasedir/tmp
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user