* resource constraints: (fixes #895) - for cpu, only set cpu requests - for memory, set mem requests == mem limits - add missing resource constraints for minio and scheduled job - for crawler, set mem and cpu constraints per browser, scale based on browser instances per crawler - add comments in values.yaml for crawler values being multiplied - default values: bump crawler to 650 millicpu per browser instance just in case cleanup: remove unused entries from main backend configmap
		
			
				
	
	
		
			192 lines
		
	
	
		
			4.5 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
			
		
		
	
	
			192 lines
		
	
	
		
			4.5 KiB
		
	
	
	
		
			YAML
		
	
	
	
	
	
| ---
 | |
| apiVersion: apps/v1
 | |
| kind: Deployment
 | |
| metadata:
 | |
|   name: {{ .Values.name }}-backend
 | |
|   namespace: {{ .Release.Namespace }}
 | |
| 
 | |
| spec:
 | |
|   selector:
 | |
|     matchLabels:
 | |
|       app: {{ .Values.name }}
 | |
|       role: backend
 | |
|   replicas: {{ .Values.backend_num_replicas }}
 | |
|   template:
 | |
|     metadata:
 | |
|       labels:
 | |
|         app: {{ .Values.name }}
 | |
|         role: backend
 | |
| 
 | |
|       annotations:
 | |
|         # force helm to update the deployment each time
 | |
|         {{- if not .Values.frontend_only }}
 | |
|         "helm.update": {{ randAlphaNum 5 | quote }}
 | |
|         {{- end }}
 | |
| 
 | |
|     spec:
 | |
|       {{- if .Values.main_node_type }}
 | |
|       nodeSelector:
 | |
|         nodeType: {{ .Values.main_node_type }}
 | |
|       {{- end }}
 | |
| 
 | |
|       volumes:
 | |
|         - name: config-volume
 | |
|           configMap:
 | |
|             name: shared-job-config
 | |
|             items:
 | |
|               - key: config.yaml
 | |
|                 path: config.yaml
 | |
| 
 | |
|       containers:
 | |
|         - name: api
 | |
|           image: {{ .Values.backend_image }}
 | |
|           imagePullPolicy: {{ .Values.backend_pull_policy }}
 | |
|           envFrom:
 | |
|             - configMapRef:
 | |
|                 name: {{ .Values.name }}-env-config
 | |
|             - secretRef:
 | |
|                 name: auth-secrets
 | |
|             - secretRef:
 | |
|                 name: mongo-auth
 | |
| 
 | |
|           env:
 | |
|             - name: WEB_CONCURRENCY
 | |
|               value: "{{ .Values.backend_workers | default 4 }}"
 | |
| 
 | |
|           resources:
 | |
|             limits:
 | |
|               memory: {{ .Values.backend_memory }}
 | |
| 
 | |
|             requests:
 | |
|               cpu: {{ .Values.backend_cpu }}
 | |
|               memory: {{ .Values.backend_memory }}
 | |
| 
 | |
|           startupProbe:
 | |
|             httpGet:
 | |
|               path: /healthz
 | |
|               port: 8000
 | |
|             initialDelaySeconds: 5
 | |
|             periodSeconds: 5
 | |
|             failureThreshold: 30
 | |
|             successThreshold: 1
 | |
| 
 | |
|           readinessProbe:
 | |
|             httpGet:
 | |
|               path: /healthz
 | |
|               port: 8000
 | |
|             initialDelaySeconds: 5
 | |
|             periodSeconds: 30
 | |
|             failureThreshold: 5
 | |
|             successThreshold: 1
 | |
| 
 | |
|           livenessProbe:
 | |
|             httpGet:
 | |
|               path: /healthz
 | |
|               port: 8000
 | |
|             initialDelaySeconds: 5
 | |
|             periodSeconds: 30
 | |
|             failureThreshold: 5
 | |
|             successThreshold: 1
 | |
| 
 | |
|         - name: op
 | |
|           image: {{ .Values.backend_image }}
 | |
|           imagePullPolicy: {{ .Values.backend_pull_policy }}
 | |
|           command:
 | |
|               - uvicorn
 | |
|               - btrixcloud.main_op:app_root
 | |
|               - --host
 | |
|               - 0.0.0.0
 | |
|               - --port
 | |
|               - "{{ .Values.opPort }}"
 | |
|               - --access-log
 | |
|               - --log-level
 | |
|               - info
 | |
| 
 | |
|           envFrom:
 | |
|             - configMapRef:
 | |
|                 name: {{ .Values.name }}-env-config
 | |
|             - secretRef:
 | |
|                 name: auth-secrets
 | |
|             - secretRef:
 | |
|                 name: mongo-auth
 | |
| 
 | |
|           env:
 | |
|             - name: WEB_CONCURRENCY
 | |
|               value: "{{ .Values.operator_workers | default 1 }}"
 | |
| 
 | |
|           volumeMounts:
 | |
|             - name: config-volume
 | |
|               mountPath: /config
 | |
| 
 | |
|           resources:
 | |
|             limits:
 | |
|               memory: {{ .Values.backend_memory }}
 | |
| 
 | |
|             requests:
 | |
|               cpu: {{ .Values.backend_cpu }}
 | |
|               memory: {{ .Values.backend_memory }}
 | |
| 
 | |
|           startupProbe:
 | |
|             httpGet:
 | |
|               path: /healthz
 | |
|               port: {{ .Values.opPort }}
 | |
|             initialDelaySeconds: 5
 | |
|             periodSeconds: 5
 | |
|             failureThreshold: 30
 | |
|             successThreshold: 1
 | |
| 
 | |
|           readinessProbe:
 | |
|             httpGet:
 | |
|               path: /healthz
 | |
|               port: {{ .Values.opPort }}
 | |
|             initialDelaySeconds: 5
 | |
|             periodSeconds: 30
 | |
|             failureThreshold: 5
 | |
|             successThreshold: 1
 | |
| 
 | |
|           livenessProbe:
 | |
|             httpGet:
 | |
|               path: /healthz
 | |
|               port: {{ .Values.opPort }}
 | |
|             initialDelaySeconds: 5
 | |
|             periodSeconds: 30
 | |
|             failureThreshold: 5
 | |
|             successThreshold: 1
 | |
| 
 | |
| 
 | |
| 
 | |
| ---
 | |
| 
 | |
| apiVersion: v1
 | |
| kind: Service
 | |
| 
 | |
| metadata:
 | |
|   namespace: {{ .Release.Namespace }}
 | |
|   name: {{ .Values.name }}-backend
 | |
|   labels:
 | |
|     app: {{ .Values.name }}
 | |
|     role: backend
 | |
| 
 | |
| {{- 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: backend
 | |
| 
 | |
|   ports:
 | |
|     - protocol: TCP
 | |
|       port: 8000
 | |
|       name: api
 | |
| 
 | |
|     - protocol: TCP
 | |
|       port: {{ .Values.opPort }}
 | |
|       name: operator
 |