Skip to content

Commit

Permalink
Merge pull request #1269 from seokho-son/main
Browse files Browse the repository at this point in the history
Show access info of Global-NLB
  • Loading branch information
seokho-son authored Nov 12, 2022
2 parents ab3e201 + 0c0dc03 commit c03c8cb
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 6 deletions.
9 changes: 4 additions & 5 deletions scripts/usecases/weavescope/startServer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ echo "[Start Weave Scope Cluster Monitoring]"

SECONDS=0

PublicIPs=${1}
PrivateIPs=${2}
PublicIPs=$@

echo "Installing Weavescope to MCIS..."

Expand All @@ -19,7 +18,7 @@ FILE="/usr/local/bin/scope"

echo "Installing prerequisite"
sudo apt-get update > /dev/null
sudo apt install docker.io -y
sudo apt install docker.io -y > /dev/null

PID=$(ps -ef | grep scope | awk '{print $2}')

Expand All @@ -30,7 +29,7 @@ fi

echo "Launching Weavescope"

sudo scope launch $PublicIPs $PrivateIPs
sudo scope launch $PublicIPs

echo "Done! elapsed time: $SECONDS"

Expand All @@ -40,4 +39,4 @@ PID=$(ps -ef | grep scope | awk '{print $2}')


echo "[Start Scope: complete] PID=$PID"
echo "$IP:4040/#!/state/{\"contrastMode\":true,\"topologyId\":\"containers-by-hostname\"}"
echo "$IP:4040"
3 changes: 3 additions & 0 deletions src/api/rest/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -8693,6 +8693,9 @@ const docTemplate = `{
"mcisId": {
"type": "string"
},
"mcisNlbListener": {
"$ref": "#/definitions/mcis.McisAccessInfo"
},
"mcisSubGroupAccessInfo": {
"type": "array",
"items": {
Expand Down
3 changes: 3 additions & 0 deletions src/api/rest/docs/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -8685,6 +8685,9 @@
"mcisId": {
"type": "string"
},
"mcisNlbListener": {
"$ref": "#/definitions/mcis.McisAccessInfo"
},
"mcisSubGroupAccessInfo": {
"type": "array",
"items": {
Expand Down
2 changes: 2 additions & 0 deletions src/api/rest/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1179,6 +1179,8 @@ definitions:
properties:
mcisId:
type: string
mcisNlbListener:
$ref: '#/definitions/mcis.McisAccessInfo'
mcisSubGroupAccessInfo:
items:
$ref: '#/definitions/mcis.McisSubGroupAccessInfo'
Expand Down
7 changes: 7 additions & 0 deletions src/core/mcis/manageInfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,11 +348,18 @@ func GetMcisAccessInfo(nsId string, mcisId string, option string) (*McisAccessIn
}

output.McisId = mcisId

mcNlbAccess, err := GetMcNlbAccess(nsId, mcisId)
if err == nil {
output.McisNlbListener = mcNlbAccess
}

subGroupList, err := ListSubGroupId(nsId, mcisId)
if err != nil {
common.CBLog.Error(err)
return temp, err
}
// TODO: make in parallel
for _, groupId := range subGroupList {
subGroupAccessInfo := McisSubGroupAccessInfo{}
subGroupAccessInfo.SubGroupId = groupId
Expand Down
9 changes: 8 additions & 1 deletion src/core/mcis/nlb.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import (
"github.com/go-resty/resty/v2"
)

const nlbPostfix = "-nlb"

// 2022-07-15 https://github.com/cloud-barista/cb-spider/blob/master/cloud-control-manager/cloud-driver/interfaces/resources/NLBHandler.go

// SpiderNLBReqInfoWrapper is a wrapper struct to create JSON body of 'Create NLB request'
Expand Down Expand Up @@ -288,7 +290,6 @@ func CreateMcSwNlb(nsId string, mcisId string, req *TbNLBReq, option string) (Tb
return emptyObj, err
}

nlbPostfix := "-nlb"
nlbMcisId := mcisId + nlbPostfix

// create a special MCIS for (SW)NLB
Expand Down Expand Up @@ -780,6 +781,12 @@ func GetNLB(nsId string, mcisId string, resourceId string) (TbNLBInfo, error) {
return res, err
}

// GetMcNlbAccess returns the requested TB G-NLB access info (currenly MCIS)
func GetMcNlbAccess(nsId string, mcisId string) (*McisAccessInfo, error) {
nlbMcisId := mcisId + nlbPostfix
return GetMcisAccessInfo(nsId, nlbMcisId, "")
}

// CheckNLB returns the existence of the TB NLB object in bool form.
func CheckNLB(nsId string, mcisId string, resourceId string) (bool, error) {

Expand Down
1 change: 1 addition & 0 deletions src/core/mcis/provisioning.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ type TbVmInfo struct {
// McisAccessInfo is struct to retrieve overall access information of a MCIS
type McisAccessInfo struct {
McisId string
McisNlbListener *McisAccessInfo `json:"mcisNlbListener,omitempty"`
McisSubGroupAccessInfo []McisSubGroupAccessInfo
}

Expand Down

0 comments on commit c03c8cb

Please sign in to comment.