|
@@ -8,40 +8,46 @@ import (
|
|
|
"cicv-data-closedloop/amd64/dispatch_server/package/entity"
|
|
|
"cicv-data-closedloop/amd64/dispatch_server/package/handler"
|
|
|
"cicv-data-closedloop/common/config/c_log"
|
|
|
- "cicv-data-closedloop/common/config/c_nacos"
|
|
|
"cicv-data-closedloop/common/config/c_oss"
|
|
|
commonHandler "cicv-data-closedloop/common/gin/handler"
|
|
|
"cicv-data-closedloop/common/util"
|
|
|
- "encoding/json"
|
|
|
- "fmt"
|
|
|
+ _ "embed"
|
|
|
"github.com/gin-gonic/gin"
|
|
|
"os"
|
|
|
)
|
|
|
|
|
|
-const (
|
|
|
- configDataId = "kubernetes-scheduler-prod.yaml"
|
|
|
- configGroup = "DEFAULT_GROUP"
|
|
|
-)
|
|
|
+type ApplicationYamlStruct struct {
|
|
|
+ ApplicationName string `yaml:"application"`
|
|
|
+ Web WebStruct `yaml:"web"`
|
|
|
+ GpuNodeList []GpuNode `yaml:"gpu_node_list"`
|
|
|
+}
|
|
|
+
|
|
|
+type WebStruct struct {
|
|
|
+ Port string `yaml:"port"`
|
|
|
+ RoutePrefix string `yaml:"route-prefix"`
|
|
|
+ Token string `yaml:"token"`
|
|
|
+ WhiteList []string `yaml:"white-list"`
|
|
|
+}
|
|
|
+
|
|
|
+type GpuNode struct {
|
|
|
+ Hostname string `yaml:"hostname"`
|
|
|
+ Ip string `yaml:"ip"`
|
|
|
+ Parallelism string `yaml:"parallelism"`
|
|
|
+}
|
|
|
+
|
|
|
+type RedisStruct struct {
|
|
|
+}
|
|
|
|
|
|
var (
|
|
|
+ //go:embed application.yaml
|
|
|
+ applicationYamlBytes []byte
|
|
|
+ ApplicationYaml ApplicationYamlStruct
|
|
|
KubernetesSchedulerConfig = new(entity.KubernetesSchedulerConfigStruct)
|
|
|
)
|
|
|
|
|
|
func init() {
|
|
|
- c_nacos.InitConfig(false, configDataId, configGroup)
|
|
|
- // 使用 json.Unmarshal 解析 JSON 字符串到结构体
|
|
|
- err := json.Unmarshal([]byte(c_nacos.Config), &KubernetesSchedulerConfig)
|
|
|
- if err != nil {
|
|
|
- fmt.Println("解析 JSON 时出错:", err)
|
|
|
- return
|
|
|
- }
|
|
|
c_log.InitLog("./log/", KubernetesSchedulerConfig.Service.Name)
|
|
|
c_oss.InitOss(false)
|
|
|
- c_nacos.InitService(false, KubernetesSchedulerConfig.Service.Name, KubernetesSchedulerConfig.Service.Port, map[string]string{
|
|
|
- "开发者": "孟令鑫",
|
|
|
- "内网IP": "10.14.85.228",
|
|
|
- "外网IP": "36.110.106.156",
|
|
|
- })
|
|
|
|
|
|
}
|
|
|
|