Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

http-route does not support Consul cluster peering #593

Open
vvarga007 opened this issue Aug 3, 2023 · 7 comments
Open

http-route does not support Consul cluster peering #593

vvarga007 opened this issue Aug 3, 2023 · 7 comments
Labels
runtime/nomad Deployed in Nomad environment type/enhancement New feature or request

Comments

@vvarga007
Copy link

http-route configuration entry does not support Consul cluster peering.

Feature Description

I would like to use the API gateway for imported services. Imported services via cluster peering.
The documentation
does not say anything about cluster peering.

Adding "Peer" directive would be nice, something like this:

Rules = [
      {
        Matches = [
          {
            Path = {
              Match = "prefix"
              Value = "/"
            }
          }
        ]
        Services = [
          {
            Name = "hashicups-frontend"
            Peer = "cluster-02"
          },
        ]
      },
]
@nathancoleman
Copy link
Member

Hi @vvarga007 👋

There are Kubernetes-specific instructions here for routing to a service in a peer. It requires the use of the MeshService CRD which allows you to specify which peer the service is imported from. Let me know if this gets you up and running 🎉

@vvarga007
Copy link
Author

@nathancoleman I don't use Kubernetes. I use Nomad.

@nathancoleman
Copy link
Member

nathancoleman commented Aug 9, 2023

I believe you can accomplish this in Consul today using a Service Resolver configuration entry and, more specifically, its ability to redirect to a peer. If hashicups-frontend is a service located in a peered cluster named my-peer, you would need the additional configuration that would look something like this:

Kind = "service-resolver"
Name = "hashicups-frontend"
Redirect {
  Service = "hashicups-frontend"
  Peer = "my-peer"
}

and then your http-route would remain

Rules = [
      {
        Matches = [
          {
            Path = {
              Match = "prefix"
              Value = "/"
            }
          }
        ]
        Services = [
          {
            Name = "hashicups-frontend"
          },
        ]
      },
]

Noting that you'll need intentions in place to allow this, as mentioned in the docs linked above.

Let me know if this is helpful for you or not. If you like, I can put together a config bundle of what I'm describing -- just let me know 😃

@vvarga007
Copy link
Author

Yes, it is possible with the service resolver, but I have to create a fake/virtual service.
So let's say hashicups is running in DC1, and I want to spin up an ingress gw/api gw in DC2. The hashicups service is exported in DC1 and imported in DC2. To be able to set up a service resolver in DC2, I have to create a fake/virtual service. It would be great to do this without a virtual service and target a service through a peering connection.

@nathancoleman
Copy link
Member

Ah, I see your point. So this issue isn't so much that you can't accomplish the thing but more that it could be easier with some UX tweaks, right?

@nathancoleman nathancoleman added the runtime/nomad Deployed in Nomad environment label Aug 9, 2023
@vvarga007
Copy link
Author

Yes, it is more like a feature request.

@nathancoleman
Copy link
Member

@vvarga007 excellent! This repo will soon be marked deprecated as the api-gateway functionality has been integrated into hashicorp/consul and hashicorp/consul-k8s. Nothing required on your end, but a heads up that I expect this feature request to be migrated to the consul repo in the near-ish future.

@nathancoleman nathancoleman added the type/enhancement New feature or request label Aug 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
runtime/nomad Deployed in Nomad environment type/enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants