4.7.0
This commit is contained in:
@@ -111,14 +111,16 @@ func dataSourceK8sRead(ctx context.Context, d *schema.ResourceData, m interface{
|
||||
|
||||
d.Set("kubeconfig", kubeconfig)
|
||||
|
||||
getLbReq := lb.GetRequest{LBID: cluster.LBID}
|
||||
lb, err := c.CloudBroker().LB().Get(ctx, getLbReq)
|
||||
if err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
if cluster.LBID != 0 {
|
||||
getLbReq := lb.GetRequest{LBID: cluster.LBID}
|
||||
lb, err := c.CloudBroker().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
|
||||
|
||||
@@ -64,6 +64,9 @@ func flattenResourceK8sCP(d *schema.ResourceData, k8s k8s.RecordK8S, masters []c
|
||||
d.Set("updated_by", k8s.UpdatedBy)
|
||||
d.Set("updated_time", k8s.UpdatedTime)
|
||||
d.Set("network_plugin", k8s.NetworkPlugin)
|
||||
d.Set("highly_available_lb", k8s.HighlyAvailableLB)
|
||||
d.Set("address_vip", flattenAddressVIP(k8s.AddressVIP))
|
||||
d.Set("extnet_only", k8s.ExtnetOnly)
|
||||
|
||||
flattenCPParams(d, k8s.K8SGroups.Masters, masters)
|
||||
}
|
||||
@@ -100,6 +103,20 @@ func flattenK8sData(d *schema.ResourceData, cluster *k8s.RecordK8S, masters []co
|
||||
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 flattenAcl(acl k8s.RecordACLGroup) []map[string]interface{} {
|
||||
|
||||
@@ -158,6 +158,10 @@ func resourceK8sCPCreate(ctx context.Context, d *schema.ResourceData, m interfac
|
||||
createReq.OidcCertificate = oidcCertificate.(string)
|
||||
}
|
||||
|
||||
if chipset, ok := d.GetOk("chipset"); ok {
|
||||
createReq.Chipset = chipset.(string)
|
||||
}
|
||||
|
||||
if extNetOnly, ok := d.GetOk("extnet_only"); ok {
|
||||
createReq.ExtNetOnly = extNetOnly.(bool)
|
||||
}
|
||||
@@ -475,10 +479,10 @@ func handleUpdateNum(ctx context.Context, d *schema.ResourceData, c *controller.
|
||||
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 := k8sData.K8SGroups.Masters.DetailedInfo[i].ID
|
||||
ids = append(ids, strconv.FormatUint(id, 10))
|
||||
ids = append(ids, id)
|
||||
}
|
||||
|
||||
req := k8s.DeleteMasterFromGroupRequest{
|
||||
|
||||
@@ -65,6 +65,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),
|
||||
}
|
||||
|
||||
if d.Get("disk") == nil {
|
||||
@@ -187,6 +188,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.CloudBroker().K8S().WorkerAdd(ctx, req)
|
||||
|
||||
@@ -1439,6 +1439,11 @@ func resourceK8sCPSchemaMake() map[string]*schema.Schema {
|
||||
Optional: true,
|
||||
Description: "insert ssl certificate in x509 pem format",
|
||||
},
|
||||
"chipset": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Type of the emulated system.",
|
||||
},
|
||||
"lb_sysctl_params": {
|
||||
Type: schema.TypeList,
|
||||
Optional: true,
|
||||
@@ -1771,6 +1776,11 @@ func resourceK8sWgSchemaMake() 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,
|
||||
|
||||
Reference in New Issue
Block a user