apiVersion: consul.hashicorp.com/v1alpha1
kind: ServiceDefaults
metadata:
  name: controller
  namespace: consul
spec:
  protocol: http             # Keep as http for API Gateway routing
  meshGateway:
    mode: local
---
apiVersion: consul.hashicorp.com/v1alpha1
kind: MeshService
metadata:
  name: controller
  namespace: consul
spec:
  name: controller              # This should match the ServiceDefaults name
---
apiVersion: consul.hashicorp.com/v1alpha1
kind: ServiceIntentions
metadata:
  name: controller
  namespace: consul
spec:
  destination:
    name: controller
  sources:
    - name: api-gateway
      action: allow
---
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
  name: controller-api
  namespace: consul
spec:
  parentRefs:
  - name: api-gateway
    namespace: consul
  rules:
  - matches:
    - path:
        type: Exact
        value: /mergedlog
    backendRefs:
    - group: consul.hashicorp.com
      kind: MeshService
      name: controller
      namespace: consul
