I have these two ingresses for a blue (production) and green (canary) deployment and I want in my nginx snippet to set certain stuff based on whether the request is served from production service or from canary. What should be the if
statement in the snippet?
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: blue-ingress
annotations:
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/configuration-snippet: |
if (canary) { <--- WHAT CAN I CHECK HERE?
...
} else {
...
}
spec:
...
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: green-ingress
annotations:
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/canary: "true"
nginx.ingress.kubernetes.io/canary-by-cookie: "green"
spec:
...