apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
  name: cp9-o11y-dedicated-route
  namespace: observability
  annotations:
    kubernetes.io/ingress.class: kong
plugin: o11y-dedicated-route
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: gcp-o11y-public-read
  namespace: observability
  annotations:
    konghq.com/plugins: cp9-o11y-dedicated-route
    konghq.com/regex-priority: "400"
spec:
  ingressClassName: kong
  rules:
    - host: __CP9_GCP_REGIONAL_ENDPOINT_HOST__
      http:
        paths:
          - path: /~/[0-9a-fA-F-]{36}/metrics/api/v1/
            pathType: ImplementationSpecific
            backend:
              service:
                name: vmselect-cp9-metrics
                port:
                  number: 8481
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: gcp-o11y-regional
  namespace: observability
  annotations:
    konghq.com/strip-path: "true"
spec:
  parentRefs:
    - name: gcp-regional
      namespace: kong-system
      sectionName: https
  hostnames:
    - __CP9_GCP_REGIONAL_ENDPOINT_HOST__
  rules:
    - matches:
        - path:
            type: PathPrefix
            value: /o11y/regional
      backendRefs:
        - name: regionalservice
          port: 8081
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: gcp-o11y-data
  namespace: observability
  annotations:
    konghq.com/strip-path: "true"
spec:
  parentRefs:
    - name: gcp-regional
      namespace: kong-system
      sectionName: https
  hostnames:
    - __CP9_GCP_REGIONAL_ENDPOINT_HOST__
  rules:
    - matches:
        - path:
            type: PathPrefix
            value: /o11y/data
      backendRefs:
        - name: regional-data-service
          port: 8081
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
  name: gcp-o11y-private-write
  namespace: observability
  annotations:
    konghq.com/plugins: cp9-o11y-dedicated-route
spec:
  parentRefs:
    - name: gcp-regional
      namespace: kong-system
      sectionName: o11y
  rules:
    - matches:
        - path:
            type: PathPrefix
            value: /
      backendRefs:
        - name: vminsert-cp9-metrics
          port: 8480
