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

Seamless K8s Cluster Provisioning Support #1582

Merged

Conversation

sykim-etri
Copy link
Member

K8s cluster provisioning 개발 진행을 위한 의견 교환을 위해 생성한 PR입니다.

  • assets/k8sclusterinfo.yaml 예제를 생성하고, Viper를 통해 K8sClusterInfo 구조체를 생성
  • RecommendVm를 활용하여 클러스터 노드그룹에 포함될 Spec으로 초기 필터링을 하고, 필터링된 Spec들을 대상으로 k8sclusterinfo.yaml에서 가용한 범위로 재필터링(region과 available 중심)

@yunkon-kim yunkon-kim added wip working in progress (do not merge) and removed wip working in progress (do not merge) labels May 23, 2024
@sykim-etri sykim-etri added the wip working in progress (do not merge) label May 24, 2024
@seokho-son seokho-son changed the title Seamless K8s Cluster Provisioning 지원 Seamless K8s Cluster Provisioning Support May 27, 2024
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.

@sykim-etri 세부검토를 위해 몇가지 질문을 드립니다. :)

version:
- region: [kr1, kr2]
available:
- name: 1.28
Copy link
Member

Choose a reason for hiding this comment

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

Q: 버전 별로 가용 이미지가 변하지는 않나요? (예를 들어, 1.24.6-aliyun.1은 aliyun_3_9_x64_20G_alibase_20231219.vhd 를 사용할 수 없다든지)

Copy link
Member Author

Choose a reason for hiding this comment

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

AWS, GCP, Azure, Alibaba, Tencent, NHNCloud, NCPVPC의 경우 버전별로 가용 이미지가 다르진 않는 것으로 파악되었고, IBM은 불명확하나 제약이 있는 것으로 보이진 않습니다.

Copy link
Member

Choose a reason for hiding this comment

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

@sykim-etri 확인 감사합니다. 그럼 Spec, Image 와는 별도로 관리하면 좋을 것 같습니다.
사용자가 API로 가용 version 리스트 확인이 가능하게 하고, 클러스터 생성/노드 추가시에 해당 값을 사용할 수 있도록 해두면 좋을 것 같습니다. :)

Copy link
Member Author

Choose a reason for hiding this comment

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

사용자가 API로 가용 version 리스트 확인이 가능하게 하고,

k8sclusterinfo.yaml에 저장된 내용을 확인할 수 있는 API는 가능한데, 어떤 시나리오에서 활용이 되는 걸까요?

CSP에서 가용 Version 목록 조회가 가능한 API가 있는 경우도 있는데, 현재 CB-SP에서는 지원하지는 않고 있습니다만 추후 지원시 k8sclusterinfo.yaml 대신 CB-SP를 통해 해당 정보를 전달할 수 있을 것 같습니다.

클러스터 생성/노드 추가시에 해당 값을 사용할 수 있도록 해두면 좋을 것 같습니다. :)

참고로 버전 정보는 클러스터 생성시에만 적용 가능한 상황입니다.

Copy link
Member Author

Choose a reason for hiding this comment

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

RecommendK8sClusterSpec 방식이 아닌 노드 스펙 필터링 후 이용 가능한 버전 등을 제공하는 방식으로 진행하기로 함.

- name: 1.24
id: 1.24.6-aliyun.1
- region: [jp1]
nodeImage:
Copy link
Member

Choose a reason for hiding this comment

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

  • Q: Image와 다르게 Spec 명세는 구성파일에 없는 것 같은데, Spec의 경우 기존 VM 의 Spec 관리 체계를 따르도록 처리 예정이신가요?
  • Q: Image도 향후에 이슈가 없으면, 기존 VM의 Image 관리 체계를 사용할 수 있지않을까요?

Copy link
Member Author

Choose a reason for hiding this comment

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

  • Q: Image와 다르게 Spec 명세는 구성파일에 없는 것 같은데, Spec의 경우 기존 VM 의 Spec 관리 체계를 따르도록 처리 예정이신가요?

일부 CSP(ex. Alibaba)의 경우 콘솔에서 확인되는 가용 Node Spec이 VM Spec과는 다른 경우가 왕왕 보이긴 하지만 assets/cloudspec.csv에 등록된 VM의 Spec들과 크게 차이가 나지는 않는 것으로 보여서 기존 VM의 Spec 관리 체계를 활용해볼 예정입니다.

  • Q: Image도 향후에 이슈가 없으면, 기존 VM의 Image 관리 체계를 사용할 수 있지않을까요?

K8s용 이미지들도 기존 VM의 Image 관리 체계(assets/cloudimage.csv)에 별도 필드(container runtime, gpu, ...)를 추가하여 통합할 방법을 고려해보겠습니다.

참고로 K8s 이미지의 경우 CSP별로 자체 최적화한 이미지(자동 업그레이드 기능 연동 등) 사용을 추천하고 있습니다.

Copy link
Member Author

Choose a reason for hiding this comment

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

RecommendK8sClusterSpec 방식이 아닌 노드 스펙 필터링 후 이용 가능한 버전 등을 제공하는 방식으로 진행하기로 함.

src/core/mcis/recommendation.go Outdated Show resolved Hide resolved
src/core/mcis/recommendation.go Outdated Show resolved Hide resolved
Sooyoung Kim added 2 commits June 3, 2024 18:38
@sykim-etri
Copy link
Member Author

@seokho-son
기존 코드 일부를 revert하고,
GetK8sClusterInfo(), GetAvailableK8sClusterVersion(), GetAvailableK8sClusterNodeImage() 함수 추가 및 관련 REST API를 추가하였습니다.

의견 주신 바를 토대로 다음과 같은 동작 흐름을 생각하고 있습니다.

  1. 사용자는 원하는 노드 스펙 정보를 입력하고 mcisRecommendVM API를 호출하여 적절한 스펙 목록을 확보
  2. 사용자는 스펙 목록 중 원하는 스펙을 선택하면, K8sClusterVersion API와 K8sClusterNodeImage API를 호출하여 이용 가능한 버전과 노드 이미지 목록을 확보
  3. 사용자는 원하는 K8s 버전과 노드 이미지를 선택하여 클러스터 생성 요청

새로 추가한 API 형태가 적절한지, 상기 동작 흐름이 적절한지 등 의견 부탁드립니다.

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.

@sykim-etri 감사합니다. 훌륭한 초안인 것 같습니다! :)
아래 API 관련 의견만 보완하고, 소스에 머지하면 좋을 것 같습니다.

추가적으로
#1570 와 유사하게,
신규 추가된 API들을 활용하여, 클러스터 생성 및 노드그룹 추가 등을 어떻게 해야 하는지 가이드를 공유해주시면 감사하겠습니다.

Comment on lines 179 to 180
e.GET("/tumblebug/provider/:providerName/region/:regionName/k8sClusterVersion", rest_common.RestGetAvailableK8sClusterVersion)
e.GET("/tumblebug/provider/:providerName/region/:regionName/k8sClusterNodeImage", rest_common.RestGetAvailableK8sClusterNodeImage)
Copy link
Member

Choose a reason for hiding this comment

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

해당 API들은 Admin 설정에 관련된 API가 아닌 것 같습니다.

클러스터 프로비저닝을 위한 사용자 기능이므로, cluster 쪽으로 옮기고 api path를 정리하면 어떨까요?
https://github.com/cloud-barista/cb-tumblebug/pull/1582/files#diff-1da2cdbcf6cf44699760540236b475ffa7f37fceb9abd988e9852032c04393b1R310
(기존 cluster 관련 API 네이밍은 일관성 차원에서 향후 전반적인 수정이 필요해 보임)

provider/:providerName/region/:regionName 도 path에 들어날 필요가 없을 것 같습니다.
아래와 같이 정리하면 어떨까요?
// Cluster
g.GET("/tumblebug/availableK8sClusterVersion)
g.GET("/tumblebug/availableK8sClusterNodeImage)

(providerName, regionName 은 쿼리 파라미처로 처리)

Copy link
Member Author

Choose a reason for hiding this comment

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

혹시 /k8sClusterInfo도 // Cluster쪽으로 옮기는 것이 나을까요?
availableK8sClusterVersion/NodeImage와 같은 내용을 리턴하는 API이긴 한데.. CloudInfo와는 유사하기도 하고.. 모호한 측면이 있습니다.

Copy link
Member

Choose a reason for hiding this comment

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

일단 해당 항목은 사용자에게 직접 활용될것 같지는 않아서 admin 쪽에 둬도 괜찮을거라 생각했습니다만.. 나중에 전반적으로 정리하면 어떨까 싶습니다. :)

}

// RestGetAvailableK8sClusterNodeImage func is a rest api wrapper for GetAvailableK8sClusterNodeImage.
// RestGetAvailableK8sClusterNodeImage godoc
Copy link
Member

Choose a reason for hiding this comment

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

// @ID GetAvailableK8sClusterNodeImage
ID 주석도 추가 부탁 드립니다. (#1594 관련 사항)

함수명에서 Rest 부분을 제외한 명칭을 그대로 ID로 활용하시면 됩니다. (추가된 API 전체에 반영 필요)

@sykim-etri sykim-etri force-pushed the feat-add-recommend-k8scluster branch from f4f23d2 to 7e1f193 Compare June 5, 2024 10:58
@seokho-son
Copy link
Member

@sykim-etri 아, 추가적으로 대문자로 시작하는 함수들은 함수 설명 주석 제공 부탁드립니다. :)

…deImage APIs

o New APIs
 - [GET] /tumblebug/k8sClusterInfo
 - [GET]
   /tumblebug/availableK8sClusterVersion?providerName={providerName}&regionName={regionName}
 - [GET]
   /tumblebug/availableK8sClusterNodeImage?providerName={providerName}&regionName={regionName}

related to cloud-barista#1562
@sykim-etri sykim-etri force-pushed the feat-add-recommend-k8scluster branch from 7e1f193 to 311c3eb Compare June 5, 2024 11:05
@seokho-son
Copy link
Member

@sykim-etri 업데이트 완료되시면 알려주세요 ^^

@sykim-etri
Copy link
Member Author

sykim-etri commented Jun 5, 2024

@seokho-son
의견 주신 내용들에 대한 업데이트는 완료하였습니다. 추후 추가 진행될 내용들에 따라서 변경하면 될 것 같습니다.

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.

@sykim-etri 감사합니다! 승인하겠습니다.

추가된 API들을 활용하여, k8s 클러스터 생성하는 방법 간략한 가이드도 부탁드릴게요.
Issue나 Discussion 아이템을 활용하시면 될 것 같습니다.

@seokho-son seokho-son merged commit 54405c8 into cloud-barista:main Jun 7, 2024
5 checks passed
@sykim-etri sykim-etri removed the wip working in progress (do not merge) label Jun 10, 2024
@sykim-etri
Copy link
Member Author

sykim-etri commented Jun 10, 2024

추가적으로 #1570 와 유사하게, 신규 추가된 API들을 활용하여, 클러스터 생성 및 노드그룹 추가 등을 어떻게 해야 하는지 가이드를 공유해주시면 감사하겠습니다.

@seokho-son

  • Quick provisioning using mciDynamic #1570 과 같은 가이드 생성을 검토하다 보니 기존 클러스터 생성 API들을 그대로 활용하기가 아직 제약이 있습니다.
    • 클러스터 생성시 필요 정보
    {
      "connectionName": "testcloud01-seoul",
      "cspClusterId": "string",
      "description": "string",
      "id": "testcloud01-seoul-cluster",
      "nodeGroupList": [
        {
          "desiredNodeSize": "string",
          "imageId": "string",
          "maxNodeSize": "string",
          "minNodeSize": "string",
          "name": "string",
          "onAutoScaling": "string",
          "rootDiskSize": "default, 30, 42, ...",
          "rootDiskType": "default, TYPE1, ...",
          "specId": "string",
          "sshKeyId": "string"
        }
      ],
      "securityGroupIds": [
        "string"
      ],
      "subnetIds": [
        "string"
      ],
      "vNetId": "string",
      "version": "1.23.4"
    }
    

mcisDyanmic과 유사하게 k8sClusterDynamic(가칭)를 통해 시스템용 기본 MCIR 자원 (ex. ns01-systemdefault-xxx) 생성한 후 클러스터 생성이 진행되도록 해야 할 것으로 보입니다.
k8sClusterDynamicCheckReq도 필요할 것 같습니다.

@seokho-son
Copy link
Member

@sykim-etri
매뉴얼(자원 생성 단계 필요) 하더라도 생성 방법을 가이드하는게 더 중요하지 않나 싶습니다.
동일한 구성이라도 안정적으로 프로비저닝할 수 있는 방안 마련이 필요합니다.

  • 지원 CSP (문제 없이 돌아가는)
  • 지원 버전 선택 방법
  • 자원(vnet,...) 생성 방법 및 자원 생성시 의무사항 등
  • 접속 방법 등

메뉴얼한 방법이라도 가이드를 우선 작성하는 것이 어떨까요?
향후 k8sClusterDynamic 또는 mcis 형태로 제공 등은 차차 개선해 나가면 좋을 것 같습니다.

@sykim-etri
Copy link
Member Author

@seokho-son
MapUI를 통한 프로비저닝보다는 클러스터 생성 방법(API 사용법 등)에 대한 가이드 작성이 우선한다는 의미로 이해했고. 해당 측면으로 가이드 작성을 추진해 보겠습니다.

@sykim-etri
Copy link
Member Author

@seokho-son
방향성 검토를 위해 가이드 초안을 공유 드리오니, 보완 사항 등 검토를 부탁드립니다.

@sykim-etri sykim-etri deleted the feat-add-recommend-k8scluster branch June 26, 2024 08:40
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.

3 participants