chart/templates/services/api/_container.tpl (54 lines of code) (raw):
# SPDX-License-Identifier: Apache-2.0
# Copyright 2022 The HuggingFace Authors.
{{- define "containerApi" -}}
- name: "{{ include "name" . }}-api"
image: {{ include "services.api.image" . }}
imagePullPolicy: {{ .Values.images.pullPolicy }}
env:
{{ include "envCache" . | nindent 2 }}
{{ include "envS3" . | nindent 2 }}
{{ include "envCloudfront" . | nindent 2 }}
{{ include "envQueue" . | nindent 2 }}
{{ include "envCommon" . | nindent 2 }}
{{ include "envHf" . | nindent 2 }}
{{ include "envLog" . | nindent 2 }}
{{ include "envNumba" . | nindent 2 }}
# storage
{{ include "envAssets" . | nindent 2 }}
{{ include "envCachedAssets" . | nindent 2 }}
# service
- name: API_MAX_AGE_LONG
value: {{ .Values.api.maxAgeLong | quote }}
- name: API_MAX_AGE_SHORT
value: {{ .Values.api.maxAgeShort | quote }}
# prometheus
- name: PROMETHEUS_MULTIPROC_DIR
value: {{ .Values.api.prometheusMultiprocDirectory | quote }}
# uvicorn
- name: API_UVICORN_HOSTNAME
value: {{ .Values.api.uvicornHostname | quote }}
- name: API_UVICORN_NUM_WORKERS
value: {{ .Values.api.uvicornNumWorkers | quote }}
- name: API_UVICORN_PORT
value: {{ .Values.api.uvicornPort | quote }}
securityContext:
allowPrivilegeEscalation: false
readinessProbe:
failureThreshold: 30
periodSeconds: 5
httpGet:
path: /healthcheck
port: {{ .Values.api.uvicornPort }}
livenessProbe:
failureThreshold: 30
periodSeconds: 5
httpGet:
path: /healthcheck
port: {{ .Values.api.uvicornPort }}
ports:
- containerPort: {{ .Values.api.uvicornPort }}
name: http
protocol: TCP
resources:
{{ toYaml .Values.api.resources | nindent 4 }}
{{- end -}}