Skip to content

Commit 6e6d0de

Browse files
author
mathieu prigent
committed
at nodepool creation time wait for READY or ERROR
1 parent 0c769e2 commit 6e6d0de

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

ovh/resource_cloud_project_kube_nodepool.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,8 @@ func resourceCloudProjectKubeNodePoolCreate(d *schema.ResourceData, meta interfa
259259
return err
260260
}
261261

262-
log.Printf("[DEBUG] Waiting for nodepool %s to be READY", res.Id)
263-
err = waitForCloudProjectKubeNodePoolReady(config.OVHClient, serviceName, kubeId, res.Id, d.Timeout(schema.TimeoutCreate))
262+
log.Printf("[DEBUG] Waiting for nodepool %s to be READY or ERROR", res.Id)
263+
err = waitForCloudProjectKubeNodePoolWithStateTarget(config.OVHClient, serviceName, kubeId, res.Id, d.Timeout(schema.TimeoutCreate), []string{"READY", "ERROR"})
264264
if err != nil {
265265
return fmt.Errorf("timeout while waiting nodepool %s to be READY: %w", res.Id, err)
266266
}
@@ -314,7 +314,7 @@ func resourceCloudProjectKubeNodePoolUpdate(d *schema.ResourceData, meta interfa
314314
}
315315

316316
log.Printf("[DEBUG] Waiting for nodepool %s to be READY", d.Id())
317-
err = waitForCloudProjectKubeNodePoolReady(config.OVHClient, serviceName, kubeId, d.Id(), d.Timeout(schema.TimeoutUpdate))
317+
err = waitForCloudProjectKubeNodePoolWithStateTarget(config.OVHClient, serviceName, kubeId, d.Id(), d.Timeout(schema.TimeoutUpdate), []string{"READY"})
318318
if err != nil {
319319
return fmt.Errorf("timeout while waiting nodepool %s to be READY: %w", d.Id(), err)
320320
}
@@ -355,10 +355,10 @@ func cloudProjectKubeNodePoolExists(serviceName, kubeId, id string, client *ovh.
355355
return client.Get(endpoint, res)
356356
}
357357

358-
func waitForCloudProjectKubeNodePoolReady(client *ovh.Client, serviceName, kubeId, id string, timeout time.Duration) error {
358+
func waitForCloudProjectKubeNodePoolWithStateTarget(client *ovh.Client, serviceName, kubeId, id string, timeout time.Duration, stateTargets []string) error {
359359
stateConf := &resource.StateChangeConf{
360360
Pending: []string{"INSTALLING", "UPDATING", "REDEPLOYING", "RESIZING", "DOWNSCALING", "UPSCALING"},
361-
Target: []string{"READY"},
361+
Target: stateTargets,
362362
Refresh: func() (interface{}, string, error) {
363363
res := &CloudProjectKubeNodePoolResponse{}
364364
endpoint := fmt.Sprintf("/cloud/project/%s/kube/%s/nodepool/%s", serviceName, kubeId, id)

website/docs/r/cloud_project_kube_nodepool.html.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ resource "ovh_cloud_project_kube_nodepool" "pool" {
3939
k1 = "v1"
4040
k2 = "v2"
4141
}
42-
finalizers = ["F1", "F2"]
42+
finalizers = ["ovhcloud.com/v1beta1", "ovhcloud.com/v1"]
4343
labels = {
4444
k3 = "v3"
4545
k4 = "v4"
@@ -77,7 +77,7 @@ The following arguments are supported:
7777
* `template ` - (Optional) Managed Kubernetes nodepool template, which is a complex object constituted by two main nested objects:
7878
* `metadata` - Metadata of each node in the pool
7979
* `annotations` - Annotations to apply to each node
80-
* `finalizers` - Finalizers to apply to each node
80+
* `finalizers` - Finalizers to apply to each node, kubernetes finalizer format is a FQDN (full qualified domain name) like an api group, the rune '/' and then a version. For example: ovhcloud.com/v1
8181
* `labels` - Labels to apply to each node
8282
* `spec` - Spec of each node in the pool
8383
* `taints` - Taints to apply to each node

0 commit comments

Comments
 (0)