I would like to have some Kubernetes ingress configuration like this:
- DEV environment
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: shop-page-ingress
annotations:
nginx.org/server-snippets: |
location / {
proxy_pass https://luz-shop:8443/shop.php?env=SHOP-DEV
proxy_redirect https://luz-shop:8443/ https://$host;
}
- TEST environment
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: shop-page-ingress
annotations:
nginx.org/server-snippets: |
location / {
proxy_pass https://luz-shop:8443/shop.php?env=SHOP-TEST
proxy_redirect https://luz-shop:8443/ https://$host;
}
The only one different thing is the query parameter between 2 environments: env=SHOP-DEV
.
The question is that I would organize these overlays by kustomize but I don't know it is possible or not? Can I have the BASE configuration with variable ${ENV_NAME}
like below and specify the value in the overlay configurations yaml?
- BASE yaml:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: shop-page-ingress
annotations:
nginx.org/server-snippets: |
location / {
proxy_pass https://luz-shop:8443/shop.php?env=${ENV_NAME}
proxy_redirect https://luz-shop:8443/ https://$host;
}