This commit is contained in:
2023-05-19 17:14:55 +03:00
parent 8ca233dd32
commit 523d96189f
10 changed files with 77 additions and 69 deletions

View File

@@ -217,7 +217,7 @@ func resourceK8sRead(ctx context.Context, d *schema.ResourceData, m interface{})
return diag.FromErr(err)
}
enableReq := k8s.DisabelEnableRequest{
enableReq := k8s.DisableEnableRequest{
K8SID: id,
}
@@ -374,7 +374,7 @@ func resourceK8sUpdate(ctx context.Context, d *schema.ResourceData, m interface{
return diag.FromErr(err)
}
enableReq := k8s.DisabelEnableRequest{
enableReq := k8s.DisableEnableRequest{
K8SID: id,
}

View File

@@ -60,11 +60,28 @@ 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)),
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),
}
labels, _ := d.Get("labels").([]interface{})
for _, label := range labels {
req.Labels = append(req.Labels, label.(string))
}
annotations, _ := d.Get("annotations").([]interface{})
for _, annotation := range annotations {
req.Annotations = append(req.Annotations, annotation.(string))
}
taints, _ := d.Get("taints").([]interface{})
for _, taint := range taints {
req.Taints = append(req.Taints, taint.(string))
}
if d.Get("disk") == nil {
@@ -111,6 +128,7 @@ func resourceK8sWgRead(ctx context.Context, d *schema.ResourceData, m interface{
} else {
d.Set("k8s_id", d.Get("k8s_id"))
}
d.SetId(strings.Split(d.Id(), "#")[0])
flattenWg(d, *wg, workersComputeList)
@@ -234,6 +252,38 @@ func resourceK8sWgSchemaMake() map[string]*schema.Schema {
Computed: true,
Description: "Worker node boot disk size. If unspecified or 0, size is defined by OS image size.",
},
"labels": {
Type: schema.TypeList,
Computed: true,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"annotations": {
Type: schema.TypeList,
Computed: true,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"taints": {
Type: schema.TypeList,
Computed: true,
Optional: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"worker_sep_id": {
Type: schema.TypeInt,
Optional: true,
},
"worker_sep_pool": {
Type: schema.TypeString,
Optional: true,
},
"wg_id": {
Type: schema.TypeInt,
Computed: true,
@@ -246,31 +296,10 @@ func resourceK8sWgSchemaMake() map[string]*schema.Schema {
Schema: detailedInfoSchemaMake(),
},
},
"labels": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"guid": {
Type: schema.TypeString,
Computed: true,
},
"annotations": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
"taints": {
Type: schema.TypeList,
Computed: true,
Elem: &schema.Schema{
Type: schema.TypeString,
},
},
}
}
@@ -289,8 +318,8 @@ func ResourceK8sWg() *schema.Resource {
Timeouts: &schema.ResourceTimeout{
Create: &constants.Timeout600s,
Read: &constants.Timeout300s,
Update: &constants.Timeout300s,
Read: &constants.Timeout600s,
Update: &constants.Timeout600s,
Delete: &constants.Timeout300s,
Default: &constants.Timeout300s,
},