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

rewrite LB for full implementation #37

Closed
likexian opened this issue May 21, 2019 · 18 comments
Closed

rewrite LB for full implementation #37

likexian opened this issue May 21, 2019 · 18 comments

Comments

@likexian
Copy link
Contributor

Currently LB is not useable.

@lubars
Copy link

lubars commented Aug 12, 2019

Trying to make use of new resources available as of provider.tencentcloud v1.15.0 and encountered some issues:

  1. Error: [TencentCloudSDKError] Code=InvalidParameterValue, Message=Scheduler should be WRR or LEAST_CONN, RequestId=26db209f-3997-47b8-8b0b-e1ea002374af

According to the documentation for tencentcloud_clb_listener, this parameter is optional and the default is 'WRR':

scheduler - (Optional) Scheduling method of the CLB listener, and available values include 'WRR', 'IP HASH' and 'LEAST_CONN'. The defaule is 'WRR'.

  1. Having difficulty coming up with a valid configuration for tencentcloud_clb_listener and tencentcloud_clb_listener rule, e.g:

Error: [TencentCloudSDKError] Code=InvalidParameterValue, Message=This interface only support HTTP/HTTPS listener., RequestId=6bd1e9a2-cb76-4817-b89d-10f689d56617
Error: health_check_http_path can only be set with protocol TCP
Error: health para can only be set with TCP/UDP listener or rule of HTTP/HTTPS listener

  1. Not clear what to provide for 'domain' and 'url' of tencentcloud_clb_listener_rule; semantics differ from those of other providers.

  2. No attributes exported from tencentcloud_clb_instance, so not possible to determine its IP address.

I suspect these are largely documentation issues.

@likexian
Copy link
Contributor Author

Hello @lubars
Sorry for the trouble.

@likexian
Copy link
Contributor Author

  1. Please don't define Scheduler in tf file, then it will use the default value WRR.

@likexian
Copy link
Contributor Author

  1. tencentcloud_clb_instance support TCP/UDP or HTTP/HTTPS mode, the arguments can not mixed, please check documents for detail.

Error: health_check_http_path can only be set with protocol TCP, means health_check_http_path only work with TCP mode. what document said:

health_check_http_path - (Optional) Path of health check. NOTES: Only supports listeners of 'HTTPS'/'HTTP' protocol.

refer: https://www.terraform.io/docs/providers/tencentcloud/r/clb_listener_rule.html#health_check_http_path

@likexian
Copy link
Contributor Author

  1. Yes, there is something different with other providers.
resource "tencentcloud_clb_listener_rule" "foo" {
  listener_id                = "lbl-hh141sn9"
  clb_id                     = "lb-k2zjp9lv"
  domain                     = "foo.net"
  url                        = "/bar"
}

be equal to AWS

resource "aws_lb_listener_rule" "static" {
  listener_arn = "${aws_lb_listener.front_end.arn}"

  condition {
    field  = "path-pattern"
    values = ["/bar*"]
  }

  condition {
    field  = "host-header"
    values = ["foo.net"]
  }
}

@likexian
Copy link
Contributor Author

  1. Sorry, we will export it next version.
    Attributes clb_vips, a list of ip string.

@likexian
Copy link
Contributor Author

@likexian
Copy link
Contributor Author

Hello @lubars
We have release v1.15.1, for 1, 2, 3 would you please upgrade and have a new try?
for 4th, please use attributes clb_vips, for example: tencentcloud_clb_instance.foo.clb_vips (there is something wrong with documents, we will fix it assp).

@lubars
Copy link

lubars commented Aug 14, 2019

Hi @likexian,

I am having success with clb_vips, thank you.

By the way, docs for tencentcloud_clb_attachment indicate that the default weight is 10:

weight - (Optional) Forwarding weight of the backend service, the range of [0, 100], defaults to 10.

However looking at the console, it appears that the default weight is '0'.

@lubars
Copy link

lubars commented Aug 14, 2019

Also, have you given any thought to making the target of tencentcloud_clb_attachment into a list of tencentcloud_instance ids, rather than a hard-coded list of targets? The most compact way I was able to add every tencentcloud_instance to the backend pool:

resource "tencentcloud_clb_attachment" "default" {
  listener_id = tencentcloud_clb_listener.default.id
  clb_id      = tencentcloud_clb_instance.default.id

  dynamic "targets" {
    for_each = [for instance in tencentcloud_instance.default: {
      id = instance.id
    }]

    content {
      instance_id = targets.value.id
      port        = var.ForwardPort
    }
  }
}

But maybe I've missed something simpler.

@likexian
Copy link
Contributor Author

Hi @likexian,

I am having success with clb_vips, thank you.

By the way, docs for tencentcloud_clb_attachment indicate that the default weight is 10:

weight - (Optional) Forwarding weight of the backend service, the range of [0, 100], defaults to 10.

However looking at the console, it appears that the default weight is '0'.

Thank you @lubars
The default weight of console is '10' too, however you can set to '0' manually.

@likexian
Copy link
Contributor Author

likexian commented Aug 15, 2019

Also, have you given any thought to making the target of tencentcloud_clb_attachment into a list of tencentcloud_instance ids, rather than a hard-coded list of targets? The most compact way I was able to add every tencentcloud_instance to the backend pool:

resource "tencentcloud_clb_attachment" "default" {
  listener_id = tencentcloud_clb_listener.default.id
  clb_id      = tencentcloud_clb_instance.default.id

  dynamic "targets" {
    for_each = [for instance in tencentcloud_instance.default: {
      id = instance.id
    }]

    content {
      instance_id = targets.value.id
      port        = var.ForwardPort
    }
  }
}

But maybe I've missed something simpler.

You are doing the right way, I don't have a simpler too.

However you can make it as follow:

resource "tencentcloud_clb_attachment" "default" {
  listener_id = "${tencentcloud_clb_listener.default.id}"
  clb_id      = "${tencentcloud_clb_instance.default.id}"

  dynamic "targets" {
    for_each = tencentcloud_instance.default

    content {
      instance_id = targets.value.id
      port        = var.ForwardPort
    }
  }
}

@lubars
Copy link

lubars commented Aug 15, 2019

The weight comes up in the console as '0' if not specified in the Terraform template, which results in no traffic being directed at that target; as soon as I set it to '10' in the template (or override it in the console), traffic starts flowing. So I think you need to look again at the Terraform default.

@likexian
Copy link
Contributor Author

Sorry @lubars
There is some misunderstanding, I got what you means now.
There is a problem with the default value, we will fixed it in next version.

@likexian
Copy link
Contributor Author

Hello @lubars
The default value is fixed now, please try.

@lubars
Copy link

lubars commented Aug 22, 2019

@likexian It looks like the behavior now matches the documentation. It would be nice if health_check_http_path could be used with a TCP listener so that compute instances could indicate they are not active, even when they are reachable (for example, during a rolling upgrade). Do you think this makes sense as a feature request, or is this a limitation of TencentCloud itself?

@likexian
Copy link
Contributor Author

Hello @lubars , thank you for your feedback, health_check_http_path now only works with HTTP, it is the limitation of TencentCloud CLB. Will it possible that you change you TCP listener to HTTP listener?

@likexian
Copy link
Contributor Author

Hello,
If there is still some problem, please feel free to open a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants