# https://cloud.google.com/kubernetes-engine/docs/how-to/load-balance-ingress?hl=zh-cn
# https://cloud.google.com/kubernetes-engine/docs/how-to/managed-certs?hl=zh-cn#gcloud
# https://cloud.google.com/kubernetes-engine/docs/troubleshooting/ingress-health-checks?hl=zh-cn#considerations
apiVersion: networking.gke.io/v1
kind: ManagedCertificate
metadata:
  namespace: prometheus-integration
  name: managed-cert
spec:
  domains:
    - <DNS_PLACEHOLDER>
---
# healthchecker
apiVersion: cloud.google.com/v1
kind: BackendConfig
metadata:
  name: prom-integration-backendconfig
  namespace: prometheus-integration
spec:
  timeoutSec: 60
  connectionDraining:
    drainingTimeoutSec: 30
  healthCheck:
    checkIntervalSec: 10
    timeoutSec: 5
    healthyThreshold: 2
    unhealthyThreshold: 2
    port: 8080
    type: HTTP
    requestPath: /healthz
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: prom-integration
  namespace: prometheus-integration
  annotations:
    networking.gke.io/managed-certificates: managed-cert
    kubernetes.io/ingress.class: "gce"
spec:
  ingressClassName: gce
  rules:
    - host: <DNS_PLACEHOLDER>
      http:
        paths:
          - path: /public_api/v1
            pathType: Prefix
            backend:
              service:
                name: prom-integration
                port:
                  number: 8080
