diff --git a/api/docs.go b/api/docs.go index 0b38686..683d727 100644 --- a/api/docs.go +++ b/api/docs.go @@ -580,23 +580,23 @@ const docTemplate = `{ "example": "no" }, "label": { - "description": "Label is for describing the mcis in a keyword (any string can be used)", + "description": "Label is for describing the mci in a keyword (any string can be used)", "type": "string", "example": "DynamicVM" }, "name": { "type": "string", - "example": "mcis01" + "example": "mci01" }, "systemLabel": { - "description": "SystemLabel is for describing the mcis in a keyword (any string can be used) for special System purpose", + "description": "SystemLabel is for describing the mci in a keyword (any string can be used) for special System purpose", "type": "string", "example": "" }, "vm": { "type": "array", "items": { - "$ref": "#/definitions/mcis.TbVmDynamicReq" + "$ref": "#/definitions/mci.TbVmDynamicReq" } } } @@ -623,23 +623,23 @@ const docTemplate = `{ "example": "no" }, "label": { - "description": "Label is for describing the mcis in a keyword (any string can be used)", + "description": "Label is for describing the mci in a keyword (any string can be used)", "type": "string", "example": "DynamicVM" }, "name": { "type": "string", - "example": "mcis01" + "example": "mci01" }, "systemLabel": { - "description": "SystemLabel is for describing the mcis in a keyword (any string can be used) for special System purpose", + "description": "SystemLabel is for describing the mci in a keyword (any string can be used) for special System purpose", "type": "string", "example": "" }, "vm": { "type": "array", "items": { - "$ref": "#/definitions/mcis.TbVmDynamicReq" + "$ref": "#/definitions/mci.TbVmDynamicReq" } } } @@ -708,23 +708,23 @@ const docTemplate = `{ "example": "no" }, "label": { - "description": "Label is for describing the mcis in a keyword (any string can be used)", + "description": "Label is for describing the mci in a keyword (any string can be used)", "type": "string", "example": "DynamicVM" }, "name": { "type": "string", - "example": "mcis01" + "example": "mci01" }, "systemLabel": { - "description": "SystemLabel is for describing the mcis in a keyword (any string can be used) for special System purpose", + "description": "SystemLabel is for describing the mci in a keyword (any string can be used) for special System purpose", "type": "string", "example": "" }, "vm": { "type": "array", "items": { - "$ref": "#/definitions/mcis.TbVmDynamicReq" + "$ref": "#/definitions/mci.TbVmDynamicReq" } } } @@ -1129,7 +1129,7 @@ const docTemplate = `{ } } }, - "mcis.TbVmDynamicReq": { + "mci.TbVmDynamicReq": { "type": "object", "required": [ "commonImage", @@ -1176,7 +1176,7 @@ const docTemplate = `{ "example": "default, TYPE1, ..." }, "subGroupSize": { - "description": "if subGroupSize is (not empty) \u0026\u0026 (\u003e 0), subGroup will be gernetad. VMs will be created accordingly.", + "description": "if subGroupSize is (not empty) \u0026\u0026 (\u003e 0), subGroup will be generated. VMs will be created accordingly.", "type": "string", "default": "1", "example": "3" diff --git a/api/swagger.json b/api/swagger.json index 3b9654b..7efaaa7 100644 --- a/api/swagger.json +++ b/api/swagger.json @@ -573,23 +573,23 @@ "example": "no" }, "label": { - "description": "Label is for describing the mcis in a keyword (any string can be used)", + "description": "Label is for describing the mci in a keyword (any string can be used)", "type": "string", "example": "DynamicVM" }, "name": { "type": "string", - "example": "mcis01" + "example": "mci01" }, "systemLabel": { - "description": "SystemLabel is for describing the mcis in a keyword (any string can be used) for special System purpose", + "description": "SystemLabel is for describing the mci in a keyword (any string can be used) for special System purpose", "type": "string", "example": "" }, "vm": { "type": "array", "items": { - "$ref": "#/definitions/mcis.TbVmDynamicReq" + "$ref": "#/definitions/mci.TbVmDynamicReq" } } } @@ -616,23 +616,23 @@ "example": "no" }, "label": { - "description": "Label is for describing the mcis in a keyword (any string can be used)", + "description": "Label is for describing the mci in a keyword (any string can be used)", "type": "string", "example": "DynamicVM" }, "name": { "type": "string", - "example": "mcis01" + "example": "mci01" }, "systemLabel": { - "description": "SystemLabel is for describing the mcis in a keyword (any string can be used) for special System purpose", + "description": "SystemLabel is for describing the mci in a keyword (any string can be used) for special System purpose", "type": "string", "example": "" }, "vm": { "type": "array", "items": { - "$ref": "#/definitions/mcis.TbVmDynamicReq" + "$ref": "#/definitions/mci.TbVmDynamicReq" } } } @@ -701,23 +701,23 @@ "example": "no" }, "label": { - "description": "Label is for describing the mcis in a keyword (any string can be used)", + "description": "Label is for describing the mci in a keyword (any string can be used)", "type": "string", "example": "DynamicVM" }, "name": { "type": "string", - "example": "mcis01" + "example": "mci01" }, "systemLabel": { - "description": "SystemLabel is for describing the mcis in a keyword (any string can be used) for special System purpose", + "description": "SystemLabel is for describing the mci in a keyword (any string can be used) for special System purpose", "type": "string", "example": "" }, "vm": { "type": "array", "items": { - "$ref": "#/definitions/mcis.TbVmDynamicReq" + "$ref": "#/definitions/mci.TbVmDynamicReq" } } } @@ -1122,7 +1122,7 @@ } } }, - "mcis.TbVmDynamicReq": { + "mci.TbVmDynamicReq": { "type": "object", "required": [ "commonImage", @@ -1169,7 +1169,7 @@ "example": "default, TYPE1, ..." }, "subGroupSize": { - "description": "if subGroupSize is (not empty) \u0026\u0026 (\u003e 0), subGroup will be gernetad. VMs will be created accordingly.", + "description": "if subGroupSize is (not empty) \u0026\u0026 (\u003e 0), subGroup will be generated. VMs will be created accordingly.", "type": "string", "default": "1", "example": "3" diff --git a/api/swagger.yaml b/api/swagger.yaml index 4d3a0a0..9bfdb00 100644 --- a/api/swagger.yaml +++ b/api/swagger.yaml @@ -46,21 +46,21 @@ definitions: example: "no" type: string label: - description: Label is for describing the mcis in a keyword (any string can + description: Label is for describing the mci in a keyword (any string can be used) example: DynamicVM type: string name: - example: mcis01 + example: mci01 type: string systemLabel: - description: SystemLabel is for describing the mcis in a keyword (any string + description: SystemLabel is for describing the mci in a keyword (any string can be used) for special System purpose example: "" type: string vm: items: - $ref: '#/definitions/mcis.TbVmDynamicReq' + $ref: '#/definitions/mci.TbVmDynamicReq' type: array required: - name @@ -81,21 +81,21 @@ definitions: example: "no" type: string label: - description: Label is for describing the mcis in a keyword (any string can + description: Label is for describing the mci in a keyword (any string can be used) example: DynamicVM type: string name: - example: mcis01 + example: mci01 type: string systemLabel: - description: SystemLabel is for describing the mcis in a keyword (any string + description: SystemLabel is for describing the mci in a keyword (any string can be used) for special System purpose example: "" type: string vm: items: - $ref: '#/definitions/mcis.TbVmDynamicReq' + $ref: '#/definitions/mci.TbVmDynamicReq' type: array required: - name @@ -143,21 +143,21 @@ definitions: example: "no" type: string label: - description: Label is for describing the mcis in a keyword (any string can + description: Label is for describing the mci in a keyword (any string can be used) example: DynamicVM type: string name: - example: mcis01 + example: mci01 type: string systemLabel: - description: SystemLabel is for describing the mcis in a keyword (any string + description: SystemLabel is for describing the mci in a keyword (any string can be used) for special System purpose example: "" type: string vm: items: - $ref: '#/definitions/mcis.TbVmDynamicReq' + $ref: '#/definitions/mci.TbVmDynamicReq' type: array required: - name @@ -429,7 +429,7 @@ definitions: required: - os type: object - mcis.TbVmDynamicReq: + mci.TbVmDynamicReq: properties: commonImage: description: CommonImage is field for id of a image in common namespace @@ -470,7 +470,7 @@ definitions: type: string subGroupSize: default: "1" - description: if subGroupSize is (not empty) && (> 0), subGroup will be gernetad. + description: if subGroupSize is (not empty) && (> 0), subGroup will be generated. VMs will be created accordingly. example: "3" type: string diff --git a/conf/config.yaml b/conf/config.yaml index daabda1..5feeb78 100644 --- a/conf/config.yaml +++ b/conf/config.yaml @@ -42,7 +42,7 @@ beetle: logfile: # Set log file path (default logfile path: ./log/beetle.log) path: ./log/beetle.log - maxsize: 10 + maxsize: 1000 maxbackups: 3 maxage: 30 compress: false diff --git a/conf/setup.env b/conf/setup.env index bf14605..4562b13 100644 --- a/conf/setup.env +++ b/conf/setup.env @@ -30,7 +30,7 @@ export BEETLE_SQLITE_PASSWORD=cm_beetle ## Logger configuration # Set log file path (default logfile path: ./log/beetle.log) export BEETLE_LOGFILE_PATH=log/beetle.log -export BEETLE_LOGFILE_MAXSIZE=10 +export BEETLE_LOGFILE_MAXSIZE=1000 export BEETLE_LOGFILE_MAXBACKUPS=3 export BEETLE_LOGFILE_MAXAGE=30 export BEETLE_LOGFILE_COMPRESS=false diff --git a/conf/template-config.yaml b/conf/template-config.yaml index daabda1..f066f35 100644 --- a/conf/template-config.yaml +++ b/conf/template-config.yaml @@ -42,7 +42,7 @@ beetle: logfile: # Set log file path (default logfile path: ./log/beetle.log) path: ./log/beetle.log - maxsize: 10 + maxsize: 100 maxbackups: 3 maxage: 30 compress: false diff --git a/conf/template-setup.env b/conf/template-setup.env index 2928f49..b193600 100644 --- a/conf/template-setup.env +++ b/conf/template-setup.env @@ -30,7 +30,7 @@ export BEETLE_SQLITE_PASSWORD=cm_beetle ## Logger configuration # Set log file path (default logfile path: ./beetle.log) export BEETLE_LOGFILE_PATH=beetle.log -export BEETLE_LOGFILE_MAXSIZE=10 +export BEETLE_LOGFILE_MAXSIZE=100 export BEETLE_LOGFILE_MAXBACKUPS=3 export BEETLE_LOGFILE_MAXAGE=30 export BEETLE_LOGFILE_COMPRESS=false diff --git a/deployments/docker-compose/docker-compose.yaml b/deployments/docker-compose/docker-compose.yaml index 92c8735..7622664 100644 --- a/deployments/docker-compose/docker-compose.yaml +++ b/deployments/docker-compose/docker-compose.yaml @@ -73,7 +73,8 @@ services: # CB-Spider cb-spider: - image: cloudbaristaorg/cb-spider:0.9.0 + # image: cloudbaristaorg/cb-spider:0.9.0 + image: cloudbaristaorg/cb-spider:edge container_name: cb-spider platform: linux/amd64 ports: @@ -103,7 +104,7 @@ services: # CB-Tumblebug cb-tumblebug: - image: cloudbaristaorg/cb-tumblebug:0.9.2 + image: cloudbaristaorg/cb-tumblebug:0.9.6 container_name: cb-tumblebug platform: linux/amd64 ports: @@ -138,7 +139,7 @@ services: # - TB_DEFAULT_NAMESPACE=ns01 # - TB_DEFAULT_CREDENTIALHOLDER=admin # - TB_LOGFILE_PATH=/app/log/tumblebug.log - # - TB_LOGFILE_MAXSIZE=10 + - TB_LOGFILE_MAXSIZE=1000 # - TB_LOGFILE_MAXBACKUPS=3 # - TB_LOGFILE_MAXAGE=30 # - TB_LOGFILE_COMPRESS=false @@ -201,7 +202,7 @@ services: # cb-mapui (optionally use) cb-mapui: - image: cloudbaristaorg/cb-mapui:0.9.0 + image: cloudbaristaorg/cb-mapui:0.9.3 container_name: cb-mapui ports: - target: 1324 diff --git a/go.mod b/go.mod index af3a8d5..eae9094 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.23.0 require ( github.com/cloud-barista/cb-store v0.8.2 - github.com/cloud-barista/cb-tumblebug v0.9.0 + github.com/cloud-barista/cb-tumblebug v0.9.6 github.com/cloud-barista/cm-honeybee/agent v0.0.0-20240704080504-526db6b80b90 github.com/fsnotify/fsnotify v1.7.0 github.com/go-playground/validator/v10 v10.22.0 @@ -25,8 +25,6 @@ require ( require ( filippo.io/edwards25519 v1.1.0 // indirect github.com/KyleBanks/depth v1.2.1 // indirect - github.com/bwmarrin/snowflake v0.3.0 // indirect - github.com/cloud-barista/cb-log v0.8.2 // indirect github.com/coreos/go-semver v0.3.1 // indirect github.com/coreos/go-systemd/v22 v22.5.0 // indirect github.com/gabriel-vasile/mimetype v1.4.4 // indirect @@ -58,11 +56,9 @@ require ( github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/pelletier/go-toml/v2 v2.2.2 // indirect - github.com/pkg/errors v0.9.1 // indirect github.com/rivo/uniseg v0.4.7 // indirect github.com/sagikazarmark/locafero v0.6.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect - github.com/snowzach/rotatefilehook v0.0.0-20220211133110-53752135082d // indirect github.com/sourcegraph/conc v0.3.0 // indirect github.com/spf13/afero v1.11.0 // indirect github.com/spf13/cast v1.6.0 // indirect @@ -76,9 +72,6 @@ require ( github.com/tidwall/sjson v1.2.5 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasttemplate v1.2.2 // indirect - github.com/xujiajun/mmap-go v1.0.1 // indirect - github.com/xujiajun/nutsdb v0.11.1 // indirect - github.com/xujiajun/utils v0.0.0-20220904132955-5f7c5b914235 // indirect go.etcd.io/etcd/api/v3 v3.5.14 // indirect go.etcd.io/etcd/client/pkg/v3 v3.5.14 // indirect go.etcd.io/etcd/client/v3 v3.5.14 // indirect diff --git a/go.sum b/go.sum index b7f533a..88c9113 100644 --- a/go.sum +++ b/go.sum @@ -4,15 +4,10 @@ gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a h1:lSA0F4e9A2NcQSqGq gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a/go.mod h1:EXuID2Zs0pAQhH8yz+DNjUbjppKQzKFAn28TMYPB6IU= github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc= github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE= -github.com/bwmarrin/snowflake v0.3.0 h1:xm67bEhkKh6ij1790JB83OujPR5CzNe8QuQqAgISZN0= -github.com/bwmarrin/snowflake v0.3.0/go.mod h1:NdZxfVWX+oR6y2K0o6qAYv6gIOP9rjG0/E9WsDpxqwE= -github.com/cespare/xxhash/v2 v2.1.2/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cloud-barista/cb-log v0.8.2 h1:hPCbLj6TW6m9UWlq002sDuGgxKFVp68w4V3k493+MxY= -github.com/cloud-barista/cb-log v0.8.2/go.mod h1:nGgfTFMPwl1MpCO3FBjexUkNdOYA0BNJoyM9Pd0lMms= github.com/cloud-barista/cb-store v0.8.2 h1:7excW7SX0Xw9Xxo0xO4HkndjOYonh4z6mFzNqYN3XH4= github.com/cloud-barista/cb-store v0.8.2/go.mod h1:GBTRuOApzMWSENFSgIPtrbWUKSwP30bn90gWE0ENUD8= -github.com/cloud-barista/cb-tumblebug v0.9.0 h1:Z98zDkroG5pBlj/i/xqZuzRMEpiv/6YwP+hO6C92hQU= -github.com/cloud-barista/cb-tumblebug v0.9.0/go.mod h1:Hp+FEWx80a0/I4hYgiiTOY+wmU1GQgFF/BRvcOfs0o0= +github.com/cloud-barista/cb-tumblebug v0.9.6 h1:x3nufIVLwYKFiHVbRu1j/Tmtd9gd2Do0DgaOF31JLYI= +github.com/cloud-barista/cb-tumblebug v0.9.6/go.mod h1:3Uxg4eHCfrJZNgfu5MarXzALmR3JgB8fhdL7q3lJSz4= github.com/cloud-barista/cm-honeybee/agent v0.0.0-20240704080504-526db6b80b90 h1:qGFG4sMqwKw06Y0ZzK4L2Bm6M/WHNnLQGZ3r6qUAhR8= github.com/cloud-barista/cm-honeybee/agent v0.0.0-20240704080504-526db6b80b90/go.mod h1:+h6UB1Z2qrpfizIillcppLuh8zRlmjLSpkl63XGi1Wc= github.com/coreos/go-semver v0.3.1 h1:yi21YpKnrx1gt5R+la8n5WgS0kCrsPp33dmEyHReZr4= @@ -127,7 +122,6 @@ github.com/onsi/gomega v1.4.3 h1:RE1xgDvH7imwFD45h+u2SgIfERHlS2yNG4DObb5BSKU= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= @@ -149,8 +143,6 @@ github.com/sagikazarmark/slog-shim v0.1.0 h1:diDBnUNK9N/354PgrxMywXnAwEr1QZcOr6g github.com/sagikazarmark/slog-shim v0.1.0/go.mod h1:SrcSrq8aKtyuqEI1uvTDTK1arOWRIczQRv+GVI1AkeQ= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/snowzach/rotatefilehook v0.0.0-20220211133110-53752135082d h1:4660u5vJtsyrn3QwJNfESwCws+TM1CMhRn123xjVyQ8= -github.com/snowzach/rotatefilehook v0.0.0-20220211133110-53752135082d/go.mod h1:ZLVe3VfhAuMYLYWliGEydMBoRnfib8EFSqkBYu1ck9E= github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= @@ -196,13 +188,6 @@ github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6Kllzaw github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo= github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= -github.com/xujiajun/gorouter v1.2.0/go.mod h1:yJrIta+bTNpBM/2UT8hLOaEAFckO+m/qmR3luMIQygM= -github.com/xujiajun/mmap-go v1.0.1 h1:7Se7ss1fLPPRW+ePgqGpCkfGIZzJV6JPq9Wq9iv/WHc= -github.com/xujiajun/mmap-go v1.0.1/go.mod h1:CNN6Sw4SL69Sui00p0zEzcZKbt+5HtEnYUsc6BKKRMg= -github.com/xujiajun/nutsdb v0.11.1 h1:zLyIvp3ABHMohtcqi0sbt7gGOFWfse+ZbLv2GVb6ZYw= -github.com/xujiajun/nutsdb v0.11.1/go.mod h1:sAT5Kr8+53X2r1eFMHw2VSPLSAo/PiJCZPK5QtMsw7g= -github.com/xujiajun/utils v0.0.0-20220904132955-5f7c5b914235 h1:w0si+uee0iAaCJO9q86T6yrhdadgcsoNuh47LrUykzg= -github.com/xujiajun/utils v0.0.0-20220904132955-5f7c5b914235/go.mod h1:MR4+0R6A9NS5IABnIM3384FfOq8QFVnm7WDrBOhIaMU= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= @@ -256,13 +241,11 @@ golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181221143128-b4a75ba826a6/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220405210540-1e041c57c461/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/go.work.sum b/go.work.sum index 091c47a..f254663 100644 --- a/go.work.sum +++ b/go.work.sum @@ -288,11 +288,15 @@ github.com/apparentlymart/go-cidr v1.1.0/go.mod h1:EBcsNrHc3zQeuaeCeCtQruQm+n9/Y github.com/armon/go-metrics v0.4.0/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4= github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/bwmarrin/snowflake v0.3.0 h1:xm67bEhkKh6ij1790JB83OujPR5CzNe8QuQqAgISZN0= +github.com/bwmarrin/snowflake v0.3.0/go.mod h1:NdZxfVWX+oR6y2K0o6qAYv6gIOP9rjG0/E9WsDpxqwE= github.com/census-instrumentation/opencensus-proto v0.4.1/go.mod h1:4T9NM4+4Vw91VeyqjLS6ao50K5bOcLKN6Q42XnYaRYw= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cloud-barista/cb-log v0.6.4 h1:HblyslcRLeD2tib4UcZszJ8ZNfB4W0CRVvbKlf9uY78= github.com/cloud-barista/cb-log v0.6.4/go.mod h1:nGgfTFMPwl1MpCO3FBjexUkNdOYA0BNJoyM9Pd0lMms= +github.com/cloud-barista/cb-log v0.8.2 h1:hPCbLj6TW6m9UWlq002sDuGgxKFVp68w4V3k493+MxY= +github.com/cloud-barista/cb-log v0.8.2/go.mod h1:nGgfTFMPwl1MpCO3FBjexUkNdOYA0BNJoyM9Pd0lMms= github.com/cloud-barista/cb-tumblebug v0.0.0-20230724172618-8f225d0127e8 h1:3aao7cE0ntlhJwl4p9RBaFz6ulM2xXq/SGR/xPxfxYc= github.com/cloud-barista/cb-tumblebug v0.0.0-20230724172618-8f225d0127e8/go.mod h1:RdSc2Ji06owVW3gwkBlZCSPrmxAyzstCWu9fa0emyco= github.com/cloud-barista/cm-beetle/src v0.0.0-20230724172618-8f225d0127e8/go.mod h1:XQuz7L64MNUu04FmG5gB0z41VcrfaLuQP80EGyQTDgo= @@ -311,6 +315,7 @@ github.com/coreos/go-systemd/v22 v22.0.0 h1:XJIw/+VlJ+87J+doOxznsAWIdmWuViOVhkQa github.com/coreos/go-systemd/v22 v22.0.0/go.mod h1:xO0FLkIi5MaZafQlIrOotqXZ90ih+1atmu1JpKERPPk= github.com/coreos/go-systemd/v22 v22.3.2 h1:D9/bQk5vlXQFZ6Kwuu6zaiXJ9oTPe68++AzAJc1DzSI= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/digitalocean/go-libvirt v0.0.0-20221205150000-2939327a8519/go.mod h1:WyJJyfmJ0gWJvjV+ZH4DOgtOYZc1KOvYyBXWCLKxsUU= github.com/digitalocean/go-openvswitch v0.0.0-20230210190010-977d98586f70/go.mod h1:OAtI/pEmN/EvxlkixiYp2nMQQEtEqzHcpWeE2AW2Bb8= github.com/digitalocean/go-smbios v0.0.0-20180907143718-390a4f403a8e/go.mod h1:YTIHhz/QFSYnu/EhlF2SpU2Uk+32abacUYA5ZPljz1A= @@ -345,6 +350,7 @@ github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW github.com/go-ping/ping v1.1.0/go.mod h1:xIFjORFzTxqIV/tDVGO4eDy/bLuSyawEeojSm3GfRGk= github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= +github.com/golang-jwt/jwt/v4 v4.5.0/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang-sql/civil v0.0.0-20220223132316-b832511892a9/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0= github.com/golang-sql/sqlexp v0.1.0/go.mod h1:J4ad9Vo8ZCWQ2GMrC4UCQy1JpCbwU9m3EOqtpKwwwHI= github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ= @@ -400,10 +406,18 @@ github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kumako/go-win64api v0.0.0-20200829071356-ddc2195639e5/go.mod h1:QErslf4fQWjLog9REVFLv/fOBHP3ceRkHde6hEngOIs= github.com/labstack/echo v3.3.10+incompatible h1:pGRcYk231ExFAyoAjAfD85kQzRJCRI8bbnE7CX5OEgg= github.com/labstack/echo v3.3.10+incompatible/go.mod h1:0INS7j/VjnFxD4E2wkz67b8cVwCLbBmJyDaka6Cmk1s= +github.com/labstack/echo-jwt v0.0.0-20221127215225-c84d41a71003/go.mod h1:ovRFgyKvi73jQIFCWz9ByQwzhIyohkzY0MFAlPGyr8Q= +github.com/lestrrat-go/backoff/v2 v2.0.8/go.mod h1:rHP/q/r9aT27n24JQLa7JhSQZCKBBOiM/uP402WwN8Y= +github.com/lestrrat-go/blackmagic v1.0.2/go.mod h1:UrEqBzIR2U6CnzVyUtfM6oZNMt/7O7Vohk2J0OGSAtU= +github.com/lestrrat-go/httpcc v1.0.1/go.mod h1:qiltp3Mt56+55GPVCbTdM9MlqhvzyuL6W/NMDA8vA5E= +github.com/lestrrat-go/iter v1.0.2/go.mod h1:Momfcq3AnRlRjI5b5O8/G5/BvpzrhoFTZcn06fEOPt4= +github.com/lestrrat-go/jwx v1.2.29/go.mod h1:hU8k2l6WF0ncx20uQdOmik/Gjg6E3/wIRtXSNFeZuB8= +github.com/lestrrat-go/option v1.0.1/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libvirt/libvirt-go-xml v7.4.0+incompatible/go.mod h1:oBlgD3xOA01ihiK5stbhFzvieyW+jVS6kbbsMVF623A= github.com/lufia/plan9stats v0.0.0-20231016141302-07b5767bb0ed/go.mod h1:ilwx/Dta8jXAgpFYFvSWEMwxmbWXyiUHkd5FwyKhb5k= github.com/lufia/plan9stats v0.0.0-20240513124658-fba389f38bae/go.mod h1:ilwx/Dta8jXAgpFYFvSWEMwxmbWXyiUHkd5FwyKhb5k= +github.com/m-cmp/mc-iam-manager v0.2.7/go.mod h1:ES5A3mw32SIfHMzUodo6R6D+c3p+EYzP3ga11Fi6KE8= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/microsoft/go-mssqldb v1.6.0/go.mod h1:00mDtPbeQCRGC1HwOOR5K/gr30P1NcEG0vx6Kbv2aJU= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= @@ -428,6 +442,7 @@ github.com/opencontainers/image-spec v1.1.0/go.mod h1:W4s4sFTMaBeK1BQLXbG4AdM2sz github.com/opencontainers/selinux v1.11.0/go.mod h1:E5dMC3VPuVvVHDYmi78qvhJp8+M586T4DlDRYpFkyec= github.com/ovn-org/libovsdb v0.6.0/go.mod h1:5Ld4X+oWvMlbPAGvbJyE/wp8TAWdydI67jatQ3qbsVc= github.com/pelletier/go-toml v1.9.3 h1:zeC5b1GviRUyKYd6OJPvBU/mcVDVoL1OhT17FCt5dSQ= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/profile v1.7.0/go.mod h1:8Uer0jas47ZQMJ7VD+OHknK4YDY07LPUC6dEvqDjvNo= github.com/pkg/sftp v1.13.6/go.mod h1:tz1ryNURKu77RL+GuCzmoJYxQczL3wLNNpPWagdg4Qk= github.com/power-devops/perfstat v0.0.0-20221212215047-62379fc7944b/go.mod h1:OmDBASR4679mdNQnz2pUhc2G8CO2JrUAVFDRBDP/hJE= @@ -447,7 +462,10 @@ github.com/shoenig/go-m1cpu v0.1.6/go.mod h1:1JJMcUBvfNwpq05QDQVAnx3gUHr9IYF7GNg github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/snowzach/rotatefilehook v0.0.0-20220211133110-53752135082d h1:4660u5vJtsyrn3QwJNfESwCws+TM1CMhRn123xjVyQ8= +github.com/snowzach/rotatefilehook v0.0.0-20220211133110-53752135082d/go.mod h1:ZLVe3VfhAuMYLYWliGEydMBoRnfib8EFSqkBYu1ck9E= github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= +github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/swaggo/files v0.0.0-20220728132757-551d4a08d97a h1:kAe4YSu0O0UFn1DowNo2MY5p6xzqtJ/wQ7LZynSvGaY= @@ -462,6 +480,10 @@ github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/X github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= +github.com/xujiajun/mmap-go v1.0.1 h1:7Se7ss1fLPPRW+ePgqGpCkfGIZzJV6JPq9Wq9iv/WHc= +github.com/xujiajun/mmap-go v1.0.1/go.mod h1:CNN6Sw4SL69Sui00p0zEzcZKbt+5HtEnYUsc6BKKRMg= +github.com/xujiajun/nutsdb v0.10.0/go.mod h1:8ZdTTF0cEQO+wN940htfHYKswFql2iB6Osckx+GmOoU= +github.com/xujiajun/utils v0.0.0-20190123093513-8bf096c4f53b/go.mod h1:AZd87GYJlUzl82Yab2kTjx1EyXSQCAfZDhpTo1SQC4k= github.com/yumaojun03/dmidecode v0.1.4/go.mod h1:34bbsMNMNjDbijDpRuqd+2ZapDKxvhO+FlgGgOgS6G8= github.com/yumaojun03/dmidecode v0.1.5-0.20231113021359-c053d91d9679/go.mod h1:7iFa4NvM+dLZjKVs/prwGUXvXCBtaoPz6E0joTS7TXQ= github.com/yusufpapurcu/wmi v1.2.3/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= diff --git a/pkg/api/rest/controller/migration.go b/pkg/api/rest/controller/migration.go index ba8b358..e86a262 100644 --- a/pkg/api/rest/controller/migration.go +++ b/pkg/api/rest/controller/migration.go @@ -20,7 +20,7 @@ import ( model "github.com/cloud-barista/cm-beetle/pkg/api/rest/model/beetle" // cloudmodel "github.com/cloud-barista/cm-beetle/pkg/api/rest/model/cloud/infra" - "github.com/cloud-barista/cb-tumblebug/src/core/mcis" + "github.com/cloud-barista/cb-tumblebug/src/core/mci" "github.com/cloud-barista/cm-beetle/pkg/core/common" "github.com/cloud-barista/cm-beetle/pkg/core/migration" @@ -31,13 +31,13 @@ import ( type MigrateInfraRequest struct { // [NOTE] Failed to embed the struct in CB-Tumblebug as follows: - // mcis.TbMcisDynamicReq + // mci.TbMciDynamicReq - mcis.TbMcisDynamicReq + mci.TbMciDynamicReq } type MigrateInfraResponse struct { - mcis.TbMcisDynamicReq + mci.TbMciDynamicReq } // MigrateInfra godoc @@ -72,7 +72,7 @@ func MigrateInfra(c echo.Context) error { } log.Trace().Msgf("req: %v\n", req) - log.Trace().Msgf("req.TbMcisDynamicReq: %v\n", req.TbMcisDynamicReq) + log.Trace().Msgf("req.TbMciDynamicReq: %v\n", req.TbMciDynamicReq) nsInfo, err := common.GetNamespace(nsId) if err != nil { @@ -97,7 +97,7 @@ func MigrateInfra(c echo.Context) error { } // Create the VM infrastructure for migration - infraInfo, err := migration.CreateVMInfra(nsId, &req.TbMcisDynamicReq) + infraInfo, err := migration.CreateVMInfra(nsId, &req.TbMciDynamicReq) log.Trace().Msgf("infraInfo: %v\n", infraInfo) diff --git a/pkg/api/rest/controller/recommendation.go b/pkg/api/rest/controller/recommendation.go index 833de61..dea9c6a 100644 --- a/pkg/api/rest/controller/recommendation.go +++ b/pkg/api/rest/controller/recommendation.go @@ -19,7 +19,7 @@ import ( // cloudmodel "github.com/cloud-barista/cm-beetle/pkg/api/rest/model/cloud/infra" // "github.com/cloud-barista/cm-beetle/pkg/api/rest/model/onprem/infra" - "github.com/cloud-barista/cb-tumblebug/src/core/mcis" + "github.com/cloud-barista/cb-tumblebug/src/core/mci" "github.com/cloud-barista/cm-honeybee/agent/pkg/api/rest/model/onprem/infra" "github.com/cloud-barista/cm-beetle/pkg/core/common" @@ -42,7 +42,7 @@ type RecommendInfraRequest struct { } type RecommendInfraResponse struct { - mcis.TbMcisDynamicReq + mci.TbMciDynamicReq } // RecommendInfra godoc diff --git a/pkg/api/rest/middlewares/proxy.go b/pkg/api/rest/middlewares/proxy.go index e7a419e..631c14c 100644 --- a/pkg/api/rest/middlewares/proxy.go +++ b/pkg/api/rest/middlewares/proxy.go @@ -64,7 +64,6 @@ func Proxy(config ProxyConfig) echo.MiddlewareFunc { }, }), Skipper: func(c echo.Context) bool { - // Skip url patterns that start with /beetle/ns/mcis path := c.Request().URL.Path query := c.Request().URL.RawQuery for _, patterns := range config.SkipPatterns { diff --git a/pkg/api/rest/server.go b/pkg/api/rest/server.go index 205eee3..3838066 100644 --- a/pkg/api/rest/server.go +++ b/pkg/api/rest/server.go @@ -92,7 +92,7 @@ func RunServer(port string) { APILogSkipPatterns := [][]string{ {"/beetle/api"}, - // {"/mcis", "option=status"}, + // {"/mci", "option=status"}, } // Custom logger middleware with zerolog diff --git a/pkg/core/common/common.go b/pkg/core/common/common.go index 7d591d1..b04449d 100644 --- a/pkg/core/common/common.go +++ b/pkg/core/common/common.go @@ -76,7 +76,7 @@ const ( StrDataDisk string = "dataDisk" StrNLB string = "nlb" StrVM string = "vm" - StrMCIS string = "mcis" + StrMCI string = "mci" StrDefaultResourceName string = "-systemdefault-" // StrFirewallRule string = "firewallRule" diff --git a/pkg/core/common/config.go b/pkg/core/common/config.go index 2e02fdf..24253c3 100644 --- a/pkg/core/common/config.go +++ b/pkg/core/common/config.go @@ -111,9 +111,9 @@ type Nlbsw struct { CommandNlbDeploy string `yaml:"commandNlbDeploy"` CommandNlbAddTargetNode string `yaml:"commandNlbAddTargetNode"` CommandNlbApplyConfig string `yaml:"commandNlbApplyConfig"` - NlbMcisCommonSpec string `yaml:"nlbMcisCommonSpec"` - NlbMcisCommonImage string `yaml:"nlbMcisCommonImage"` - NlbMcisSubGroupSize string `yaml:"nlbMcisSubGroupSize"` + NlbMciCommonSpec string `yaml:"nlbMciCommonSpec"` + NlbMciCommonImage string `yaml:"nlbMciCommonImage"` + NlbMciSubGroupSize string `yaml:"nlbMciSubGroupSize"` } // type DataDiskCmd string diff --git a/pkg/core/common/utility.go b/pkg/core/common/utility.go index d79a605..d024657 100644 --- a/pkg/core/common/utility.go +++ b/pkg/core/common/utility.go @@ -30,7 +30,7 @@ import ( "fmt" ) -// MCIS utilities +// MCI utilities // SimpleMsg is struct for JSON Simple message type SimpleMsg struct { @@ -127,13 +127,13 @@ func ChangeIdString(name string) string { return changedString } -// GenMcisKey is func to generate a key used in keyValue store -func GenMcisKey(nsId string, mcisId string, vmId string) string { +// GenMciKey is func to generate a key used in keyValue store +func GenMciKey(nsId string, mciId string, vmId string) string { if vmId != "" { - return "/ns/" + nsId + "/mcis/" + mcisId + "/vm/" + vmId - } else if mcisId != "" { - return "/ns/" + nsId + "/mcis/" + mcisId + return "/ns/" + nsId + "/mci/" + mciId + "/vm/" + vmId + } else if mciId != "" { + return "/ns/" + nsId + "/mci/" + mciId } else if nsId != "" { return "/ns/" + nsId } else { @@ -142,19 +142,19 @@ func GenMcisKey(nsId string, mcisId string, vmId string) string { } -// GenMcisSubGroupKey is func to generate a key from subGroupId used in keyValue store -func GenMcisSubGroupKey(nsId string, mcisId string, groupId string) string { +// GenMciSubGroupKey is func to generate a key from subGroupId used in keyValue store +func GenMciSubGroupKey(nsId string, mciId string, groupId string) string { - return "/ns/" + nsId + "/mcis/" + mcisId + "/subgroup/" + groupId + return "/ns/" + nsId + "/mci/" + mciId + "/subgroup/" + groupId } -// GenMcisPolicyKey is func to generate Mcis policy key -func GenMcisPolicyKey(nsId string, mcisId string, vmId string) string { +// GenMciPolicyKey is func to generate Mci policy key +func GenMciPolicyKey(nsId string, mciId string, vmId string) string { if vmId != "" { - return "/ns/" + nsId + "/policy/mcis/" + mcisId + "/vm/" + vmId - } else if mcisId != "" { - return "/ns/" + nsId + "/policy/mcis/" + mcisId + return "/ns/" + nsId + "/policy/mci/" + mciId + "/vm/" + vmId + } else if mciId != "" { + return "/ns/" + nsId + "/policy/mci/" + mciId } else if nsId != "" { return "/ns/" + nsId } else { diff --git a/pkg/core/migration/migration.go b/pkg/core/migration/migration.go index 98fb7a6..0bdc1d5 100644 --- a/pkg/core/migration/migration.go +++ b/pkg/core/migration/migration.go @@ -19,7 +19,7 @@ import ( "os" "time" - "github.com/cloud-barista/cb-tumblebug/src/core/mcis" + "github.com/cloud-barista/cb-tumblebug/src/core/mci" // cloudmodel "github.com/cloud-barista/cm-beetle/pkg/api/rest/model/cloud/infra" "github.com/cloud-barista/cm-beetle/pkg/core/common" "github.com/go-resty/resty/v2" @@ -96,7 +96,7 @@ const ( // DefaultSystemLabel is const for string to specify the Default System Label const DefaultSystemLabel string = "Managed by CM-Beetle" -func CreateVMInfra(nsId string, infraModel *mcis.TbMcisDynamicReq) (mcis.TbMcisInfo, error) { +func CreateVMInfra(nsId string, infraModel *mci.TbMciDynamicReq) (mci.TbMciInfo, error) { client := resty.New() client.SetBasicAuth("default", "default") @@ -104,14 +104,14 @@ func CreateVMInfra(nsId string, infraModel *mcis.TbMcisDynamicReq) (mcis.TbMcisI // CB-Tumblebug API endpoint cbTumblebugApiEndpoint := "http://localhost:1323/tumblebug" - url := cbTumblebugApiEndpoint + fmt.Sprintf("/ns/%s/mcisDynamic", nsId) - // url := fmt.Sprintf("%s/ns/{nsId}/mcisDynamic%s", cbTumblebugApiEndpoint, idDetails.IdInSp) + url := cbTumblebugApiEndpoint + fmt.Sprintf("/ns/%s/mciDynamic", nsId) + // url := fmt.Sprintf("%s/ns/{nsId}/mciDynamic%s", cbTumblebugApiEndpoint, idDetails.IdInSp) // Set request body requestBody := *infraModel // Set response body - responseBody := mcis.TbMcisInfo{} + responseBody := mci.TbMciInfo{} client.SetTimeout(5 * time.Minute) @@ -128,13 +128,13 @@ func CreateVMInfra(nsId string, infraModel *mcis.TbMcisDynamicReq) (mcis.TbMcisI if err != nil { // common.CBLog.Error(err) - return mcis.TbMcisInfo{}, err + return mci.TbMciInfo{}, err } return responseBody, nil } -func GetVMInfra(nsId, infraId string) (mcis.TbMcisInfo, error) { +func GetVMInfra(nsId, infraId string) (mci.TbMciInfo, error) { // Initialize resty client with basic auth client := resty.New() @@ -147,13 +147,13 @@ func GetVMInfra(nsId, infraId string) (mcis.TbMcisInfo, error) { // check readyz method := "GET" - url := fmt.Sprintf("%s/ns/%s/mcis/%s", epTumblebug, nsId, infraId) + url := fmt.Sprintf("%s/ns/%s/mci/%s", epTumblebug, nsId, infraId) // Set request body requestBody := common.NoBody // Set response body - responseBody := new(mcis.TbMcisInfo) + responseBody := new(mci.TbMciInfo) client.SetTimeout(5 * time.Minute) @@ -170,7 +170,7 @@ func GetVMInfra(nsId, infraId string) (mcis.TbMcisInfo, error) { if err != nil { log.Error().Err(err).Msgf("failed to get the infrastructure info (nsId: %s, infraId: %s)", nsId, infraId) - return mcis.TbMcisInfo{}, err + return mci.TbMciInfo{}, err } return *responseBody, nil @@ -189,7 +189,7 @@ func DeleteVMInfra(nsId, infraId string) (common.SimpleMsg, error) { // delete the infrastructure with terminate option method := "DELETE" - url := fmt.Sprintf("%s/ns/%s/mcis/%s", epTumblebug, nsId, infraId) + url := fmt.Sprintf("%s/ns/%s/mci/%s", epTumblebug, nsId, infraId) options := "option=terminate" if options != "" { url += "?" + options diff --git a/pkg/core/recommendation/recommendation.go b/pkg/core/recommendation/recommendation.go index e48f735..ef399c1 100644 --- a/pkg/core/recommendation/recommendation.go +++ b/pkg/core/recommendation/recommendation.go @@ -5,8 +5,8 @@ import ( "fmt" "strings" + "github.com/cloud-barista/cb-tumblebug/src/core/mci" "github.com/cloud-barista/cb-tumblebug/src/core/mcir" - "github.com/cloud-barista/cb-tumblebug/src/core/mcis" // cloudmodel "github.com/cloud-barista/cm-beetle/pkg/api/rest/model/cloud/infra" @@ -21,7 +21,7 @@ import ( ) // func Recommend(srcInfra []infra.Infra) (cloudmodel.InfraMigrationReq, error) { -func Recommend(srcInfra []infra.Infra) (mcis.TbMcisDynamicReq, error) { +func Recommend(srcInfra []infra.Infra) (mci.TbMciDynamicReq, error) { // Initialize resty client with basic auth client := resty.New() @@ -51,7 +51,7 @@ func Recommend(srcInfra []infra.Infra) (mcis.TbMcisDynamicReq, error) { if err != nil { log.Err(err).Msg("") - return mcis.TbMcisDynamicReq{}, err + return mci.TbMciDynamicReq{}, err } log.Debug().Msgf("resReadyz: %+v", resReadyz.Message) @@ -115,13 +115,13 @@ func Recommend(srcInfra []infra.Infra) (mcis.TbMcisDynamicReq, error) { }` // A target infrastructure by recommendation - targetInfra := mcis.TbMcisDynamicReq{ + targetInfra := mci.TbMciDynamicReq{ Description: "A cloud infra recommended by CM-Beetle", InstallMonAgent: "no", Label: "rehosted-infra", Name: "", SystemLabel: "", - Vm: []mcis.TbVmDynamicReq{}, + Vm: []mci.TbVmDynamicReq{}, } // Recommand VMs @@ -177,14 +177,14 @@ func Recommend(srcInfra []infra.Infra) (mcis.TbMcisDynamicReq, error) { //////////////////////////////////////// // Search and set a target VM spec method := "POST" - url := fmt.Sprintf("%s/mcisRecommendVm", epTumblebug) + url := fmt.Sprintf("%s/mciRecommendVm", epTumblebug) // Request body - reqRecommVm := new(mcis.DeploymentPlan) + reqRecommVm := new(mci.DeploymentPlan) err := json.Unmarshal([]byte(planToSearchProperVm), reqRecommVm) if err != nil { log.Err(err).Msg("") - return mcis.TbMcisDynamicReq{}, err + return mci.TbMciDynamicReq{}, err } log.Trace().Msgf("deployment plan for the VM recommendation: %+v", reqRecommVm) @@ -204,7 +204,7 @@ func Recommend(srcInfra []infra.Infra) (mcis.TbMcisDynamicReq, error) { if err != nil { log.Err(err).Msg("") - return mcis.TbMcisDynamicReq{}, err + return mci.TbMciDynamicReq{}, err } numRecommenedVm := len(resRecommVmList) @@ -225,34 +225,34 @@ func Recommend(srcInfra []infra.Infra) (mcis.TbMcisDynamicReq, error) { //////////////////////////////////////// // Search and set target VM image (e.g. ubuntu22.04) method = "POST" - url = fmt.Sprintf("%s/mcisDynamicCheckRequest", epTumblebug) + url = fmt.Sprintf("%s/mciDynamicCheckRequest", epTumblebug) // Request body - reqMcisDynamicCheck := new(mcis.McisConnectionConfigCandidatesReq) - reqMcisDynamicCheck.CommonSpecs = []string{recommendedSpec} + reqMciDynamicCheck := new(mci.MciConnectionConfigCandidatesReq) + reqMciDynamicCheck.CommonSpecs = []string{recommendedSpec} // Response body - resMcisDynamicCheck := new(mcis.CheckMcisDynamicReqInfo) + resMciDynamicCheck := new(mci.CheckMciDynamicReqInfo) err = common.ExecuteHttpRequest( client, method, url, nil, - common.SetUseBody(*reqMcisDynamicCheck), - reqMcisDynamicCheck, - resMcisDynamicCheck, + common.SetUseBody(*reqMciDynamicCheck), + reqMciDynamicCheck, + resMciDynamicCheck, common.VeryShortDuration, ) if err != nil { log.Err(err).Msg("") - return mcis.TbMcisDynamicReq{}, err + return mci.TbMciDynamicReq{}, err } - log.Trace().Msgf("resMcisDynamicCheck: %+v", resMcisDynamicCheck) + log.Trace().Msgf("resMciDynamicCheck: %+v", resMciDynamicCheck) - if len(resMcisDynamicCheck.ReqCheck) == 0 { + if len(resMciDynamicCheck.ReqCheck) == 0 { log.Warn().Msg("no VM OS image recommended for the inserted PM/VM") continue } @@ -267,11 +267,11 @@ func Recommend(srcInfra []infra.Infra) (mcis.TbMcisDynamicReq, error) { // Select VM OS image via LevenshteinDistance-based text similarity delimiters1 := []string{" ", "-", "_", ",", "(", ")", "[", "]", "/"} delimiters2 := delimiters1 - vmOsImageId := FindBestVmOsImage(keywords, delimiters1, resMcisDynamicCheck.ReqCheck[0].Image, delimiters2) + vmOsImageId := FindBestVmOsImage(keywords, delimiters1, resMciDynamicCheck.ReqCheck[0].Image, delimiters2) // vmOsImage := fmt.Sprintf("%s+%s+%s", providerName, regionName, osNameWithVersion) - vm := mcis.TbVmDynamicReq{ + vm := mci.TbVmDynamicReq{ ConnectionName: "", CommonImage: vmOsImageId, CommonSpec: recommendedSpec, @@ -306,7 +306,7 @@ func FindBestVmOsImage(keywords string, kwDelimiters []string, vmImages []mcir.T var highestScore float64 for _, image := range vmImages { - score := similarity.CalculateSimilarity(keywords, kwDelimiters, image.CspImageName, imgDelimiters) + score := similarity.CalcResourceSimilarity(keywords, kwDelimiters, image.CspImageName, imgDelimiters) if score > highestScore { highestScore = score bestVmOsImageID = image.Id diff --git a/pkg/example/proxy/proxy-server-regex-rewrite/main.go b/pkg/example/proxy/proxy-server-regex-rewrite/main.go index eca4997..6760a34 100644 --- a/pkg/example/proxy/proxy-server-regex-rewrite/main.go +++ b/pkg/example/proxy/proxy-server-regex-rewrite/main.go @@ -23,9 +23,9 @@ func main() { // 정규 표현식 경로 재작성 설정 regexRewrite := map[*regexp.Regexp]string{ - regexp.MustCompile(`^/beetle/ns$`): "/tumblebug/ns", - regexp.MustCompile(`^/beetle/ns/([^/]+)$`): "/tumblebug/ns/$1", - regexp.MustCompile(`^/beetle/ns/([^/]+)/mcis`): "", + regexp.MustCompile(`^/beetle/ns$`): "/tumblebug/ns", + regexp.MustCompile(`^/beetle/ns/([^/]+)$`): "/tumblebug/ns/$1", + regexp.MustCompile(`^/beetle/ns/([^/]+)/mci`): "", } e.Use(middleware.ProxyWithConfig(middleware.ProxyConfig{ @@ -49,7 +49,7 @@ func main() { })) // 무시할 경로에 대한 핸들러 추가 - e.Any("/beetle/ns/:nsId/mcis/*", func(c echo.Context) error { + e.Any("/beetle/ns/:nsId/mci/*", func(c echo.Context) error { return c.String(http.StatusNotFound, "Not Found") }) diff --git a/pkg/example/proxy/proxy-server/main.go b/pkg/example/proxy/proxy-server/main.go index 34fd9ce..9f5f904 100644 --- a/pkg/example/proxy/proxy-server/main.go +++ b/pkg/example/proxy/proxy-server/main.go @@ -28,11 +28,11 @@ func main() { }, }), Skipper: func(c echo.Context) bool { - // Skip url patterns that start with /beetle/ns/mcis + // Skip url patterns that start with /beetle/ns/mci path := c.Request().URL.Path if strings.HasPrefix(path, "/beetle/ns/") { parts := strings.Split(path, "/") - if len(parts) > 3 && parts[3] == "mcis" { + if len(parts) > 3 && parts[3] == "mci" { return true } } diff --git a/pkg/example/similarity/main.go b/pkg/example/similarity/main.go index 005d0b1..8659bc0 100644 --- a/pkg/example/similarity/main.go +++ b/pkg/example/similarity/main.go @@ -35,8 +35,8 @@ func main() { for _, set := range compareWordSet { fmt.Printf("Comparing '%s' with '%s':\n", set.str1, set.str2) - fmt.Printf(" - LevenshteinDistance, Similarity ratio: %.2f\n", similarity.CalculateSimilarityByLevenshteinDistance(set.str1, set.str2)) - fmt.Printf(" - SequenceMatcher, Similarity ratio: %.2f\n", similarity.CalculateSimilarityBySequenceMatcher(set.str1, set.str2)) + fmt.Printf(" - LevenshteinDistance, Similarity ratio: %.2f\n", similarity.NormalizedLevenshteinDistance(set.str1, set.str2)) + fmt.Printf(" - SequenceMatcher, Similarity ratio: %.2f\n", similarity.NormalizedSequenceMatcher(set.str1, set.str2)) fmt.Println("--------------------------------------------------------") } @@ -54,7 +54,7 @@ func main() { fmt.Printf("Comparing keywords with VM Image:\n") fmt.Printf("Keywords: '%s'\n", keywords) fmt.Printf("VM Image: '%s'\n", image) - score := similarity.CalculateSimilarity(keywords, delimiters1, image, delimiters2) + score := similarity.CalcResourceSimilarity(keywords, delimiters1, image, delimiters2) fmt.Printf(" - Similarity Score: %.2f\n", score) fmt.Println("--------------------------------------------------------") } diff --git a/pkg/logger/logger.go b/pkg/logger/logger.go index a42cb78..aa222b2 100644 --- a/pkg/logger/logger.go +++ b/pkg/logger/logger.go @@ -57,7 +57,7 @@ func NewLogger(config Config) *zerolog.Logger { config.LogFilePath = "./log/app.log" } if config.MaxSize == 0 { - config.MaxSize = 10 // in MB + config.MaxSize = 100 // in MB } if config.MaxBackups == 0 { config.MaxBackups = 3 diff --git a/pkg/similarity/similarity.go b/pkg/similarity/similarity.go index 2c86d0c..e50cdbf 100644 --- a/pkg/similarity/similarity.go +++ b/pkg/similarity/similarity.go @@ -14,7 +14,7 @@ When direct comparison is difficult, predefined maps are used to assess similari */ // Predefined architecture map -var archMap = map[string]string{ +var archDict = map[string]string{ "x86_64": "amd64", "x64": "amd64", "amd64": "amd64", @@ -33,36 +33,42 @@ var archMap = map[string]string{ } // Accessor to ensure archMap immutability -func GetArch(key string) (string, bool) { - value, ok := archMap[key] +func LookupArch(key string) (string, bool) { + value, ok := archDict[key] return value, ok } // Predefined architecture bit map -var archBitMap = map[string]string{ +var archBitDict = map[string]string{ "64bit": "64", "32bit": "32", } // Accessor to ensure archBitMap immutability -func GetArchBit(key string) (string, bool) { - value, ok := archBitMap[key] +func LookupArchBit(key string) (string, bool) { + value, ok := archBitDict[key] return value, ok } -// ActivateByThresholdReLU applies a ReLU function that activates if the similarity is greater than a threshold -func ActivateByThresholdReLU(similarity, threshold float64) float64 { +// ReLUWithThreshold applies a ReLU function that activates if the similarity is greater than a threshold +func ReLUWithThreshold(similarity, threshold float64) float64 { if similarity > threshold { return similarity } return 0.0 } -// CalculateSimilarity calculates the similarity between two texts based on word similarities -func CalculateSimilarity(text1 string, delimiters1 []string, text2 string, delimiters2 []string) float64 { +// CalcResourceSimilarity uses multiple methods to calculate the similarity +// between two texts of resource information. +// The example of multiple methods includes: +// - Dictionary-based similarity (e.g., architecture map mapping) +// - Word-level similarity (e.g., SequenceMatcher) +// - Lexical similarity (e.g., Jaccard similarity) +// - Edit distance-based similarity (e.g., Levenshtein distance) +func CalcResourceSimilarity(text1 string, delimiters1 []string, text2 string, delimiters2 []string) float64 { - words1 := splitToArray(text1, delimiters1) - words2 := splitToArray(text2, delimiters2) + words1 := SplitText(text1, delimiters1) + words2 := SplitText(text2, delimiters2) log.Trace().Msgf("From text 1: %s", text1) log.Trace().Msgf("To word array 1: %v", words1) @@ -75,7 +81,20 @@ func CalculateSimilarity(text1 string, delimiters1 []string, text2 string, delim bestMatch := 0.0 bestMatchWord := "" for _, word2 := range words2 { - similarity := CalculateSimilarityByMapAndSequenceMatcher(word1, word2) + similarity := 0.0 + + // Check if the words are mapped in the predefined architecture map + if mapped, ok := LookupArch(word1); ok && mapped == word2 { + similarity = 1.0 + } + if mapped, ok := LookupArch(word2); ok && mapped == word1 { + similarity = 1.0 + } + + // if not mapped, calculate the similarity based on SequenceMatcher + similarity = NormalizedSequenceMatcher(word1, word2) + + // Check if the similarity is the best match if similarity > bestMatch { bestMatch = similarity bestMatchWord = word2 @@ -83,7 +102,7 @@ func CalculateSimilarity(text1 string, delimiters1 []string, text2 string, delim } } - activatedValue := ActivateByThresholdReLU(bestMatch, 0.5) + activatedValue := ReLUWithThreshold(bestMatch, 0.5) if activatedValue > 0 { log.Trace().Msgf("Best match for '%s': '%s' (similarity: %.2f)", word1, bestMatchWord, bestMatch) totalSimilarity += activatedValue @@ -94,7 +113,8 @@ func CalculateSimilarity(text1 string, delimiters1 []string, text2 string, delim return totalSimilarity / float64(len(words1)) } -func splitToArray(text string, delimiters []string) []string { +// SplitText splits a text into words array using delimiters +func SplitText(text string, delimiters []string) []string { if len(delimiters) == 0 { log.Warn().Msg("warning: delimiters empty. delimiters are empty. Using space (' ') as default delimiter.") @@ -126,34 +146,16 @@ func splitToArray(text string, delimiters []string) []string { return result } -func CalculateSimilarityByMapAndSequenceMatcher(word1, word2 string) float64 { - // Check if the words are mapped in the predefined architecture map - if mapped, ok := GetArch(word1); ok && mapped == word2 { - return 1.0 - } - if mapped, ok := GetArch(word2); ok && mapped == word1 { - return 1.0 - } - - // if not mapped, calculate the similarity based on SequenceMatcher - return SequenceMatcher(word1, word2) -} - -// CalculateSimilarityBySequenceMatcher calculates the similarity between two words based on SequenceMatcher -func CalculateSimilarityBySequenceMatcher(word1, word2 string) float64 { - return SequenceMatcher(word1, word2) -} - /* Text similarity calculation methods. Methods for measuring how similar two pieces of text are. Useful for tasks like matching, searching, and deduplication. */ -// SequenceMatcher similarity by finding the longest substring that two texts have in common. +// NormalizedSequenceMatcher similarity by finding the longest substring that two texts have in common. // It has relatively high complexity. Comparing large strings can take a lot of time. // It is not suitable for measuring similarity of non-text data (e.g. numbers). -func SequenceMatcher(text1, text2 string) float64 { +func NormalizedSequenceMatcher(text1, text2 string) float64 { lcs := longestCommonSubstring(text1, text2) return 2.0 * float64(len(lcs)) / float64(len(text1)+len(text2)) } @@ -183,8 +185,8 @@ func longestCommonSubstring(s1, s2 string) string { return s1[endIndex-longest : endIndex] } -// CalculateSimilarityByLevenshteinDistance calculates the similarity between two words based on Levenshtein distance -func CalculateSimilarityByLevenshteinDistance(word1, word2 string) float64 { +// NormalizedLevenshteinDistance normalizes the Levenshtein distance score to a similarity score between 0 and 1. +func NormalizedLevenshteinDistance(word1, word2 string) float64 { maxLen := float64(max(len(word1), len(word2))) if maxLen == 0 { return 1.0