4.4.0
This commit is contained in:
@@ -80,10 +80,6 @@ func computesSchemaMake() map[string]*schema.Schema {
|
||||
}
|
||||
}
|
||||
|
||||
func workerComputesSchemaMake() map[string]*schema.Schema {
|
||||
return map[string]*schema.Schema{}
|
||||
}
|
||||
|
||||
func dataSourceK8sComputesSchemaMake() map[string]*schema.Schema {
|
||||
return map[string]*schema.Schema{
|
||||
"k8s_id": {
|
||||
|
||||
@@ -222,15 +222,15 @@ func flattenK8sGroup(k8SGroupList k8s.ListK8SGroups, workers []compute.RecordCom
|
||||
return res
|
||||
}
|
||||
|
||||
func flattenK8sGroups(k8sGroups k8s.RecordK8SGroups, masters []compute.RecordCompute, workers []compute.RecordCompute) []map[string]interface{} {
|
||||
res := make([]map[string]interface{}, 0)
|
||||
temp := map[string]interface{}{
|
||||
"masters": flattenMasterGroup(k8sGroups.Masters, masters),
|
||||
"workers": flattenK8sGroup(k8sGroups.Workers, workers),
|
||||
}
|
||||
res = append(res, temp)
|
||||
return res
|
||||
}
|
||||
// func flattenK8sGroups(k8sGroups k8s.RecordK8SGroups, masters []compute.RecordCompute, workers []compute.RecordCompute) []map[string]interface{} {
|
||||
// res := make([]map[string]interface{}, 0)
|
||||
// temp := map[string]interface{}{
|
||||
// "masters": flattenMasterGroup(k8sGroups.Masters, masters),
|
||||
// "workers": flattenK8sGroup(k8sGroups.Workers, workers),
|
||||
// }
|
||||
// res = append(res, temp)
|
||||
// return res
|
||||
// }
|
||||
|
||||
func flattenK8sData(d *schema.ResourceData, cluster k8s.RecordK8S, masters []compute.RecordCompute, workers []compute.RecordCompute) {
|
||||
d.Set("acl", flattenAcl(cluster.ACL))
|
||||
|
||||
@@ -145,6 +145,54 @@ func resourceK8sCreate(ctx context.Context, d *schema.ResourceData, m interface{
|
||||
|
||||
createReq.WithLB = d.Get("with_lb").(bool)
|
||||
|
||||
///4.4.0
|
||||
createReq.HighlyAvailable = d.Get("ha_mode").(bool)
|
||||
|
||||
if additionalSans, ok := d.GetOk("additional_sans"); ok {
|
||||
addSans := additionalSans.([]interface{})
|
||||
resSans := make([]string, 0)
|
||||
for _, san := range addSans {
|
||||
resSans = append(resSans, san.(string))
|
||||
}
|
||||
|
||||
createReq.AdditionalSANs = resSans
|
||||
}
|
||||
|
||||
if clusterConfig, ok := d.GetOk("cluster_config"); ok {
|
||||
createReq.ClusterConfiguration = clusterConfig.(string)
|
||||
}
|
||||
|
||||
if kubeletConfig, ok := d.GetOk("kubelet_config"); ok {
|
||||
createReq.KubeletConfiguration = kubeletConfig.(string)
|
||||
}
|
||||
|
||||
if kubeProxyConfig, ok := d.GetOk("kube_proxy_config"); ok {
|
||||
createReq.KubeProxyConfiguration = kubeProxyConfig.(string)
|
||||
}
|
||||
|
||||
if joinConfig, ok := d.GetOk("join_config"); ok {
|
||||
createReq.JoinConfiguration = joinConfig.(string)
|
||||
}
|
||||
|
||||
if cloudInit, ok := d.GetOk("cloud_init"); ok {
|
||||
createReq.UserData = cloudInit.(string)
|
||||
}
|
||||
|
||||
if initConfig, ok := d.GetOk("init_config"); ok {
|
||||
createReq.InitConfiguration = initConfig.(string)
|
||||
}
|
||||
|
||||
if lbSysctlParams, ok := d.GetOk("lb_sysctl_params"); ok {
|
||||
createReq.LbSysctlParams = lbSysctlParams.(string)
|
||||
}
|
||||
|
||||
if oidcCertificate, ok := d.GetOk("oidc_cert"); ok {
|
||||
createReq.OidcCertificate = oidcCertificate.(string)
|
||||
}
|
||||
///
|
||||
|
||||
createReq.ExtNetOnly = d.Get("extnet_only").(bool)
|
||||
|
||||
if extNet, ok := d.GetOk("extnet_id"); ok {
|
||||
createReq.ExtNetID = uint64(extNet.(int))
|
||||
} else {
|
||||
@@ -181,7 +229,7 @@ func resourceK8sCreate(ctx context.Context, d *schema.ResourceData, m interface{
|
||||
break
|
||||
}
|
||||
|
||||
time.Sleep(time.Second * 10)
|
||||
time.Sleep(time.Second * 20)
|
||||
}
|
||||
|
||||
return resourceK8sRead(ctx, d, m)
|
||||
@@ -563,6 +611,12 @@ func resourceK8sSchemaMake() map[string]*schema.Schema {
|
||||
Default: true,
|
||||
Description: "Create k8s with load balancer if true.",
|
||||
},
|
||||
"extnet_only": {
|
||||
Type: schema.TypeBool,
|
||||
Optional: true,
|
||||
Default: false,
|
||||
Description: "Use only selected ExtNet for infrastructure connections",
|
||||
},
|
||||
"extnet_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
@@ -570,6 +624,63 @@ func resourceK8sSchemaMake() map[string]*schema.Schema {
|
||||
ForceNew: true,
|
||||
Description: "ID of the external network to connect workers to. If omitted network will be chosen by the platfom.",
|
||||
},
|
||||
|
||||
///4.4.0
|
||||
"cloud_init": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Meta data for working group computes, format YAML 'user_data': 1111",
|
||||
},
|
||||
"join_config": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "is used to configure the behavior and settings for joining a node to a cluster. It includes parameters such as the cluster's control plane endpoint, token, and certificate key. insert a valid JSON string with all levels of nesting.",
|
||||
},
|
||||
"kube_proxy_config": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "is used to configure the behavior and settings of the Kube-proxy, which is responsible for network proxying and load balancing within the cluster. It includes parameters such as proxy mode, cluster IP ranges, and other Kube-proxy specific configurations. insert a valid JSON string with all levels of nesting.",
|
||||
},
|
||||
"kubelet_config": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "is used to configure the behavior and settings of the Kubelet, which is the primary node agent that runs on each node in the cluster. It includes parameters such as node IP address, resource allocation, pod eviction policies, and other Kubelet-specific configurations. insert a valid JSON string with all levels of nesting.",
|
||||
},
|
||||
"cluster_config": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "is used to define global settings and configurations for the entire cluster. It includes parameters such as cluster name, DNS settings, authentication methods, and other cluster-wide configurations. insert a valid JSON string with all levels of nesting.",
|
||||
},
|
||||
"init_config": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "is used to define settings and actions that should be performed before any other component in the cluster starts. It allows you to configure things like node registration, network setup, and other initialization tasks. insert a valid JSON string with all levels of nesting.",
|
||||
},
|
||||
"additional_sans": {
|
||||
Type: schema.TypeList,
|
||||
Optional: true,
|
||||
Description: "Optional extra Subject Alternative Names (SANs) to use for the API Server serving certificate. Can be both IP addresses and DNS names",
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
},
|
||||
},
|
||||
"ha_mode": {
|
||||
Type: schema.TypeBool,
|
||||
Optional: true,
|
||||
Description: "Use Highly Available schema for LB deploy",
|
||||
},
|
||||
"lb_sysctl_params": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Custom sysctl values for Load Balancer instance. Applied on boot.",
|
||||
},
|
||||
"oidc_cert": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "insert ssl certificate in x509 pem format",
|
||||
},
|
||||
////
|
||||
|
||||
"desc": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
@@ -662,6 +773,7 @@ func resourceK8sSchemaMake() map[string]*schema.Schema {
|
||||
},
|
||||
"vins_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Computed: true,
|
||||
Description: "ID of default vins for this instace.",
|
||||
},
|
||||
|
||||
@@ -129,6 +129,56 @@ func resourceK8sCPCreate(ctx context.Context, d *schema.ResourceData, m interfac
|
||||
|
||||
createReq.WithLB = d.Get("with_lb").(bool)
|
||||
|
||||
///4.4.0
|
||||
createReq.HighlyAvailable = d.Get("ha_mode").(bool)
|
||||
|
||||
if additionalSans, ok := d.GetOk("additional_sans"); ok {
|
||||
addSans := additionalSans.([]interface{})
|
||||
resSans := make([]string, 0)
|
||||
for _, san := range addSans {
|
||||
resSans = append(resSans, san.(string))
|
||||
}
|
||||
|
||||
createReq.AdditionalSANs = resSans
|
||||
}
|
||||
|
||||
if clusterConfig, ok := d.GetOk("cluster_config"); ok {
|
||||
createReq.ClusterConfiguration = clusterConfig.(string)
|
||||
}
|
||||
|
||||
if kubeletConfig, ok := d.GetOk("kubelet_config"); ok {
|
||||
createReq.KubeletConfiguration = kubeletConfig.(string)
|
||||
}
|
||||
|
||||
if kubeProxyConfig, ok := d.GetOk("kube_proxy_config"); ok {
|
||||
createReq.KubeProxyConfiguration = kubeProxyConfig.(string)
|
||||
}
|
||||
|
||||
if joinConfig, ok := d.GetOk("join_config"); ok {
|
||||
createReq.JoinConfiguration = joinConfig.(string)
|
||||
}
|
||||
|
||||
if cloudInit, ok := d.GetOk("cloud_init"); ok {
|
||||
createReq.UserData = cloudInit.(string)
|
||||
}
|
||||
|
||||
if initConfig, ok := d.GetOk("init_config"); ok {
|
||||
createReq.InitConfiguration = initConfig.(string)
|
||||
}
|
||||
|
||||
if lbSysctlParams, ok := d.GetOk("lb_sysctl_params"); ok {
|
||||
createReq.LbSysctlParams = lbSysctlParams.(string)
|
||||
}
|
||||
|
||||
if oidcCertificate, ok := d.GetOk("oidc_cert"); ok {
|
||||
createReq.OidcCertificate = oidcCertificate.(string)
|
||||
log.Debug(createReq.OidcCertificate)
|
||||
}
|
||||
|
||||
///
|
||||
|
||||
createReq.ExtNetOnly = d.Get("extnet_only").(bool)
|
||||
|
||||
if extNet, ok := d.GetOk("extnet_id"); ok {
|
||||
createReq.ExtNetID = uint64(extNet.(int))
|
||||
} else {
|
||||
@@ -165,7 +215,7 @@ func resourceK8sCPCreate(ctx context.Context, d *schema.ResourceData, m interfac
|
||||
break
|
||||
}
|
||||
|
||||
time.Sleep(time.Second * 10)
|
||||
time.Sleep(time.Second * 20)
|
||||
}
|
||||
|
||||
cluster, err := utilityK8sCheckPresence(ctx, d, m)
|
||||
@@ -229,7 +279,7 @@ func resourceK8sCPRead(ctx context.Context, d *schema.ResourceData, m interface{
|
||||
case status.Destroyed:
|
||||
d.SetId("")
|
||||
return diag.Errorf("The resource cannot be updated because it has been destroyed")
|
||||
// return resourceK8sCreate(ctx, d, m)
|
||||
// return resourceK8sCreate(ctx, d, m)
|
||||
case status.Enabling:
|
||||
case status.Enabled:
|
||||
case status.Disabling:
|
||||
@@ -292,7 +342,7 @@ func resourceK8sCPRead(ctx context.Context, d *schema.ResourceData, m interface{
|
||||
|
||||
if _, ok := d.GetOk("k8s_id"); !ok {
|
||||
for _, worker := range cluster.K8SGroups.Workers {
|
||||
err := fmt.Errorf("Found worker-group with ID %d. Make sure to import it to decort_k8s_wg resource if you wish to manage it", worker.ID)
|
||||
err := fmt.Errorf("found worker-group with ID %d. Make sure to import it to decort_k8s_wg resource if you wish to manage it", worker.ID)
|
||||
warnings.Add(err)
|
||||
}
|
||||
}
|
||||
@@ -569,6 +619,67 @@ func resourceK8sCPSchemaMake() map[string]*schema.Schema {
|
||||
Default: true,
|
||||
Description: "Create k8s with load balancer if true.",
|
||||
},
|
||||
"extnet_only": {
|
||||
Type: schema.TypeBool,
|
||||
Optional: true,
|
||||
Default: false,
|
||||
Description: "Use only selected ExtNet for infrastructure connections",
|
||||
},
|
||||
///4.4.0
|
||||
"cloud_init": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Meta data for working group computes, format YAML 'user_data': 1111",
|
||||
},
|
||||
"join_config": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "is used to configure the behavior and settings for joining a node to a cluster. It includes parameters such as the cluster's control plane endpoint, token, and certificate key. insert a valid JSON string with all levels of nesting.",
|
||||
},
|
||||
"kube_proxy_config": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "is used to configure the behavior and settings of the Kube-proxy, which is responsible for network proxying and load balancing within the cluster. It includes parameters such as proxy mode, cluster IP ranges, and other Kube-proxy specific configurations. insert a valid JSON string with all levels of nesting.",
|
||||
},
|
||||
"kubelet_config": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "is used to configure the behavior and settings of the Kubelet, which is the primary node agent that runs on each node in the cluster. It includes parameters such as node IP address, resource allocation, pod eviction policies, and other Kubelet-specific configurations. insert a valid JSON string with all levels of nesting.",
|
||||
},
|
||||
"cluster_config": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "is used to define global settings and configurations for the entire cluster. It includes parameters such as cluster name, DNS settings, authentication methods, and other cluster-wide configurations. insert a valid JSON string with all levels of nesting.",
|
||||
},
|
||||
"init_config": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "is used to define settings and actions that should be performed before any other component in the cluster starts. It allows you to configure things like node registration, network setup, and other initialization tasks. insert a valid JSON string with all levels of nesting.",
|
||||
},
|
||||
"additional_sans": {
|
||||
Type: schema.TypeList,
|
||||
Optional: true,
|
||||
Description: "Optional extra Subject Alternative Names (SANs) to use for the API Server serving certificate. Can be both IP addresses and DNS names",
|
||||
Elem: &schema.Schema{
|
||||
Type: schema.TypeString,
|
||||
},
|
||||
},
|
||||
"ha_mode": {
|
||||
Type: schema.TypeBool,
|
||||
Optional: true,
|
||||
Description: "Use Highly Available schema for LB deploy",
|
||||
},
|
||||
"lb_sysctl_params": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "Custom sysctl values for Load Balancer instance. Applied on boot.",
|
||||
},
|
||||
"oidc_cert": {
|
||||
Type: schema.TypeString,
|
||||
Optional: true,
|
||||
Description: "insert ssl certificate in x509 pem format",
|
||||
},
|
||||
////
|
||||
"extnet_id": {
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
|
||||
@@ -110,7 +110,7 @@ func resourceK8sWgRead(ctx context.Context, d *schema.ResourceData, m interface{
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
|
||||
workersComputeList := make([]compute.RecordCompute, 0, 0)
|
||||
workersComputeList := make([]compute.RecordCompute, 0)
|
||||
for _, info := range wg.DetailedInfo {
|
||||
compute, err := utilityComputeCheckPresence(ctx, d, m, info.ID)
|
||||
if err != nil {
|
||||
|
||||
@@ -70,7 +70,7 @@ func utilityDataK8sWgCheckPresence(ctx context.Context, d *schema.ResourceData,
|
||||
return nil, nil, fmt.Errorf("WG with id %v in k8s cluster %v not found", wgId, k8sId)
|
||||
}
|
||||
|
||||
workersComputeList := make([]compute.RecordCompute, 0, 0)
|
||||
workersComputeList := make([]compute.RecordCompute, 0)
|
||||
for _, info := range curWg.DetailedInfo {
|
||||
compute, err := utilityComputeCheckPresence(ctx, d, m, info.ID)
|
||||
if err != nil {
|
||||
@@ -121,7 +121,7 @@ func utilityK8sWgCheckPresence(ctx context.Context, d *schema.ResourceData, m in
|
||||
}
|
||||
}
|
||||
|
||||
return nil, fmt.Errorf("Not found wg with id: %v in k8s cluster: %v", wgId, cluster.ID)
|
||||
return nil, fmt.Errorf("not found wg with id: %v in k8s cluster: %v", wgId, cluster.ID)
|
||||
}
|
||||
|
||||
func utilityK8sWgListCheckPresence(ctx context.Context, d *schema.ResourceData, m interface{}) (k8s.ListK8SGroups, error) {
|
||||
|
||||
Reference in New Issue
Block a user