4.7.0
This commit is contained in:
@@ -103,16 +103,17 @@ func dataSourceK8sRead(ctx context.Context, d *schema.ResourceData, m interface{
|
||||
}
|
||||
|
||||
d.Set("kubeconfig", kubeconfig)
|
||||
if cluster.LBID != 0 {
|
||||
getLbReq := lb.GetRequest{LBID: cluster.LBID}
|
||||
lb, err := c.CloudAPI().LB().Get(ctx, getLbReq)
|
||||
if err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
|
||||
getLbReq := lb.GetRequest{LBID: cluster.LBID}
|
||||
lb, err := c.CloudAPI().LB().Get(ctx, getLbReq)
|
||||
if err != nil {
|
||||
return diag.FromErr(err)
|
||||
d.Set("extnet_id", lb.ExtNetID)
|
||||
d.Set("lb_ip", lb.PrimaryNode.FrontendIP)
|
||||
}
|
||||
|
||||
d.Set("extnet_id", lb.ExtNetID)
|
||||
d.Set("lb_ip", lb.PrimaryNode.FrontendIP)
|
||||
|
||||
flattenK8sData(d, *cluster, masterComputeList, workersComputeList)
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -254,6 +254,20 @@ func flattenK8sData(d *schema.ResourceData, cluster k8s.RecordK8S, masters []com
|
||||
d.Set("tech_status", cluster.TechStatus)
|
||||
d.Set("updated_by", cluster.UpdatedBy)
|
||||
d.Set("updated_time", cluster.UpdatedTime)
|
||||
d.Set("highly_available_lb", cluster.HighlyAvailableLB)
|
||||
d.Set("address_vip", flattenAddressVIP(cluster.AddressVIP))
|
||||
d.Set("extnet_only", cluster.ExtnetOnly)
|
||||
d.Set("with_lb", cluster.WithLB)
|
||||
}
|
||||
|
||||
func flattenAddressVIP(addressVIP k8s.K8SAddressVIP) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, 0)
|
||||
temp := map[string]interface{}{
|
||||
"backend_ip": addressVIP.BackendIP,
|
||||
"frontend_ip": addressVIP.FrontendIP,
|
||||
}
|
||||
res = append(res, temp)
|
||||
return res
|
||||
}
|
||||
|
||||
func flattenServiceAccount(serviceAccount k8s.RecordServiceAccount) []map[string]interface{} {
|
||||
|
||||
@@ -153,6 +153,11 @@ func workersSchemaMake() map[string]*schema.Schema {
|
||||
Schema: detailedInfoSchemaMake(),
|
||||
},
|
||||
},
|
||||
"chipset": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Type of the emulated system.",
|
||||
},
|
||||
"guid": {
|
||||
Type: schema.TypeString,
|
||||
Computed: true,
|
||||
|
||||
@@ -202,8 +202,13 @@ func resourceK8sCreate(ctx context.Context, d *schema.ResourceData, m interface{
|
||||
if oidcCertificate, ok := d.GetOk("oidc_cert"); ok {
|
||||
createReq.OidcCertificate = oidcCertificate.(string)
|
||||
}
|
||||
|
||||
///
|
||||
|
||||
if chipset, ok := d.GetOk("chipset"); ok {
|
||||
createReq.Chipset = chipset.(string)
|
||||
}
|
||||
|
||||
createReq.ExtNetOnly = d.Get("extnet_only").(bool)
|
||||
|
||||
if extNet, ok := d.GetOk("extnet_id"); ok {
|
||||
@@ -745,6 +750,12 @@ func resourceK8sSchemaMake() map[string]*schema.Schema {
|
||||
Description: "insert ssl certificate in x509 pem format",
|
||||
},
|
||||
|
||||
"chipset": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Type of the emulated system.",
|
||||
},
|
||||
|
||||
"desc": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
|
||||
@@ -124,6 +124,10 @@ func resourceK8sCPCreate(ctx context.Context, d *schema.ResourceData, m interfac
|
||||
createReq.MasterSEPID = uint64(sepId.(int))
|
||||
}
|
||||
|
||||
if chipset, ok := d.GetOk("chipset"); ok {
|
||||
createReq.Chipset = chipset.(string)
|
||||
}
|
||||
|
||||
if sepPool, ok := d.GetOk("sep_pool"); ok {
|
||||
createReq.MasterSEPPool = sepPool.(string)
|
||||
}
|
||||
@@ -532,10 +536,10 @@ func resourceK8sCPUpdate(ctx context.Context, d *schema.ResourceData, m interfac
|
||||
oldVal, newVal := d.GetChange("num")
|
||||
|
||||
if oldVal.(int) > newVal.(int) {
|
||||
ids := make([]string, 0)
|
||||
ids := make([]uint64, 0)
|
||||
for i := oldVal.(int) - 1; i >= newVal.(int); i-- {
|
||||
id := cluster.K8SGroups.Masters.DetailedInfo[i].ID
|
||||
ids = append(ids, strconv.FormatUint(id, 10))
|
||||
ids = append(ids, id)
|
||||
}
|
||||
|
||||
req := k8s.DeleteMasterFromGroupRequest{
|
||||
@@ -656,6 +660,11 @@ func resourceK8sCPSchemaMake() map[string]*schema.Schema {
|
||||
),
|
||||
Description: "Node RAM in MB.",
|
||||
},
|
||||
"chipset": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Type of the emulated system.",
|
||||
},
|
||||
"disk": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
|
||||
@@ -70,6 +70,7 @@ func resourceK8sWgCreate(ctx context.Context, d *schema.ResourceData, m interfac
|
||||
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),
|
||||
}
|
||||
|
||||
labels, _ := d.Get("labels").([]interface{})
|
||||
@@ -168,6 +169,7 @@ func resourceK8sWgUpdate(ctx context.Context, d *schema.ResourceData, m interfac
|
||||
K8SID: uint64(d.Get("k8s_id").(int)),
|
||||
WorkersGroupID: wg.ID,
|
||||
Num: uint64(newNum) - wg.Num,
|
||||
Chipset: d.Get("chipset").(string),
|
||||
}
|
||||
|
||||
_, err := c.CloudAPI().K8S().WorkerAdd(ctx, req)
|
||||
@@ -253,6 +255,12 @@ func resourceK8sWgSchemaMake() map[string]*schema.Schema {
|
||||
Description: "Number of worker nodes to create.",
|
||||
},
|
||||
|
||||
"chipset": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Type of the emulated system.",
|
||||
},
|
||||
|
||||
"cpu": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
|
||||
@@ -84,6 +84,7 @@ func updateNum(ctx context.Context, c *controller.ControllerCfg, cluster *k8s.Re
|
||||
K8SID: cluster.ID,
|
||||
WorkersGroupID: uint64(wgNew["id"].(int)),
|
||||
Num: uint64(newNum - oldNum),
|
||||
Chipset: wgNew["chipset"].(string),
|
||||
}
|
||||
|
||||
_, err := c.CloudAPI().K8S().WorkerAdd(ctx, req)
|
||||
@@ -145,6 +146,7 @@ func addWGs(ctx context.Context, c *controller.ControllerCfg, cluster *k8s.Recor
|
||||
WorkerCPU: uint64(found_wg["cpu"].(int)),
|
||||
WorkerRAM: uint64(found_wg["ram"].(int)),
|
||||
WorkerDisk: uint64(found_wg["disk"].(int)),
|
||||
Chipset: found_wg["chipset"].(string),
|
||||
}
|
||||
|
||||
labels, _ := found_wg["labels"].([]interface{})
|
||||
|
||||
Reference in New Issue
Block a user