kubernetes-yaml/learn/learn-kubernetes-master/kiamol/ch10/proxy/templates/nginx-configMap.yaml

46 lines
1.3 KiB
YAML
Raw Normal View History

apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Release.Name }}-config
labels:
kiamol: ch10
data:
nginx.conf: |-
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
proxy_cache_path /data/nginx/cache levels=1:2 keys_zone=STATIC:10m inactive=24h max_size={{ .Values.cacheMaxSixe }};
gzip on;
gzip_proxied any;
map $sent_http_content_type $expires {
default off;
~image/ {{ .Values.imageExpiresDuration }};
}
server {
listen 80 default_server;
listen [::]:80 default_server;
location / {
proxy_pass http://{{ tpl .Values.upstreamToProxy . }};
proxy_set_header Host $host;
proxy_cache STATIC;
proxy_cache_valid 200 1d;
proxy_cache_use_stale error timeout invalid_header updating
http_500 http_502 http_503 http_504;
add_header X-Cache $upstream_cache_status;
add_header X-Host $hostname;
}
}
}