Skip to content

Commit

Permalink
feature. add params for creating cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
ktkfree committed Apr 24, 2023
1 parent 3626380 commit c87c433
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 23 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,4 @@ require (

replace github.com/openinfradev/tks-client => ./

//replace github.com/openinfradev/tks-api => ../tks-api
replace github.com/openinfradev/tks-api => ../tks-api
50 changes: 28 additions & 22 deletions internal/commands/cluster-create.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,17 @@ import (

func NewClusterCreateCommand(globalOpts *GlobalOptions) *cobra.Command {
var (
name string
organizationId string
description string
stackTemplateId string
region string
cloudAccountId string
machineType string
numOfAz int
machineReplicas int
name string
organizationId string
description string
stackTemplateId string
cloudAccountId string
cpNodeCnt int
cpNodeMachineType string
tksNodeCnt int
tksNodeMachineType string
userNodeCnt int
userNodeMachineType string
)

var command = &cobra.Command{
Expand All @@ -39,15 +41,17 @@ func NewClusterCreateCommand(globalOpts *GlobalOptions) *cobra.Command {
}

input := domain.CreateClusterRequest{
OrganizationId: organizationId,
StackTemplateId: stackTemplateId,
Name: name,
Description: description,
CloudAccountId: cloudAccountId,
NumOfAz: numOfAz,
MachineType: machineType,
Region: region,
MachineReplicas: machineReplicas,
OrganizationId: organizationId,
StackTemplateId: stackTemplateId,
Name: name,
Description: description,
CloudAccountId: cloudAccountId,
CpNodeCnt: cpNodeCnt,
CpNodeMachineType: cpNodeMachineType,
TksNodeCnt: tksNodeCnt,
TksNodeMachineType: tksNodeMachineType,
UserNodeCnt: userNodeCnt,
UserNodeMachineType: userNodeMachineType,
}

apiClient, err := _apiClient.New(globalOpts.ServerAddr, globalOpts.AuthToken)
Expand Down Expand Up @@ -79,10 +83,12 @@ func NewClusterCreateCommand(globalOpts *GlobalOptions) *cobra.Command {
command.Flags().StringVarP(&name, "name", "n", "", "the name of organization")
command.Flags().StringVarP(&description, "description", "d", "", "the description of organization")

command.Flags().StringVar(&region, "region", "ap-northeast-2", "AWS region")
command.Flags().StringVar(&machineType, "machine-type", "", "machine type for user node")
command.Flags().IntVar(&numOfAz, "num-of-az", 1, "number of available zone")
command.Flags().IntVar(&machineReplicas, "machine-replicas", 1, "the number of machine replica")
command.Flags().IntVar(&cpNodeCnt, "cp-node-cnt", 3, "number of control-plane nodes")
command.Flags().StringVar(&cpNodeMachineType, "cp-node-machine-type", "t3.large", "machine type for tks cp node")
command.Flags().IntVar(&tksNodeCnt, "tks-node-cnt", 3, "number of tks nodes")
command.Flags().StringVar(&tksNodeMachineType, "tks-node-machine-type", "t3.2xlarge", "machine type for tks node")
command.Flags().IntVar(&userNodeCnt, "user-node-cnt", 1, "number of control-plane nodes")
command.Flags().StringVar(&userNodeMachineType, "user-node-machine-type", "t3.large", "machine type for user node")

return command
}

0 comments on commit c87c433

Please sign in to comment.