# Selected external session: consumer -> L4 passthrough LB -> Istio gateway.
# Example values only; provision credentials through the approved PKI mechanism.
apiVersion: v1
kind: Secret
metadata:
  name: obrh-consumer-ingress
  namespace: istio-iut
type: Opaque
stringData:
  tls.crt: |
    <INGRESS_SERVER_CERTIFICATE_AND_CHAIN_PEM>
  tls.key: |
    <INGRESS_SERVER_PRIVATE_KEY_PEM>
  ca.crt: |
    <APPROVED_CONSUMER_CA_BUNDLE_PEM>
---
apiVersion: networking.istio.io/v1beta1
kind: Gateway
metadata:
  name: obrh-consumer-mtls
  namespace: istio-iut
spec:
  selector:
    istio: istio-ingressgateway
  servers:
  - port:
      number: 443
      name: https-consumer
      protocol: HTTPS
    hosts: [api.bank.example]
    tls:
      mode: MUTUAL # Gateway verifies the consumer, not an LB certificate.
      credentialName: obrh-consumer-ingress
      subjectAltNames: [consumer.bank.example] # Replace with approved consumer identities.
---
apiVersion: networking.istio.io/v1beta1
kind: VirtualService
metadata:
  name: obrh-consumer-entry
  namespace: obrh-example
spec:
  hosts: [api.bank.example]
  gateways: [istio-iut/obrh-consumer-mtls]
  http:
  - name: direct-example
    match:
    - uri:
        prefix: /direct/
    route:
    - destination:
        host: obrh-direct.obrh-example.svc.cluster.local
        port:
          number: 8080
    retries:
      attempts: 0 # Business retry safety is not implied by mTLS.
  - name: il-example
    match:
    - uri:
        prefix: /il/
    route:
    - destination:
        host: obrh-il.obrh-example.svc.cluster.local
        port:
          number: 8080
    retries:
      attempts: 0
# Prefixes/services illustrate separate flavours; preserve real route rewrites.
# TLS server certificate must contain the ingress hostname's SAN.
# Internal mesh mTLS, when selected, is a separate workload-identity contract.
