-
-
Notifications
You must be signed in to change notification settings - Fork 28
/
frontend.yaml
141 lines (119 loc) · 3.23 KB
/
frontend.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.name }}-frontend
namespace: {{ .Release.Namespace }}
spec:
selector:
matchLabels:
app: {{ .Values.name }}
role: frontend
{{- if eq (int .Values.frontend_max_replicas) 1 }}
replicas: 1
{{- end }}
template:
metadata:
labels:
app: {{ .Values.name }}
role: frontend
annotations:
# force helm to update the deployment each time
{{- if not .Values.backend_only }}
"helm.update": {{ randAlphaNum 5 | quote }}
{{- end }}
spec:
{{- if .Values.main_node_type }}
nodeSelector:
nodeType: {{ .Values.main_node_type }}
{{- end }}
containers:
- name: nginx
image: {{ .Values.frontend_image }}
imagePullPolicy: {{ .Values.frontend_pull_policy }}
env:
- name: BACKEND_HOST
value: {{ .Values.name }}-backend
- name: CRAWLER_FQDN_SUFFIX
value: ".{{ .Values.crawler_namespace }}.svc.cluster.local"
- name: NGINX_ENTRYPOINT_WORKER_PROCESSES_AUTOTUNE
value: "1"
- name: RWP_BASE_URL
value: {{ .Values.rwp_base_url }}
{{- if .Values.minio_local }}
- name: LOCAL_MINIO_HOST
value: "{{ .Values.minio_host }}"
- name: LOCAL_BUCKET
value: "{{ .Values.minio_local_bucket_name }}"
{{- end }}
resources:
limits:
memory: {{ .Values.frontend_memory }}
requests:
cpu: {{ .Values.frontend_cpu }}
memory: {{ .Values.frontend_memory }}
readinessProbe:
httpGet:
path: /healthz
port: 8880
failureThreshold: 3
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
---
apiVersion: v1
kind: Service
metadata:
namespace: {{ .Release.Namespace }}
name: {{ .Values.name }}-frontend
labels:
app: {{ .Values.name }}
role: frontend
{{- if .Values.service }}
{{- if .Values.service.annotations }}
annotations:
{{- range $key, $val := .Values.service.annotations }}
{{ $key }}: {{ $val | quote }}
{{- end }}
{{- end }}
{{- end }}
spec:
selector:
app: {{ .Values.name }}
role: frontend
ports:
- protocol: TCP
port: 80
name: frontend
{{- if and .Values.local_service_port (not .Values.ingress.host) }}
nodePort: {{ .Values.local_service_port }}
type: NodePort
{{- end }}
{{- if gt (int .Values.frontend_max_replicas) 1 }}
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: frontend-autoscaler
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ .Values.name }}-frontend
minReplicas: 1
maxReplicas: {{ .Values.frontend_max_replicas }}
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.frontend_avg_cpu_threshold }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.frontend_avg_memory_threshold }}
{{ end }}