With the (future) release of Consul API Gateway v0.2.0, there must be a ReferencePolicy in place to allow a route in one namespace to use a backend/service in a different namespace.
Since the stack defined here does exactly that - HTTPRoute in the consul namespace and Service in the default namespace - we need to add a ReferencePolicy that allows it; otherwise, the example here will be broken in the future.
I chose to include the ReferencePolicy in the two-services/ directory since it needs to live alongside the services that will be routed to, within the same namespace. Alternatively, we could update the Learn guide to draw the practitioner's attention to the policy and install it separately; however, that's a much bigger cross-repo change. If you feel strongly that we should go that route instead, please speak to that by leaving a comment below.
Testing
I followed the Learn guide here but used a build from the main branch of hashicorp/consul-api-gateway to ensure that the ReferencePolicy meets the new requirements and that this stack will continue to work after release.
With the (future) release of Consul API Gateway v0.2.0, there must be a
ReferencePolicy
in place to allow a route in one namespace to use a backend/service in a different namespace.Since the stack defined here does exactly that -
HTTPRoute
in the consul namespace andService
in the default namespace - we need to add aReferencePolicy
that allows it; otherwise, the example here will be broken in the future.I chose to include the
ReferencePolicy
in thetwo-services/
directory since it needs to live alongside the services that will be routed to, within the same namespace. Alternatively, we could update the Learn guide to draw the practitioner's attention to the policy and install it separately; however, that's a much bigger cross-repo change. If you feel strongly that we should go that route instead, please speak to that by leaving a comment below.Testing
I followed the Learn guide here but used a build from the
main
branch of hashicorp/consul-api-gateway to ensure that theReferencePolicy
meets the new requirements and that this stack will continue to work after release.