This commit is contained in:
2024-04-16 14:26:06 +03:00
parent bc264c4d90
commit e7c968797b
298 changed files with 11066 additions and 398 deletions

View File

@@ -8,8 +8,6 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// type Params []string
// CreateRequest struct to create kubernetes cluster
type CreateRequest struct {
// Name of Kubernetes cluster
@@ -74,7 +72,7 @@ type CreateRequest struct {
// Master node RAM volume in MB
// Required: false
MasterRAM uint `url:"masterRam,omitempty" json:"masterRam,omitempty"`
MasterRAM uint64 `url:"masterRam,omitempty" json:"masterRam,omitempty"`
// Master node boot disk size in GB If 0 is specified, size is defined by the OS image size
// Required: false
@@ -90,7 +88,7 @@ type CreateRequest struct {
// Worker node RAM volume in MB
// Required: false
WorkerRAM uint `url:"workerRam,omitempty" json:"workerRam,omitempty"`
WorkerRAM uint64 `url:"workerRam,omitempty" json:"workerRam,omitempty"`
// Worker node boot disk size in GB. If 0 is specified, size is defined by the OS image size
// Required: false
@@ -111,7 +109,7 @@ type CreateRequest struct {
// Custom sysctl values for Load Balancer instance. Applied on boot
// Required: false
LbSysctlParams string `url:"lbSysctlParams,omitempty" json:"lbSysctlParams,omitempty"`
LbSysctlParams []map[string]interface{} `url:"lbSysctlParams,omitempty" json:"lbSysctlParams,omitempty"`
// Use Highly Available schema for LB deploy
// Required: false
@@ -166,10 +164,16 @@ type CreateRequest struct {
OidcCertificate string `url:"oidcCertificate,omitempty" json:"oidcCertificate,omitempty"`
}
// type wrapperCreateRequest struct {
// CreateRequest
// Params []string `url:"lbSysctlParams,omitempty"`
// }
// GetRAM returns RAM field values
func (r CreateRequest) GetRAM() map[string]uint64 {
res := make(map[string]uint64, 2)
res["MasterRAM"] = r.MasterRAM
res["WorkerRAM"] = r.WorkerRAM
return res
}
// Create creates a new Kubernetes cluster in the specified Resource Group
func (k8s K8S) Create(ctx context.Context, req CreateRequest) (string, error) {
@@ -178,28 +182,6 @@ func (k8s K8S) Create(ctx context.Context, req CreateRequest) (string, error) {
return "", validators.ValidationErrors(validators.GetErrors(err))
}
// var params []string
// if len(req.LbSysctlParams) != 0 {
// params = make([]string, 0, len(req.LbSysctlParams))
// for r := range req.LbSysctlParams {
// b, err := json.Marshal(req.LbSysctlParams[r])
// if err != nil {
// return "", err
// }
// params = append(params, string(b))
// }
// } else {
// params = []string{"[]"}
// }
// reqWrapped := wrapperCreateRequest{
// CreateRequest: req,
// Params: params,
// }
url := "/cloudapi/k8s/create"
res, err := k8s.client.DecortApiCallMP(ctx, http.MethodPost, url, req)