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

Add Cloud Adaptive Network configuration when creating MCIS #1054

Merged

Conversation

yunkon-kim
Copy link
Member

MCIS 생성 시 Cloud Adaptive Network를 배치(configuration)하기 위한 PR 입니다.

현재 초기 버전이고 논의를 통해 개선해 나가고자 합니다 ^^

주요 변경 사항

  • Create networking.go
  • Add configureCloudAdaptiveNetwork() to provisioning.go
  • Update go.mod and go.sum

테스트

/tumblebug/ns/{nsId}/mcisDynamic API를 통한 테스트 및 디버깅 수행

예정 사항

  1. TbMcisInfo 업데이트 예정
    소스코드의 여러 부분에 영향을 줄 것 같습니다. 주의사항/팁이 있으시면 공유 부탁드립니다 ^^
// TbMcisInfo is struct for MCIS info
type TbMcisInfo struct {
	Id           string          `json:"id"`
	Name         string          `json:"name"`
	Status       string          `json:"status"`
	StatusCount  StatusCountInfo `json:"statusCount"`
	TargetStatus string          `json:"targetStatus"`
	TargetAction string          `json:"targetAction"`

	// InstallMonAgent Option for CB-Dragonfly agent installation ([yes/no] default:yes)
	InstallMonAgent string `json:"installMonAgent" example:"yes" default:"yes" enums:"yes,no"` // yes or no

+	// ConfigureCloudAdaptiveNetwork is an option to configure Cloud Adaptive Network (CLADNet) ([yes/no] default:yes)
+	ConfigureCloudAdaptiveNetwork string `json:"configureCloudAdaptiveNetwork" example:"yes" default:"yes" enums:"yes,no"` // yes or no

	// Label is for describing the mcis in a keyword (any string can be used)
	Label string `json:"label" example:"User custom label"`

	// SystemLabel is for describing the mcis in a keyword (any string can be used) for special System purpose
	SystemLabel string `json:"systemLabel" example:"Managed by CB-Tumblebug" default:""`

	PlacementAlgo string     `json:"placementAlgo,omitempty"`
	Description   string     `json:"description"`
	Vm            []TbVmInfo `json:"
  1. provisioning.go에서 Cloud Adaptive Network 배치 구분 추가
    현재 3곳 중 1곳에 적용 및 테스트한 상황으로 아래 함수에서 CB-Dragonfly agent 부분에 추가 예정
  • CreateMcisGroupVm()
  • CorePostMcisVm()

- Create `networking.go`
- Add configureCloudAdaptiveNetwork() to `provisioning.go`
- Update `go.mod` and `go.sum`
@yunkon-kim yunkon-kim self-assigned this Mar 31, 2022
@@ -965,6 +970,13 @@ func CreateMcis(nsId string, req *TbMcisReq, option string) (*TbMcisInfo, error)
}
}

// Configure Cloud Adaptive Network
if true { //mcisTmp.ConfigureCloudAdaptiveNetwork != "no" {
Copy link
Member Author

@yunkon-kim yunkon-kim Mar 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

조건(true)는 향후 mcisTmp.ConfigureCloudAdaptiveNetwork != "no"와 같이 변경할 예정입니다 ^^
(현재는 테스트를 위해 true로 지정)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@yunkon-kim 기여 감사합니다 :)

(현재는 테스트를 위해 true로 지정)

현재 해당 PR은 WIP 상태인가요?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

네, 맞습니다 ^^

// // ConfigureCloudAdaptiveNetwork is an option to configure Cloud Adaptive Network (CLADNet) ([yes/no] default:yes)
// ConfigureCloudAdaptiveNetwork string `json:"configureCloudAdaptiveNetwork" example:"yes" default:"yes" enums:"yes,no"` // yes or no

if (req.InstallMonAgent != "no" || option != "register") || true { // mcisTmp.ConfigureCloudAdaptiveNetwork != "no" {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

조건(true)은 향후 mcisTmp.ConfigureCloudAdaptiveNetwork != "no"와 같이 변경할 예정입니다 ^^
(현재는 테스트를 위해 true로 지정)

@yunkon-kim
Copy link
Member Author

테스트

/tumblebug/ns/{nsId}/mcisDynamic API를 통한 테스트 및 디버깅 수행

누락된 부분이 있어 말씀 드립니다.

cb-network controller, cb-network cladnet-service을 구동한 상태에서 테스트를 진행할 수 있습니다 ^^;; (cb-network admin-web는 선택적)

앞으로 원활한 테스트를 위해 상시 구동환경을 구축해 놓을 예정입니다 😃

common.CBLog.Debug("Start.........")

// Check cb-network endpoints
gRPCServiceEndpoint, etcdEndpoints, err := checkCBNetworkEndpoints()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
gRPCServiceEndpoint, etcdEndpoints, err := checkCBNetworkEndpoints()
networkServiceEndpoint, etcdEndpoints, err := checkCBNetworkEndpoints()

gRPCServiceEndpoint 값에는 아마
CB_NETWORK_SERVICE_ENDPOINT=localhost:8053
가 입력되는 것 같네요.

gRPC는 프로토콜(방법)에 대한 상세 사항이고,
현재 코드가 REST로 처리되고 있는 것으로 봐서,
굳이 방법 자체를 변수명에 포함할 필요가 없다는 생각이 듭니다. (전반적으로)

아마 etcdEndpoints 와의 구분을 위해서 특정하신 것 같기도 합니다만.. ^^

어떻게 생각하시나요?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seokho-son

히스토리를 꿰뚫어 보시네요 ㅎㅎ

제가 보기에도 networkServiceEndpoint가 더 적절한것 같습니다 ^^

@yunkon-kim yunkon-kim added the wip working in progress (do not merge) label Apr 1, 2022
@seokho-son
Copy link
Member

seokho-son commented Apr 1, 2022

@yunkon-kim 아, 그리고 MCIS Provisioning 단계에 포함하기 이전에
단위 테스트 차원에서 별도의 API로 뽑아둬도 좋을 것 같다는 생각이 듭니다. 디버깅도 조금 더 쉬워질 것 같고요.

예를 들면, CB-DF Agent도 구동 중인 MCIS에 별도의 API로 설치할 수 있도록 (개발자용) API를 제공하고 있습니당.

https://cloud-barista.github.io/cb-tumblebug-api-web/?url=https://raw.githubusercontent.com/cloud-barista/cb-tumblebug/main/src/api/rest/docs/swagger.yaml#/%5BInfra%20service%5D%20MCIS%20Resource%20monitor%20(for%20developer)

POST
​/ns​/{nsId}​/monitoring​/install​/mcis​/{mcisId}
Install monitoring agent (CB-Dragonfly agent) to MCIS

GET
​/ns​/{nsId}​/monitoring​/mcis​/{mcisId}​/metric​/{metric}
Get monitoring data of specified MCIS for specified monitoring metric (cpu, memory, disk, network)

@yunkon-kim
Copy link
Member Author

@seokho-son

말씀해주신 방향으로 진행하면 통합 작업이 한결 수월하겠네요. 감사합니다 ^^

- Reset `provisioning.go` and add variables related to the cb-network agent
- Add a REST API to configure Cloud Adaptive Network to MCIS
@yunkon-kim
Copy link
Member Author

@seokho-son

말씀하신 내용을 바탕으로 수정 반영 하였고요.

provisioning.go를 기존 코드로 되돌린 후, 아래와 같이 두 변수를 추가하였습니다. (+VM 생성시 마킹)

cb-network agent 설치 여부를 체크하기 위하여 추가하였고요. 추가한 변수가 API 등 다른 부분에 많은 영향을 줄지 문의 드립니다. (영향을 주는 부분이 많다면 다른 방법을 강구해보겠습니다 ^^;;)

type TbMcisInfo struct {
	Id           string          `json:"id"`
	Name         string          `json:"name"`
	Status       string          `json:"status"`
	StatusCount  StatusCountInfo `json:"statusCount"`
	TargetStatus string          `json:"targetStatus"`
	TargetAction string          `json:"targetAction"`

	// InstallMonAgent Option for CB-Dragonfly agent installation ([yes/no] default:yes)
	InstallMonAgent string `json:"installMonAgent" example:"yes" default:"yes" enums:"yes,no"` // yes or no

+	// ConfigureCloudAdaptiveNetwork is an option to configure Cloud Adaptive Network (CLADNet) ([yes/no] default:yes)
+	ConfigureCloudAdaptiveNetwork string `json:"configureCloudAdaptiveNetwork" example:"yes" default:"yes" enums:"yes,no"` // yes or no

	// Label is for describing the mcis in a keyword (any string can be used)
	Label string `json:"label" example:"User custom label"`

	// SystemLabel is for describing the mcis in a keyword (any string can be used) for special System purpose
	SystemLabel string `json:"systemLabel" example:"Managed by CB-Tumblebug" default:""`

	PlacementAlgo string     `json:"placementAlgo,omitempty"`
	Description   string     `json:"description"`
	Vm            []TbVmInfo `json:"vm"`
}
// TbVmInfo is struct to define a server instance object
type TbVmInfo struct {
	Id      string `json:"id"`
	Name    string `json:"name"`
	IdByCSP string `json:"idByCSP"` // CSP managed ID or Name

	// defined if the VM is in a group
	VmGroupId string `json:"vmGroupId"`

	Location common.GeoLocation `json:"location"`

	// Required by CB-Tumblebug
	Status       string `json:"status"`
	TargetStatus string `json:"targetStatus"`
	TargetAction string `json:"targetAction"`

	// Montoring agent status
	MonAgentStatus string `json:"monAgentStatus" example:"[installed, notInstalled, failed]"` // yes or no// installed, notInstalled, failed

+	// NetworkAgent status
+	NetworkAgentStatus string `json:"networkAgentStatus" example:"[notInstalled, installing, installed, failed]"` // notInstalled, installing, installed, failed

	// Latest system message such as error message
	SystemMessage string `json:"systemMessage" example:"Failed because ..." default:""` // systeam-given string message

	// Created time
	CreatedTime string `json:"createdTime" example:"2022-11-10 23:00:00" default:""`

	Label       string `json:"label"`
	Description string `json:"description"`

	Region         RegionInfo `json:"region"` // AWS, ex) {us-east1, us-east1-c} or {ap-northeast-2}
	PublicIP       string     `json:"publicIP"`
	SSHPort        string     `json:"sshPort"`
	PublicDNS      string     `json:"publicDNS"`
	PrivateIP      string     `json:"privateIP"`
	PrivateDNS     string     `json:"privateDNS"`
	RootDiskType   string     `json:"rootDiskType"`
	RootDiskSize   string     `json:"rootDiskSize"`
	RootDeviceName string     `json:"rootDeviceName"`
	VMBootDisk     string     `json:"vmBootDisk"` // ex) /dev/sda1
	VMBlockDisk    string     `json:"vmBlockDisk"`

	ConnectionName   string   `json:"connectionName"`
	SpecId           string   `json:"specId"`
	ImageId          string   `json:"imageId"`
	VNetId           string   `json:"vNetId"`
	SubnetId         string   `json:"subnetId"`
	SecurityGroupIds []string `json:"securityGroupIds"`
	SshKeyId         string   `json:"sshKeyId"`
	VmUserAccount    string   `json:"vmUserAccount,omitempty"`
	VmUserPassword   string   `json:"vmUserPassword,omitempty"`

	CspViewVmDetail SpiderVMInfo `json:"cspViewVmDetail,omitempty"`
}

VM에 마킹하는 부분

// AddVmToMcis is func to add VM to MCIS
func AddVmToMcis(wg *sync.WaitGroup, nsId string, mcisId string, vmInfoData *TbVmInfo, option string) error {
	...

	// Monitoring Agent Installation Status (init: notInstalled)
	vmInfoData.MonAgentStatus = "notInstalled"
+	vmInfoData.NetworkAgentStatus = "notInstalled"
	...
}

Copy link
Member

@seokho-son seokho-son left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

export CB_NETWORK_SERVICE_ENDPOINT=localhost:8053
export CB_NETWORK_ETCD_ENDPOINTS='["localhost:2379"]'

@yunkon-kim 이 두 세트만 구성하면, 제가 테스트해볼 수 있나요?

@@ -167,6 +167,9 @@ type TbMcisInfo struct {
// InstallMonAgent Option for CB-Dragonfly agent installation ([yes/no] default:yes)
InstallMonAgent string `json:"installMonAgent" example:"yes" default:"yes" enums:"yes,no"` // yes or no

// ConfigureCloudAdaptiveNetwork is an option to configure Cloud Adaptive Network (CLADNet) ([yes/no] default:yes)
ConfigureCloudAdaptiveNetwork string `json:"configureCloudAdaptiveNetwork" example:"yes" default:"yes" enums:"yes,no"` // yes or no
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
ConfigureCloudAdaptiveNetwork string `json:"configureCloudAdaptiveNetwork" example:"yes" default:"yes" enums:"yes,no"` // yes or no
ConfigureCloudAdaptiveNetwork string `json:"configureCloudAdaptiveNetwork" example:"yes" default:"no" enums:"yes,no"` // yes or no

아직 특별한 상관은 없지만~
까먹기 전에 표기해두었습니다.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seokho-son

  1. 다음번 Commit에서 default: "no" 수정사항 반영하곘습니다.

  2. 테스트와 관련해서 제가 한세트 구성한 후 정보 공유 드리겠습니다 😄

export CB_NETWORK_SERVICE_ENDPOINT=localhost:8053 export CB_NETWORK_ETCD_ENDPOINTS='["localhost:2379"]'

@yunkon-kim 이 두 세트만 구성하면, 제가 테스트해볼 수 있나요?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seokho-son

테스트에 필요한 환경은 구성을 완료하였습니다. (정보는 Slack으로 공유 드리겠습니다 ^^)

그런데 테스트를 위해서 간단한 논의가 필요할 것 같습니다.

API를 먼저 추가하고 테스트를 진행하는 방식으로 변경 하면서 환경변수에 Endpoint 정보를 불러보는 부분을 제거했네요 ^^;;;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seokho-son

(최근 Commit)
API 호출시 Endpoints 가 전달되지 않을 경우 환경변수에서 불러오기를 시도하도록 변경하였습니다 ^^

- Read the endpoints from the env if not passed as a parameter
- Update method of endpoints passing or reading
- Fix invaild memory access
@yunkon-kim
Copy link
Member Author

@seokho-son

아래 사항 개선하여 Commit 하였습니다 ^^

  • API example and format 개선
  • setup.env에서 Format 개선 (JSON array -> comma separated)
  • Invalid memory access 이슈 해결

아래 테스트를 진행했고, 이슈는 없었습니다.

  • API dashboard에서 Parameter passing (i.e., network service endpoint, etcd endpoints) 방식 테스트
  • Parameter가 전달 되지 않을 경우, setup.env 환경변수 불러오는 방식 테스트

Swagger update 사항은 자동 생성 방식을 따르는게 좋을 것 같아 제외하였습니다.

@seokho-son seokho-son removed the wip working in progress (do not merge) label Apr 5, 2022
Copy link
Member

@seokho-son seokho-son left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :)

@seokho-son seokho-son merged commit 1ae0479 into cloud-barista:main Apr 5, 2022
@yunkon-kim yunkon-kim deleted the configure-cloud-adaptive-network branch April 7, 2022 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants