CB Spider VM User Guide - cloud-barista/cb-spider GitHub Wiki

Driver 개발 가이드

CSP별 VM 기본 사용자 및 cb-user 적용 방법

CSP VM 기본 사용자 Driver별 적용 방법 비고
AWS ubuntu, ec2-user 등 Image에 의존 cloud-init(Launch시/userdata) 공통 cloud-init 사용
Azure azureuser 또는 설정 가능 API 설정(OSProfile)
GCP VM KeyPair 생성시 user 설정 가능 VM KeyPair cb-user 설정
Alibaba root 고정 cloud-init(Launch시/userdata) 공통 cloud-init 사용 Group 등록 보류 (cf)
Tencent ubuntu, root 등 Image에 의존 cloud-init(Launch시/userdata) 별도 cloud-init 사용
IBM ubuntu 등 Image에 의존 cloud-init(Launch시/userdata) 별도 cloud-init 사용
OpenStack ubuntu 등 Image에 의존 cloud-init(Launch시/userdata) 별도 cloud-init 사용
Cloudit root (VM KeyPair 미지원) shell script(Launch 후 설정)
KT Cloud root 고정 cloud-init(Launch시/userdata) 별도 cloud-init 사용
NCP * root 고정, Password 방식만 지원Private Key로 로그인 미지원 cloud-init(Launch시/userdata) 별도 cloud-init 사용VM 밖에서 생성한 public key 적용

Cloud Driver 적용 방법 우선순위(order:높은순)

  1. CSP API 활용(ex. Azure OSProfile)
  2. Launch시 적용(ex. AWS userdata) (1) cloud-init directive 활용 (2) shell scripts 활용
  3. Launch후 적용(ex. Azure Run Command) (1) cloud-init directive 활용 (2) shell scripts 활용

cb-user Key관련

  • StartVM() 인자로 넘겨 받은 Key Name 활용
    • Key Name: KeyPairHandler로 사용자가 생성한 Key 이름
    • Key 자체는 CSP로부터 받아서 처리 또는 Driver에서 관리 중인 Key 활용한 처리

Error Handling Guide

  • Error handling
    • 에러 반환 및 메시지 출력
      • cblog.error("{CSP}-{VM-Name}:" + "Error adding cb-User to new VM" + ": {CSP 제공 오류 메시지}")
    • return error
    • Driver: 생성한 VM은 별도 처리하지 않음
      • Driver별로 적용 방법 및 CSP에 따라 VM이 생성되어 있을 수도 있고 생성되지 않았을 수도 있음
    • Spider Server: Driver로부터 오류를 리턴 받으면, 대상 VM 삭제 요청 후 오류 메시지 반환 (@todo)
  • 구현 현황 (2021.05.09)
    • cloudit: 반영됨.
    • cloud-init 활용 드라이버들(AWS, Alibaba, OpenStack): cloud-init log가 VM 내부에 기록되고 있어, 추가 분석 필요

참고: cloud-init 지원 CloudOS(CSP) 및 Linux 현황

https://cloudinit.readthedocs.io/en/latest/topics/availability.html

참고: AWS

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/managing-users.html https://aws.amazon.com/ko/premiumsupport/knowledge-center/new-user-accounts-linux-instance/ https://aws.amazon.com/ko/premiumsupport/knowledge-center/ec2-user-account-cloud-init-user-data/

참고: Azure

https://docs.microsoft.com/en-us/azure/virtual-machines/linux/create-vm-rest-api https://docs.microsoft.com/en-us/azure/virtual-machines/linux/run-command https://docs.microsoft.com/en-us/azure/virtual-machines/linux/using-cloud-init

참고: GCP

https://cloud.google.com/compute/docs/instances/access-overview?hl=ko

참고: Alibaba

참고: OpenStack

참고: Cloudit