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

Add support for advanced routing rules for External HTTP(s) Load Balancers #6634

Closed
Hmerac opened this issue Jun 18, 2020 · 7 comments
Closed

Comments

@Hmerac
Copy link

Hmerac commented Jun 18, 2020

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment. If the issue is assigned to the "modular-magician" user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If the issue is assigned to a user, that user is claiming responsibility for the issue. If the issue is assigned to "hashibot", a community member has claimed the issue already.

Description

We tried to use header-based routing for one of our External HTTP(s) Load Balancers by header_matches, but received Advanced routing rules are not supported for scheme EXTERNAL, invalid error.

As Terraform documentation for compute_url_map states, advanced routing such as header-based routing is not possible for External HTTP(s) Load Balancers. Yet, on GCP documentation, it's possible with gcloud utility but not via Console. You can see it in below documentations:

New or Affected Resource(s)

  • compute_url_map
@edwardmedia
Copy link
Contributor

@Hmerac Can you see if below code works for you?

resource "google_compute_url_map" "urlmap" {
name        = "urlmap"
  description = "header-based routing example"
  default_service = google_compute_backend_service.default.id
  host_rule {
    hosts = ["*"]
    path_matcher = "allpaths"
  }
  path_matcher {
    name = "allpaths"
    default_service = google_compute_backend_service.default.id
    route_rules {
      priority = 1
      service = google_compute_backend_service.service-a.id
      match_rules {
        prefix_match = "/"
        ignore_case = true
        header_matches {
          header_name = "abtest"
          exact_match = "a"
        }
      }
    }
    route_rules {
      priority = 2
      service = google_compute_backend_service.service-b.id
      match_rules {
        ignore_case = true
        prefix_match = "/"
        header_matches {
          header_name = "abtest"
          exact_match = "b"
        }
      }
    }
  }
}

@edwardmedia
Copy link
Contributor

edwardmedia commented Jun 24, 2020

@Hmerac examples are added #6340 Please let me know if that addresses your request.

@Hmerac
Copy link
Author

Hmerac commented Jun 24, 2020

@Hmerac Can you see if below code works for you?

resource "google_compute_url_map" "urlmap" {
name        = "urlmap"
  description = "header-based routing example"
  default_service = google_compute_backend_service.default.id
  host_rule {
    hosts = ["*"]
    path_matcher = "allpaths"
  }
  path_matcher {
    name = "allpaths"
    default_service = google_compute_backend_service.default.id
    route_rules {
      priority = 1
      service = google_compute_backend_service.service-a.id
      match_rules {
        prefix_match = "/"
        ignore_case = true
        header_matches {
          header_name = "abtest"
          exact_match = "a"
        }
      }
    }
    route_rules {
      priority = 2
      service = google_compute_backend_service.service-b.id
      match_rules {
        ignore_case = true
        prefix_match = "/"
        header_matches {
          header_name = "abtest"
          exact_match = "b"
        }
      }
    }
  }
}

I actually tried to apply the same logic with GCP provider version of v3.25.0, that's how I got the error.
I should've pointed that out in the description, sorry.

Did this work for you?

@ghost ghost removed the waiting-response label Jun 24, 2020
@edwardmedia
Copy link
Contributor

edwardmedia commented Jun 25, 2020

@Hmerac what error do you receive if above code does not work for you? Can you share your debug log?

@Hmerac
Copy link
Author

Hmerac commented Jun 26, 2020

@edwardmedia I cannot reproduce the same case now because we've proceeded with Istio to do the header-based routing. But, as far as I remember the only error we received was:

Advanced routing rules are not supported for scheme EXTERNAL, invalid

Which I believe is quite understandable, looking at the terraform docs for google_compute_url_map for route_rules:
https://www.terraform.io/docs/providers/google/r/compute_url_map.html
Screenshot 2020-06-26 at 14 36 53

@ghost ghost removed the waiting-response label Jun 26, 2020
@edwardmedia
Copy link
Contributor

@Hmerac routeRules should work for External load balancers now. The doc is out of date, and we are going to update it. I am closing this issue. Please feel free to reopen it if you see the error Advanced routing rules are not supported for scheme EXTERNAL, invalid again. Thanks

@ghost
Copy link

ghost commented Jul 27, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@hashicorp hashicorp locked and limited conversation to collaborators Jul 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants