This commit is contained in:
2024-08-26 18:22:06 +03:00
parent 6876b25f0e
commit 8ad6811e88
597 changed files with 52808 additions and 2129 deletions

View File

@@ -167,16 +167,16 @@ func resourceK8sCPCreate(ctx context.Context, d *schema.ResourceData, m interfac
}
if lbSysctlParams, ok := d.GetOk("lb_sysctl_params"); ok {
syscrlSliceMaps := lbSysctlParams.([]map[string]string)
syscrlSliceMaps := lbSysctlParams.([]interface{})
res := make([]map[string]interface{}, 0, len(syscrlSliceMaps))
for _, syscrlMap := range syscrlSliceMaps {
tempMap := make(map[string]interface{})
for k, v := range syscrlMap {
if intVal, err := strconv.Atoi(v); err == nil {
for k, v := range syscrlMap.(map[string]interface{}) {
if intVal, err := strconv.Atoi(v.(string)); err == nil {
tempMap[k] = intVal
continue
}
tempMap[k] = v
tempMap[k] = v.(string)
}
res = append(res, tempMap)
}
@@ -428,7 +428,7 @@ func resourceK8sCPDelete(ctx context.Context, d *schema.ResourceData, m interfac
c := m.(*controller.ControllerCfg)
req := k8s.DeleteRequest{
K8SID: k8sData.ID,
K8SID: k8sData.ID,
}
if val, ok := d.GetOk("permanently"); ok {
@@ -586,25 +586,28 @@ func handleStart(ctx context.Context, c *controller.ControllerCfg, start bool, k
func handleUpdateLbSysctlParams(ctx context.Context, d *schema.ResourceData, c *controller.ControllerCfg, k8sData *k8s.RecordK8S) error {
lbSysctlParams := d.Get("lb_sysctl_params").([]map[string]string)
lbSysctlParams := d.Get("lb_sysctl_params").([]interface{})
res := make([]map[string]interface{}, 0, len(lbSysctlParams))
for _, syscrlMap := range lbSysctlParams {
tempMap := make(map[string]interface{})
for k, v := range syscrlMap {
if intVal, err := strconv.Atoi(v); err == nil {
for k, v := range syscrlMap.(map[string]interface{}) {
if intVal, err := strconv.Atoi(v.(string)); err == nil {
tempMap[k] = intVal
continue
}
tempMap[k] = v
tempMap[k] = v.(string)
}
res = append(res, tempMap)
}
req := lb.UpdateSysctParamsRequest{
LBID: k8sData.LBID,
SysctlParams: res,
}
if len(res) > 0 {
req := lb.UpdateSysctParamsRequest{
LBID: k8sData.LBID,
SysctlParams: res,
}
_, err := c.CloudBroker().LB().UpdateSysctlParams(ctx, req)
return err
_, err := c.CloudBroker().LB().UpdateSysctlParams(ctx, req)
return err
}
return nil
}