---
kind: Ingress
apiVersion: networking.k8s.io/v1
metadata:
  name: ingress-with-custom-headers
  namespace: default
  annotations:
    nginx.ingress.kubernetes.io/custom-headers: default/custom-headers-configmap

spec:
  ingressClassName: nginx
  rules:
    - host: whoami.localhost
      http:
        paths:
          - path: /
            pathType: Exact
            backend:
              service:
                name: whoami
                port:
                  number: 80

---
kind: Ingress
apiVersion: networking.k8s.io/v1
metadata:
  name: ingress-with-cross-namespace-headers
  namespace: default
  annotations:
    nginx.ingress.kubernetes.io/custom-headers: other-namespace/custom-headers-configmap

spec:
  ingressClassName: nginx
  rules:
    - host: cross-namespace.localhost
      http:
        paths:
          - path: /
            pathType: Exact
            backend:
              service:
                name: whoami
                port:
                  number: 80

---
kind: ConfigMap
apiVersion: v1
metadata:
  name: custom-headers-configmap
  namespace: default
data:
  X-Custom-Header: "some-random-string"

---
kind: ConfigMap
apiVersion: v1
metadata:
  name: custom-headers-configmap
  namespace: other-namespace
data:
  X-Cross-Header: "cross-value"
