补充mpaas模块
This commit is contained in:
parent
39d2211653
commit
02e633b2c6
5
devcloud-mini/cmdb/apps/application/README.md
Normal file
5
devcloud-mini/cmdb/apps/application/README.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
# 管理应用
|
||||||
|
|
||||||
|
1. 项目(产品) --> 应用
|
||||||
|
1. 把Namespace当作产品或者项目来用
|
||||||
|
2. SCM 代码仓库相关
|
@ -17,6 +17,10 @@ func init() {
|
|||||||
|
|
||||||
type ResourceApiHandler struct {
|
type ResourceApiHandler struct {
|
||||||
ioc.ObjectImpl
|
ioc.ObjectImpl
|
||||||
|
|
||||||
|
// @Resource(name="", namespace="")
|
||||||
|
// @Resource
|
||||||
|
// ResourceService resource.Service `ioc:"autowire=true;namespace=controllers"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *ResourceApiHandler) Name() string {
|
func (r *ResourceApiHandler) Name() string {
|
||||||
@ -28,6 +32,9 @@ func (r *ResourceApiHandler) Init() error {
|
|||||||
// api/v1/resource
|
// api/v1/resource
|
||||||
ws := gorestful.ObjectRouter(r)
|
ws := gorestful.ObjectRouter(r)
|
||||||
|
|
||||||
|
// 半自动
|
||||||
|
// r.ResourceService = resource.GetService()
|
||||||
|
|
||||||
tags := []string{"资源管理"}
|
tags := []string{"资源管理"}
|
||||||
|
|
||||||
ws.Route(ws.GET("").To(r.Search).Doc("资源检索").
|
ws.Route(ws.GET("").To(r.Search).Doc("资源检索").
|
||||||
|
2
devcloud-mini/mpaas/README.md
Normal file
2
devcloud-mini/mpaas/README.md
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# paas 平台
|
||||||
|
|
7
devcloud-mini/mpaas/apps/deploy/README.md
Normal file
7
devcloud-mini/mpaas/apps/deploy/README.md
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
# 应用部署
|
||||||
|
|
||||||
|
部署动作的合集, 部署模版
|
||||||
|
1. Deployment/..
|
||||||
|
2. ConfigMap
|
||||||
|
3. Servie
|
||||||
|
4. Ingress
|
1
devcloud-mini/mpaas/apps/deploy/interface.go
Normal file
1
devcloud-mini/mpaas/apps/deploy/interface.go
Normal file
@ -0,0 +1 @@
|
|||||||
|
package deploy
|
1
devcloud-mini/mpaas/apps/deploy/model.go
Normal file
1
devcloud-mini/mpaas/apps/deploy/model.go
Normal file
@ -0,0 +1 @@
|
|||||||
|
package deploy
|
3
devcloud-mini/mpaas/apps/k8s/README.md
Normal file
3
devcloud-mini/mpaas/apps/k8s/README.md
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# k8s 管理模块
|
||||||
|
|
||||||
|
k8s 配置文件管理, 高敏感的, 脱敏和加密 (web界面不能返回敏感信息)
|
58
devcloud-mini/mpaas/apps/k8s/interface.go
Normal file
58
devcloud-mini/mpaas/apps/k8s/interface.go
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
package k8s
|
||||||
|
|
||||||
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
|
"github.com/infraboard/mcube/v2/http/request"
|
||||||
|
request1 "github.com/infraboard/mcube/v2/pb/request"
|
||||||
|
"github.com/infraboard/mcube/v2/pb/resource"
|
||||||
|
"github.com/infraboard/mcube/v2/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
type Service interface {
|
||||||
|
QueryCluster(context.Context, *QueryClusterRequest) (types.Set[*Cluster], error)
|
||||||
|
DescribeCluster(context.Context, *DescribeClusterRequest) (*Cluster, error)
|
||||||
|
CreateCluster(context.Context, *CreateClusterRequest) (*Cluster, error)
|
||||||
|
UpdateCluster(context.Context, *UpdateClusterRequest) (*Cluster, error)
|
||||||
|
DeleteCluster(context.Context, *DeleteClusterRequest) (*Cluster, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
type QueryClusterRequest struct {
|
||||||
|
// 资源范围
|
||||||
|
Scope *resource.Scope `json:"scope"`
|
||||||
|
// 资源标签过滤
|
||||||
|
Filters []*resource.LabelRequirement `json:"filters"`
|
||||||
|
// 分页参数
|
||||||
|
Page *request.PageRequest `json:"page"`
|
||||||
|
// 关键字参数
|
||||||
|
Keywords string `json:"keywords"`
|
||||||
|
// 集群所属厂商
|
||||||
|
Vendor string `json:"vendor"`
|
||||||
|
// 集群所属地域
|
||||||
|
Region string `json:"region"`
|
||||||
|
// 集群Id列表
|
||||||
|
ClusterIds []string `json:"cluster_ids"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type DescribeClusterRequest struct {
|
||||||
|
// Cluster id
|
||||||
|
Id string `json:"id"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type UpdateClusterRequest struct {
|
||||||
|
// Cluster id
|
||||||
|
Id string `json:"id"`
|
||||||
|
// 更新模式
|
||||||
|
UpdateMode request1.UpdateMode `json:"update_mode"`
|
||||||
|
// 更新人
|
||||||
|
UpdateBy string `json:"update_by"`
|
||||||
|
// 更新时间
|
||||||
|
UpdateAt int64 `json:"update_at"`
|
||||||
|
// 更新的书本信息
|
||||||
|
Spec *CreateClusterRequest `json:"spec"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type DeleteClusterRequest struct {
|
||||||
|
// Cluster id
|
||||||
|
Id string `json:"id"`
|
||||||
|
}
|
46
devcloud-mini/mpaas/apps/k8s/model.go
Normal file
46
devcloud-mini/mpaas/apps/k8s/model.go
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
package k8s
|
||||||
|
|
||||||
|
type Cluster struct {
|
||||||
|
Id string `json:"id" bson:"_id"`
|
||||||
|
// 录入时间
|
||||||
|
CreateAt int64 `json:"create_at" bson:"create_at"`
|
||||||
|
// 更新时间
|
||||||
|
UpdateAt int64 `json:"update_at" bson:"update_at"`
|
||||||
|
// 更新人
|
||||||
|
UpdateBy string `json:"update_by" bson:"update_by"`
|
||||||
|
// 集群相关信息
|
||||||
|
ServerInfo ServerInfo `json:"server_info" bson:"server_info"`
|
||||||
|
|
||||||
|
// 集群定义信息
|
||||||
|
CreateClusterRequest
|
||||||
|
}
|
||||||
|
|
||||||
|
type ServerInfo struct {
|
||||||
|
// k8s的地址
|
||||||
|
Server string `json:"server" bson:"server"`
|
||||||
|
// k8s版本
|
||||||
|
Version string `json:"version" bson:"version"`
|
||||||
|
// 连接用户
|
||||||
|
AuthUser string `json:"auth_user" bson:"auth_user"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type CreateClusterRequest struct {
|
||||||
|
// 集群所属域
|
||||||
|
Domain string `json:"domain" form:"domain" bson:"domain"`
|
||||||
|
// 集群所属空间
|
||||||
|
Namespace string `json:"namespace" form:"namespace" bson:"namespace"`
|
||||||
|
// 创建人
|
||||||
|
CreateBy string `json:"create_by" form:"create_by" bson:"create_by"`
|
||||||
|
// 集群提供商
|
||||||
|
Provider string `json:"provider" bson:"provider" form:"provider" validate:"required"`
|
||||||
|
// 集群所处地域
|
||||||
|
Region string `json:"region" bson:"region" form:"region" validate:"required"`
|
||||||
|
// 名称
|
||||||
|
Name string `json:"name" bson:"name" form:"name" validate:"required"`
|
||||||
|
// 集群客户端访问凭证
|
||||||
|
KubeConfig string `json:"kube_config" bson:"kube_config" form:"kube_config" validate:"required"`
|
||||||
|
// 集群描述
|
||||||
|
Description string `json:"description" form:"description" bson:"description"`
|
||||||
|
// 集群标签, env=prod
|
||||||
|
Lables map[string]string `json:"lables" form:"lables" bson:"lables"`
|
||||||
|
}
|
1
devcloud-mini/mpaas/apps/registry.go
Normal file
1
devcloud-mini/mpaas/apps/registry.go
Normal file
@ -0,0 +1 @@
|
|||||||
|
package apps
|
64
devcloud-mini/mpaas/docs/design.drawio
Normal file
64
devcloud-mini/mpaas/docs/design.drawio
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
<mxfile host="65bd71144e">
|
||||||
|
<diagram id="dKE0DoaGGKq9DsSHO4Zo" name="第 1 页">
|
||||||
|
<mxGraphModel dx="852" dy="570" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" math="0" shadow="0">
|
||||||
|
<root>
|
||||||
|
<mxCell id="0"/>
|
||||||
|
<mxCell id="1" parent="0"/>
|
||||||
|
<mxCell id="3" value="" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="60" y="90" width="480" height="310" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="4" value="k8s 托管集群: 管理集群的凭证" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="185" y="40" width="220" height="30" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="5" value="k8s a" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="100" y="150" width="390" height="30" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="6" value="<span style="color: rgb(0, 0, 0);">k8s b</span>" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="100" y="190" width="390" height="30" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="7" value="k8s ..." style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="100" y="240" width="390" height="30" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="8" value="" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="100" y="290" width="390" height="30" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="9" value="" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="100" y="340" width="390" height="30" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="10" value="" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="590" y="90" width="190" height="310" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="12" value="k8s ui" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="590" y="50" width="60" height="30" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="13" value="运维,开发不一定会用" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="580" y="20" width="160" height="30" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="14" value="" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="60" y="485" width="330" height="245" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="15" value="部署接口:&nbsp; 应用" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="60" y="450" width="100" height="30" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="16" value="部署类型" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="90" y="500" width="60" height="30" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="17" value="部署配置" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="90" y="540" width="60" height="30" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="18" value="访问方式" style="text;html=1;align=center;verticalAlign=middle;whiteSpace=wrap;rounded=0;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="90" y="580" width="60" height="30" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="19" value="Deployment" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="230" y="510" width="120" height="60" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="20" value="service" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="230" y="580" width="120" height="60" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
<mxCell id="21" value="ingress" style="rounded=0;whiteSpace=wrap;html=1;" vertex="1" parent="1">
|
||||||
|
<mxGeometry x="230" y="650" width="120" height="60" as="geometry"/>
|
||||||
|
</mxCell>
|
||||||
|
</root>
|
||||||
|
</mxGraphModel>
|
||||||
|
</diagram>
|
||||||
|
</mxfile>
|
12
devcloud-mini/mpaas/main.go
Normal file
12
devcloud-mini/mpaas/main.go
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
// 启动Ioc
|
||||||
|
"github.com/infraboard/mcube/v2/ioc/server/cmd"
|
||||||
|
// 非功能组件
|
||||||
|
_ "github.com/infraboard/mcube/v2/ioc/apps/apidoc/restful"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
cmd.Start()
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user