Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable dynamic MCIS provisioning #879

Merged
merged 5 commits into from
Oct 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions src/api/rest/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -6164,7 +6164,8 @@ var doc = `{
],
"properties": {
"description": {
"type": "string"
"type": "string",
"example": "Made in CB-TB"
},
"installMonAgent": {
"description": "InstallMonAgent Option for CB-Dragonfly agent installation ([yes/no] default:yes)",
Expand All @@ -6183,7 +6184,8 @@ var doc = `{
"example": "custom tag"
},
"name": {
"type": "string"
"type": "string",
"example": "default"
},
"vm": {
"type": "array",
Expand Down Expand Up @@ -6250,7 +6252,8 @@ var doc = `{
],
"properties": {
"description": {
"type": "string"
"type": "string",
"example": "Made in CB-TB"
},
"installMonAgent": {
"description": "InstallMonAgent Option for CB-Dragonfly agent installation ([yes/no] default:yes)",
Expand All @@ -6269,7 +6272,8 @@ var doc = `{
"example": "custom tag"
},
"name": {
"type": "string"
"type": "string",
"example": "default"
},
"placementAlgo": {
"type": "string"
Expand All @@ -6292,17 +6296,21 @@ var doc = `{
"properties": {
"commonImage": {
"description": "CommonImage is field for id of a image in common namespace",
"type": "string"
"type": "string",
"example": "ubuntu18.04"
},
"commonSpec": {
"description": "CommonSpec is field for id of a spec in common namespace",
"type": "string"
"type": "string",
"example": "aws-ap-se-1-m1-small"
},
"description": {
"type": "string"
"type": "string",
"example": "Description"
},
"label": {
"type": "string"
"type": "string",
"example": "DynamicVM"
},
"name": {
"description": "VM name or VM group name if is (not empty) \u0026\u0026 (\u003e 0). If it is a group, actual VM name will be generated with -N postfix.",
Expand Down Expand Up @@ -6499,7 +6507,8 @@ var doc = `{
],
"properties": {
"connectionName": {
"type": "string"
"type": "string",
"example": "testcloud01-seoul"
},
"description": {
"type": "string"
Expand Down
27 changes: 18 additions & 9 deletions src/api/rest/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -6150,7 +6150,8 @@
],
"properties": {
"description": {
"type": "string"
"type": "string",
"example": "Made in CB-TB"
},
"installMonAgent": {
"description": "InstallMonAgent Option for CB-Dragonfly agent installation ([yes/no] default:yes)",
Expand All @@ -6169,7 +6170,8 @@
"example": "custom tag"
},
"name": {
"type": "string"
"type": "string",
"example": "default"
},
"vm": {
"type": "array",
Expand Down Expand Up @@ -6236,7 +6238,8 @@
],
"properties": {
"description": {
"type": "string"
"type": "string",
"example": "Made in CB-TB"
},
"installMonAgent": {
"description": "InstallMonAgent Option for CB-Dragonfly agent installation ([yes/no] default:yes)",
Expand All @@ -6255,7 +6258,8 @@
"example": "custom tag"
},
"name": {
"type": "string"
"type": "string",
"example": "default"
},
"placementAlgo": {
"type": "string"
Expand All @@ -6278,17 +6282,21 @@
"properties": {
"commonImage": {
"description": "CommonImage is field for id of a image in common namespace",
"type": "string"
"type": "string",
"example": "ubuntu18.04"
},
"commonSpec": {
"description": "CommonSpec is field for id of a spec in common namespace",
"type": "string"
"type": "string",
"example": "aws-ap-se-1-m1-small"
},
"description": {
"type": "string"
"type": "string",
"example": "Description"
},
"label": {
"type": "string"
"type": "string",
"example": "DynamicVM"
},
"name": {
"description": "VM name or VM group name if is (not empty) \u0026\u0026 (\u003e 0). If it is a group, actual VM name will be generated with -N postfix.",
Expand Down Expand Up @@ -6485,7 +6493,8 @@
],
"properties": {
"connectionName": {
"type": "string"
"type": "string",
"example": "testcloud01-seoul"
},
"description": {
"type": "string"
Expand Down
9 changes: 9 additions & 0 deletions src/api/rest/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1185,6 +1185,7 @@ definitions:
mcis.TbMcisDynamicReq:
properties:
description:
example: Made in CB-TB
type: string
installMonAgent:
default: "yes"
Expand All @@ -1202,6 +1203,7 @@ definitions:
example: custom tag
type: string
name:
example: default
type: string
vm:
items:
Expand Down Expand Up @@ -1250,6 +1252,7 @@ definitions:
mcis.TbMcisReq:
properties:
description:
example: Made in CB-TB
type: string
installMonAgent:
default: "yes"
Expand All @@ -1267,6 +1270,7 @@ definitions:
example: custom tag
type: string
name:
example: default
type: string
placementAlgo:
type: string
Expand All @@ -1282,13 +1286,17 @@ definitions:
properties:
commonImage:
description: CommonImage is field for id of a image in common namespace
example: ubuntu18.04
type: string
commonSpec:
description: CommonSpec is field for id of a spec in common namespace
example: aws-ap-se-1-m1-small
type: string
description:
example: Description
type: string
label:
example: DynamicVM
type: string
name:
description: VM name or VM group name if is (not empty) && (> 0). If it is
Expand Down Expand Up @@ -1423,6 +1431,7 @@ definitions:
mcis.TbVmReq:
properties:
connectionName:
example: testcloud01-seoul
type: string
description:
type: string
Expand Down
1 change: 1 addition & 0 deletions src/core/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const (
StrSecurityGroup string = "securityGroup"
StrSpec string = "spec"
StrVNet string = "vNet"
StrDefaultResourceName string = "-tb-default"
)

var StartTime string
Expand Down
8 changes: 4 additions & 4 deletions src/core/mcir/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -1457,9 +1457,9 @@ func LoadDefaultResource(nsId string, resType string, connectionName string) err
}

connectionName := row[1]
resourceName := connectionName
// To avoid naming-rule violation, modify the string
resourceName = ToNamingRuleCompatible(resourceName)
//resourceName := connectionName
// Default resource name has this pattern (nsId + "-tb-default")
resourceName := nsId + common.StrDefaultResourceName
description := "Generated Default Resource"

for _, resType := range resList {
Expand Down Expand Up @@ -1496,7 +1496,7 @@ func LoadDefaultResource(nsId string, resType string, connectionName string) err
reqTmp.Name = resourceName
reqTmp.Description = description

reqTmp.VNetId = reqTmp.ConnectionName
reqTmp.VNetId = resourceName

// open all firewall for default securityGroup
rule := SpiderSecurityRuleInfo{FromPort: "1", ToPort: "65535", IPProtocol: "tcp", Direction: "inbound", CIDR: "0.0.0.0/0"}
Expand Down
Loading