Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/427 #433

Merged
merged 6 commits into from
Aug 22, 2023
Merged

Fix/427 #433

merged 6 commits into from
Aug 22, 2023

Conversation

matprig
Copy link
Contributor

@matprig matprig commented Jun 26, 2023

Description

  • Fix terraform schema where nodepool template is optional but all its attributes are required, this in order to be conform with the OVH APIs
  • Fix serialization/deserialization of the terraform data to let terraform compute correctly the diff
  • Fix serialization/deserialization of OVH APIs data to let terraform compute correctly the diff
  • workaround of terraform bug Fix for TypeSet applying with unexpected empty element hashicorp/terraform-plugin-sdk#1042

Fixes #427 (issue)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • Improvement (improve existing resource(s) or datasource(s))
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Test A: TF_ACC=1 go test -timeout 60m -v github.com/ovh/terraform-provider-ovh/ovh -run TestAccCloudProjectKubeNodePool

Test Configuration:

  • Terraform version: terraform version: Terraform v1.3.1
  • Existing HCL configuration you used:
resource "" "" {
 xx = "yy"
 zz = "aa"
}

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings or issues
  • I have added acceptance tests that prove my fix is effective or that my feature works
  • New and existing acceptance tests pass locally with my changes
  • I ran succesfully go mod vendor if I added or modify go.mod file

@scraly
Copy link
Collaborator

scraly commented Jul 6, 2023

I've tested 3 times to create a node pool with taint and I've got an issue every time (even if I change the timeout)

node pool:

resource "ovh_cloud_project_kube_nodepool" "my_pool" {
  service_name  = var.service_name
  kube_id       = ovh_cloud_project_kube.my_kube_cluster.id
  name          = "my-pool" //Warning: "_" char is not allowed!
  flavor_name   = "b2-7"
  desired_nodes = 1
  max_nodes     = 1
  min_nodes     = 1
}


resource "ovh_cloud_project_kube_nodepool" "pool2" {
  service_name  = var.service_name
  kube_id       = ovh_cloud_project_kube.my_kube_cluster.id
  name          = "my-pool4"
  flavor_name   = "b2-7"
  desired_nodes = 3
  max_nodes     = 3
  min_nodes     = 3
  template {
    metadata {
      annotations = {
        k1 = "v1"
        k2 = "v2"
      }
      finalizers = ["F1", "F2"]
      labels = {
        k3 = "v3"
        k4 = "v4"
      }
    }
    spec {
      unschedulable = false
      taints = [
        {
          effect = "PreferNoSchedule"
          key    = "k"
          value  = "v"
        }
      ]
    }
  }

   timeouts {
    create = "1h"
    update = "45m"
    delete = "50s"
  }
}

(with or without timeout I have troubles)

Error:

ovh_cloud_project_kube_nodepool.pool2: Still creating... [1m40s elapsed]
ovh_cloud_project_kube_nodepool.pool2: Still creating... [1m50s elapsed]
ovh_cloud_project_kube_nodepool.pool2: Still creating... [2m0s elapsed]
ovh_cloud_project_kube_nodepool.pool2: Still creating... [2m10s elapsed]
ovh_cloud_project_kube_nodepool.pool2: Still creating... [2m20s elapsed]
╷
│ Error: timeout while waiting nodepool xxxxxxxx-xxxx-xxxx-xxxx-fxxxxxxxcxxxx to be READY: unexpected state 'ERROR', wanted target 'READY'. last error: %!s(<nil>)
│
│   with ovh_cloud_project_kube_nodepool.pool2,
│   on pr433.tf line 25, in resource "ovh_cloud_project_kube_nodepool" "pool2":
│   25: resource "ovh_cloud_project_kube_nodepool" "pool2" {

@scraly
Copy link
Collaborator

scraly commented Jul 6, 2023

And when I execute "terraform apply" after having the error message, Terraform want to apply again the ne node pool and then it displays an error message because in the API the node pool already exists (with troubles but exists):

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

ovh_cloud_project_kube_nodepool.pool2: Creating...
╷
│ Error: calling Post /cloud/project/axxxxxxxxxxxxxxx/kube/xxxx-xxxx-xxxx-xxxxxxxxx/nodepool with params my-pool3(b2-7): 3/3/3:
│ 	 OVHcloud API error (status code 400): Client::BadRequest: "[InvalidDataError] 400: Node pool name my-pool3 already exists in the service xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx (request ID: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxx)" (X-OVH-Query-Id: EU.ext-1.xxxxxxx.xxxxxxxxxxxxx)
│
│   with ovh_cloud_project_kube_nodepool.pool2,
│   on pr433.tf line 25, in resource "ovh_cloud_project_kube_nodepool" "pool2":
│   25: resource "ovh_cloud_project_kube_nodepool" "pool2" {

Copy link
Collaborator

@scraly scraly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't create a node pool with annotations, finalizers and taints

@scraly scraly added the 0.33.0 label Aug 22, 2023
@scraly scraly merged commit cc14f05 into ovh:master Aug 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] runtime error: index out of range [0] with length 0
3 participants