ovh/go-ovh

"accept-encoding: gzip" not accepted ?

rienafairefr opened this issue · 6 comments

I tried the new ovh_cloud_project_kube_nodepool terraform thing, but it didn't work, and looking at the trace logs, the problem seems that go-ovh (or a library it uses) adds a Accept-Encoding: gzip header to the request:

POST /1.0/cloud/project/***/kube/***/nodepool HTTP/1.1
Host: eu.api.ovh.com
User-Agent: Go-http-client/1.1
Content-Length: 125
Accept: application/json
Content-Type: application/json;charset=utf-8
X-Ovh-Application: ***
X-Ovh-Consumer: ***
X-Ovh-Signature: $1$28***
X-Ovh-Timestamp: 1614860696
Accept-Encoding: gzip

{
 "desiredNodes": 2,
 "maxNodes": 0,
 "minNodes": 0,
 "flavorName": "R2-15",
 "name": "my_pool",
 "monthlyBilled": false,
 "antiAffinity": false
}
-----------------------------------------------------

2021/03/04 13:24:57 [TRACE] dag/walk: vertex "provider[\"registry.terraform.io/ovh/ovh\"] (close)" is waiting for "ovh_cloud_project_kube_nodepool.pool-dev"
2021-03-04T13:24:59.479+0100 [DEBUG] plugin.terraform-provider-ovh_v0.11.0: 2021/03/04 13:24:59 [ERROR] OVH API Response error: &errors.errorString{s:"gzip: invalid header"}

I'm not sure I pinpointed the right culprit, though.

PS: The request to create the nodepool in the web UI does not have any "accept-encoding" header

Hi,

thanks of all, we're happy that you use our Terraform provider.

We created a tutorial about Kubernetes cluster and node pool creation through Terraform:
https://docs.ovh.com/gb/en/kubernetes/creating-a-cluster-through-terraform/

you can take a look about it, it can help you.

One of the root cause of the issue I see is that you name the node pool "my_pool".
One thing to know is in our API you can's use a "_" (underscore) character in a name,
so try to change the name to "my-pool" like this example:

resource "ovh_cloud_project_kube_nodepool" "node_pool" {
  count = var.nb_cluster
  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 = 3
  max_nodes     = 3
  min_nodes     = 3
}

Thanks :)

And, generally, if you have this kind of error message:

ovh_cloud_project_kube_nodepool.node_pool[0]: Creating...
local_file.kubeconfig[0]: Creating...
local_file.kubeconfig[0]: Creation complete after 0s [id=c5d11f6df9df77a0b57b6c14c3be4fb48178f6ac]

Error: calling Post /cloud/project/a212a1e43b614c4ba27a247b890fcf59/kube/90cb98f1-ad48-4f98-95c8-07188ea765cf/nodepool with params my-pool-0(d2.8): 3/3/3:
	 "gzip: invalid header"

  on ovh_kube_cluster.tf line 10, in resource "ovh_cloud_project_kube_nodepool" "node_pool":
  10: resource "ovh_cloud_project_kube_nodepool" "node_pool" {

The issue is that some input are not correctly formatted for OVHcloud API.

For example, flavor's name should not contains "" or "." as separator, for example: "d2-8", "b2-7" are good flavors.
Another example is the pool name, should not contains "
", but, for example: "my-pool" is an allowed name.

Hello @rienafairefr ,
Sorry for the late answer.

I checked your error message:

2021-03-04T13:24:59.479+0100 [DEBUG] plugin.terraform-provider-ovh_v0.11.0: 2021/03/04 13:24:59 [ERROR] OVH API Response error: &errors.errorString{s:"gzip: invalid header"}

Doesn't seems to come from a bad pool name, but an error from our side.
Do you still reproduce this issue ?
If yes, can you communicate me the X-OVH-QUERYID in the response header, I will forward it to the right team for a fix.

Thanks for raising the issue.
Romain

Nope, I have no traces from that request. Not working anymore where I need that provider either sorry about that can't help you!

Hello,
Thanks for your reply.
I will close this, if someone else have the same issue, feel free to reply