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

[GCP:Cluster] when calling SetNodeGroupAutoscaling(off -> on), how do we handle it? #1329

Closed
sykim-etri opened this issue Sep 10, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@sykim-etri
Copy link
Member

sykim-etri commented Sep 10, 2024

(PMKS) 개발,시험,이슈현황 내 GCP 행의 기타 이슈에 아래와 같은 내용이 있으며, 현재 시험 결과도 동일하게 off->on으로 변경시 min: 0, max: 0으로 이전 사용값으로 변하지는 않습니다.

* AutoScaling 설정변경 (현재설정으로는 끄기만 가능)
  on -> off : SetNodeGroupAutoScaling 으로 설정가능
  off -> on : max, min 값 필요

어떻게 처리하는 것이 좋을 지에 대한 의견 부탁드립니다.

@sykim-etri sykim-etri added enhancement New feature or request bug Something isn't working and removed enhancement New feature or request labels Sep 10, 2024
@sykim-etri
Copy link
Member Author

sykim-etri commented Sep 10, 2024

고려할 수 있는 방법으로는 keypair 저장 방식과 유사하게, nodepool의 autoscaling 관련 정보를 labels에 저장해 두는 방법이 있겠습니다.

@powerkimhub
Copy link
Member

@sykim-etri


  • 관련하여, 호출되는 Driver API는 다음과 같습니다.

    SetNodeGroupAutoScaling(clusterIID IID, nodeGroupIID IID, on bool) (bool, error)
    
  • 이 API가 호출되면,

    • Driver에서 nodeGroupIID를 이용하여 설정에 필요한
    • MinNodeSize, MaxNodeSize를 획득해서 실행 가능한지 점검 부탁드립니다.
  • 참고: NodeGroupInfo

    type NodeGroupInfo struct {
    
            ... 중략 ...
    
            // Scaling config.
            OnAutoScaling   bool `json:"OnAutoScaling" validate:"required" example:"true"`
            DesiredNodeSize int  `json:"DesiredNodeSize" validate:"required" example:"2"`
            MinNodeSize     int  `json:"MinNodeSize" validate:"required" example:"1"`
            MaxNodeSize     int  `json:"MaxNodeSize" validate:"required" example:"3"`
    
            ... 중략 ...
    
    }
    

@sykim-etri
Copy link
Member Author

SetNodeGroupAutoScaling(false) 호출하면 GCP에서는 MinNodeSize, MaxNodeSize 값을 관리하지 않은 것으로 보입니다.
더불어 SetNodeGroupAutoScaling(true) 호출시 MinNodeSize와 MaxNodeSize 값이 설정되어 있지 않아도 에러를 리턴하지는 않고 MinNodeSize와 MaxNodeSize 값을 각각 0으로 관리하고 있습니다.

또한 CreateCluster()나 AddNodeGroup()시 MinNodeSize와 MaxNodeSize를 설정하지 않은 경우도 각각 0으로 관리하고 있습니다. 이때 실제 생성되는 노드 수는 DesiredNodeSize만큼은 생성되었습니다.

@sykim-etri
Copy link
Member Author

임시 대응책으로 SetNodeGroupAutoScaling(true) 호출시 실제 ON으로 변경한 후 false 및 에러(ChangeNodeGroupAutoscaleSize로 설정값을 변경하도록 안내)를 리턴하는 방법도 있을 것으로 생각됩니다.

@powerkimhub
Copy link
Member

@sykim-etri


  • 분석 내용 및 제안 캄사합니다.
  • 추가 분석 내용 및 의견 공유 드립니다.

[코드 분석]

  • 다음은 관련 GCP SDK SetAutoscaling() 입력 Struct의 관련된 인자 부분 입니다.

    • comment 참고
    // NodePoolAutoscaling: NodePoolAutoscaling contains information
    // required by cluster autoscaler to adjust the size of the node pool to
    // the current cluster usage.
    type NodePoolAutoscaling struct {
    
        // Enabled: Is autoscaling enabled for this node pool.
        Enabled bool `json:"enabled,omitempty"`
    
        // MaxNodeCount: Maximum number of nodes for one location in the
        // NodePool. Must be >= min_node_count. There has to be enough quota to
        // scale up the cluster.
        MaxNodeCount int64 `json:"maxNodeCount,omitempty"`
    
        // MinNodeCount: Minimum number of nodes for one location in the
        // NodePool. Must be >= 1 and <= max_node_count.
        MinNodeCount int64 `json:"minNodeCount,omitempty"`
    
    • 위 MinNodeCount(이하 min) comment에 따르면, 최소 1과 같거나 커야 하고,
    • MaxNodeCount(이하 max)는 MinNodeCount 보다 같거나 커야 한다고 가이드 하고 있습니다.
    • 결국, Autoscaling OFF 시에는 무관하겠지만,
      • 의견 주신 것처럼, OFF 시에는 관리 자체를 안하거나,
      • 또는 OFF 시에는 반드시 두 값 모두 0으로 유지되어야 할수도...
    • 하지만, ON시에는 두 값 모두 0이 되는 상황이 되면 안되는 걸로 보입니다.

[동작 시험]

  • SetAutoscaling(off)
    • min, max 함께 설정 불가
    • off 설정 적용되면, min,max는 0으로 변경됨
  • SetAutoscaling(on)
    • min, max 설정 무관
    • 몇가지 조건 시험 결과
      • 설정 없으면 => OK (설정값: 0, 0)
        • 설정 없으면, min:0, max:0 설정과 동일할 걸로 생각됨
      • min:0, max:0 => OK (0, 0)
      • min:1, max:0 => fail
      • min:0, max:1 => OK (0, 1)
    • ※ 0 값 입력시 invalid input 에러 처리 해야 할 걸로 보이는데,
      • API를 on 설정과 함께 쓰면서 struct에서 min, max 설정에 omitempty가 설정되어 통과되는 상황으로 보임

[제안 방법]

  • SetNodeGroupAutoScaling(false): 정상 처리 // ON, (0, 0) 상태가 됨
  • SetNodeGroupAutoScaling(true): 에러 처리
    • 에러메시지 개요: GCP는 SetNodeGroupAutoScaling(true) 설정은 지원 불가, 대신 ChangeNodeGroupScaling()를 활용
  • ChangeNodeGroupScaling(deszired, min, max): 자동 ON됨 // ON, (m, n) 상태가 됨
    • 입력 값 범위 validation 점검/추가 필요
  - GCP는 min, max 값 설정은 on 상태에서만 가능. 
  - 그래서, Driver ChangeNodeGroupScaling 코드를 보면, 설정 시에 명시적으로 on 시키고 있음.

sykim-etri pushed a commit to sykim-etri/cb-spider that referenced this issue Sep 11, 2024
…ing API

related to cloud-barista#1329

o Return false with error when enabling autoscaling via
SetNodeGroupAutoScaling API
o Validate some parameters
@powerkimhub
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants