@@ -825,14 +825,52 @@ func (me *TkeService) ModifyClusterAttribute(ctx context.Context, id string, pro
825
825
return
826
826
}
827
827
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 ) {
829
829
logId := getLogId (ctx )
830
830
request := tke .NewUpdateClusterVersionRequest ()
831
831
defer func () {
832
832
if errRet != nil {
833
833
log .Printf ("[CRITAL]%s api[%s] fail, reason[%s]\n " , logId , request .GetAction (), errRet .Error ())
834
834
}
835
835
}()
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
+
836
874
request .ClusterId = & id
837
875
request .DstVersion = & clusterVersion
838
876
0 commit comments