@@ -825,14 +825,52 @@ func (me *TkeService) ModifyClusterAttribute(ctx context.Context, id string, pro
825825 return
826826}
827827
828- func (me * TkeService ) ModifyClusterVersion (ctx context.Context , id string , clusterVersion string ) (errRet error ) {
828+ func (me * TkeService ) ModifyClusterVersion (ctx context.Context , id string , clusterVersion string , extraArgs interface {} ) (errRet error ) {
829829 logId := getLogId (ctx )
830830 request := tke .NewUpdateClusterVersionRequest ()
831831 defer func () {
832832 if errRet != nil {
833833 log .Printf ("[CRITAL]%s api[%s] fail, reason[%s]\n " , logId , request .GetAction (), errRet .Error ())
834834 }
835835 }()
836+
837+ if extraArgs != nil && len (extraArgs .([]interface {})) > 0 {
838+ // the first elem is in use
839+ extraInterface := extraArgs .([]interface {})
840+ extraMap := extraInterface [0 ].(map [string ]interface {})
841+
842+ kas := make ([]* string , 0 )
843+ if kaArgs , exist := extraMap ["kube_apiserver" ]; exist {
844+ args := kaArgs .([]interface {})
845+ for index := range args {
846+ str := args [index ].(string )
847+ kas = append (kas , & str )
848+ }
849+ }
850+ kcms := make ([]* string , 0 )
851+ if kcmArgs , exist := extraMap ["kube_controller_manager" ]; exist {
852+ args := kcmArgs .([]interface {})
853+ for index := range args {
854+ str := args [index ].(string )
855+ kcms = append (kcms , & str )
856+ }
857+ }
858+ kss := make ([]* string , 0 )
859+ if ksArgs , exist := extraMap ["kube_scheduler" ]; exist {
860+ args := ksArgs .([]interface {})
861+ for index := range args {
862+ str := args [index ].(string )
863+ kss = append (kss , & str )
864+ }
865+ }
866+
867+ request .ExtraArgs = & tke.ClusterExtraArgs {
868+ KubeAPIServer : kas ,
869+ KubeControllerManager : kcms ,
870+ KubeScheduler : kss ,
871+ }
872+ }
873+
836874 request .ClusterId = & id
837875 request .DstVersion = & clusterVersion
838876
0 commit comments