swarm
This commit is contained in:
48
helm/fastdfs-nginx/templates/configmap.yaml
Normal file
48
helm/fastdfs-nginx/templates/configmap.yaml
Normal file
@ -0,0 +1,48 @@
|
||||
{{- $root := . -}}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ template "fastdfs-nginx.fullname" $root }}
|
||||
labels:
|
||||
app: {{ template "fastdfs-nginx.fullname" $root }}
|
||||
chart: {{ template "fastdfs-nginx.chart" $root }}
|
||||
release: "{{ $.Release.Name }}"
|
||||
heritage: "{{ $.Release.Service }}"
|
||||
data:
|
||||
tracker.conf: |
|
||||
#tracker.conf
|
||||
{{- range $skey, $svalue := $.Values.fastdfs.storage }}
|
||||
upstream fdfs_{{ $svalue.name }} {
|
||||
dynamic_resolve fallback=stale fail_timeout=30s;
|
||||
{{- range $i, $e := until (int $svalue.replica) }}
|
||||
{{- $storageNginxPort := $.Values.storagePorts.storagenginx.containerPort }}
|
||||
{{- $storagePodName := (printf "%s-storage-%s-%d" (include "fastdfs-nginx.fullname" $root) $svalue.name $i) }}
|
||||
{{- $storageServiceName := (printf "%s-storage-%s-headless" (include "fastdfs-nginx.fullname" $root) $svalue.name) }}
|
||||
server {{ $storagePodName }}.{{ $storageServiceName }}:{{ $storageNginxPort }};
|
||||
{{- end }}
|
||||
check interval=3000 rise=2 fall=5 timeout=1000 type=http;
|
||||
}
|
||||
{{- end }}
|
||||
server {
|
||||
listen 80 ;
|
||||
# server_name _ ;
|
||||
|
||||
location / {
|
||||
root html;
|
||||
index index.html index.htm;
|
||||
}
|
||||
location /status {
|
||||
check_status;
|
||||
access_log off;
|
||||
allow 127.0.0.1;
|
||||
deny all;
|
||||
}
|
||||
{{- range $skey, $svalue := $.Values.fastdfs.storage }}
|
||||
location ~/{{ $svalue.name }}/ {
|
||||
proxy_pass http://fdfs_{{ $svalue.name }};
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
{{- end }}
|
||||
}
|
Reference in New Issue
Block a user