This commit is contained in:
2025-11-18 16:20:26 +03:00
parent 4b3f21d9be
commit e42fbcef39
397 changed files with 17560 additions and 1501 deletions

View File

@@ -192,6 +192,11 @@ func createK8sListSchema() map[string]*schema.Schema {
Type: schema.TypeInt,
Optional: true,
},
"zone_id": {
Type: schema.TypeInt,
Optional: true,
Description: "Zone ID",
},
"items": {
Type: schema.TypeList,

View File

@@ -92,6 +92,7 @@ func resourceK8sCreate(ctx context.Context, d *schema.ResourceData, m interface{
createReq.K8SCIID = uint64(d.Get("k8sci_id").(int))
createReq.WorkerGroupName = d.Get("wg_name").(string)
createReq.NetworkPlugin = d.Get("network_plugin").(string)
createReq.StoragePolicyID = uint64(d.Get("storage_policy_id").(int))
var masterNode K8sNodeRecord
if masters, ok := d.GetOk("masters"); ok {
@@ -665,6 +666,11 @@ func resourceK8sSchemaMake() map[string]*schema.Schema {
Description: "Network plugin to be used",
ValidateFunc: validation.StringInSlice([]string{"flannel", "weavenet", "calico"}, true),
},
"storage_policy_id": {
Type: schema.TypeInt,
Required: true,
Description: "ID of the storage policy",
},
"zone_id": {
Type: schema.TypeInt,
Optional: true,

View File

@@ -95,6 +95,7 @@ func resourceK8sCPCreate(ctx context.Context, d *schema.ResourceData, m interfac
createReq.K8SCIID = uint64(d.Get("k8sci_id").(int))
createReq.WorkerGroupName = "temp"
createReq.NetworkPlugin = d.Get("network_plugin").(string)
createReq.StoragePolicyID = uint64(d.Get("storage_policy_id").(int))
if zoneID, ok := d.GetOk("zone_id"); ok {
createReq.ZoneID = uint64(zoneID.(int))
@@ -680,6 +681,11 @@ func resourceK8sCPSchemaMake() map[string]*schema.Schema {
Description: "Network plugin to be used",
ValidateFunc: validation.StringInSlice([]string{"flannel", "weavenet", "calico"}, true),
},
"storage_policy_id": {
Type: schema.TypeInt,
Required: true,
Description: "ID of the storage policy",
},
"zone_id": {
Type: schema.TypeInt,
Optional: true,

View File

@@ -65,14 +65,15 @@ func resourceK8sWgCreate(ctx context.Context, d *schema.ResourceData, m interfac
c := m.(*controller.ControllerCfg)
req := k8s.WorkersGroupAddRequest{
K8SID: uint64(d.Get("k8s_id").(int)),
Name: d.Get("name").(string),
WorkerNum: uint64(d.Get("num").(int)),
WorkerCPU: uint64(d.Get("cpu").(int)),
WorkerRAM: uint64(d.Get("ram").(int)),
WorkerSEPID: uint64(d.Get("worker_sep_id").(int)),
WorkerSEPPool: d.Get("worker_sep_pool").(string),
Chipset: d.Get("chipset").(string),
K8SID: uint64(d.Get("k8s_id").(int)),
Name: d.Get("name").(string),
WorkerNum: uint64(d.Get("num").(int)),
WorkerCPU: uint64(d.Get("cpu").(int)),
WorkerRAM: uint64(d.Get("ram").(int)),
WorkerSEPID: uint64(d.Get("worker_sep_id").(int)),
WorkerSEPPool: d.Get("worker_sep_pool").(string),
Chipset: d.Get("chipset").(string),
StoragePolicyID: uint64(d.Get("storage_policy_id").(int)),
}
labels, _ := d.Get("labels").([]interface{})
@@ -276,6 +277,12 @@ func resourceK8sWgSchemaMake() map[string]*schema.Schema {
Description: "Name of the worker group.",
},
"storage_policy_id": {
Type: schema.TypeInt,
Required: true,
Description: "ID of the storage policy",
},
"num": {
Type: schema.TypeInt,
Optional: true,

View File

@@ -55,12 +55,6 @@ func utilityK8CIListCheckPresence(ctx context.Context, d *schema.ResourceData, m
if status, ok := d.GetOk("status"); ok {
req.Status = status.(string)
}
if worker_driver, ok := d.GetOk("worker_driver"); ok {
req.WorkerDriver = worker_driver.(string)
}
if master_driver, ok := d.GetOk("master_driver"); ok {
req.MasterDriver = master_driver.(string)
}
if network_plugin, ok := d.GetOk("network_plugin"); ok {
req.NetworkPlugins = network_plugin.(string)
}

View File

@@ -278,6 +278,9 @@ func utilityK8sListCheckPresence(ctx context.Context, d *schema.ResourceData, m
if size, ok := d.GetOk("size"); ok {
req.Size = uint64(size.(int))
}
if zoneID, ok := d.GetOk("zone_id"); ok {
req.ZoneID = uint64(zoneID.(int))
}
k8sList, err := c.CloudAPI().K8S().List(ctx, req)
if err != nil {