- Add orchard.pypiCache config section to helm values - Set default workers to 2 (reduced from 5 to limit memory) - Bump pod memory from 512Mi to 768Mi (request=limit) - Add ORCHARD_PYPI_CACHE_* env vars to deployment template
220 lines
9.8 KiB
YAML
220 lines
9.8 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: {{ include "orchard.fullname" . }}
|
|
labels:
|
|
{{- include "orchard.labels" . | nindent 4 }}
|
|
spec:
|
|
{{- if not .Values.autoscaling.enabled }}
|
|
replicas: {{ .Values.replicaCount }}
|
|
{{- end }}
|
|
selector:
|
|
matchLabels:
|
|
{{- include "orchard.selectorLabels" . | nindent 6 }}
|
|
template:
|
|
metadata:
|
|
annotations:
|
|
checksum/secret: {{ include (print $.Template.BasePath "/secret.yaml") . | sha256sum }}
|
|
{{- with .Values.podAnnotations }}
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
labels:
|
|
{{- include "orchard.labels" . | nindent 8 }}
|
|
{{- with .Values.podLabels }}
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
spec:
|
|
{{- with .Values.imagePullSecrets }}
|
|
imagePullSecrets:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
serviceAccountName: {{ include "orchard.serviceAccountName" . }}
|
|
securityContext:
|
|
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
|
initContainers:
|
|
{{- if .Values.waitForDatabase }}
|
|
- name: wait-for-db
|
|
image: "{{ .Values.initContainer.image.repository }}:{{ .Values.initContainer.image.tag }}"
|
|
imagePullPolicy: {{ .Values.initContainer.image.pullPolicy }}
|
|
command: ['sh', '-c', 'until nc -z {{ include "orchard.postgresql.host" . }} 5432; do echo waiting for database; sleep 2; done;']
|
|
resources:
|
|
limits:
|
|
cpu: 50m
|
|
memory: 32Mi
|
|
requests:
|
|
cpu: 10m
|
|
memory: 32Mi
|
|
{{- end }}
|
|
{{- if .Values.minio.enabled }}
|
|
- name: wait-for-minio
|
|
image: "{{ .Values.initContainer.image.repository }}:{{ .Values.initContainer.image.tag }}"
|
|
imagePullPolicy: {{ .Values.initContainer.image.pullPolicy }}
|
|
command: ['sh', '-c', 'until nc -z {{ .Release.Name }}-minio 9000; do echo waiting for minio; sleep 2; done;']
|
|
resources:
|
|
limits:
|
|
cpu: 50m
|
|
memory: 32Mi
|
|
requests:
|
|
cpu: 10m
|
|
memory: 32Mi
|
|
{{- end }}
|
|
containers:
|
|
- name: {{ .Chart.Name }}
|
|
securityContext:
|
|
{{- toYaml .Values.securityContext | nindent 12 }}
|
|
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
|
ports:
|
|
- name: http
|
|
containerPort: {{ .Values.orchard.server.port }}
|
|
protocol: TCP
|
|
env:
|
|
- name: ORCHARD_ENV
|
|
value: {{ .Values.orchard.env | default "development" | quote }}
|
|
- name: ORCHARD_SERVER_HOST
|
|
value: {{ .Values.orchard.server.host | quote }}
|
|
- name: ORCHARD_SERVER_PORT
|
|
value: {{ .Values.orchard.server.port | quote }}
|
|
- name: ORCHARD_DATABASE_HOST
|
|
value: {{ include "orchard.postgresql.host" . | quote }}
|
|
- name: ORCHARD_DATABASE_PORT
|
|
value: {{ .Values.orchard.database.port | quote }}
|
|
{{- if and .Values.orchard.database.secretsManager .Values.orchard.database.secretsManager.enabled }}
|
|
- name: ORCHARD_DATABASE_USER
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ include "orchard.postgresql.secretName" . }}
|
|
key: username
|
|
{{- else }}
|
|
- name: ORCHARD_DATABASE_USER
|
|
value: {{ .Values.orchard.database.user | default .Values.postgresql.auth.username | quote }}
|
|
{{- end }}
|
|
- name: ORCHARD_DATABASE_DBNAME
|
|
value: {{ .Values.orchard.database.dbname | default .Values.postgresql.auth.database | quote }}
|
|
- name: ORCHARD_DATABASE_SSLMODE
|
|
value: {{ .Values.orchard.database.sslmode | quote }}
|
|
- name: ORCHARD_DATABASE_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ include "orchard.postgresql.secretName" . }}
|
|
key: {{ include "orchard.postgresql.passwordKey" . }}
|
|
- name: ORCHARD_S3_ENDPOINT
|
|
value: {{ include "orchard.minio.host" . | quote }}
|
|
- name: ORCHARD_S3_REGION
|
|
value: {{ .Values.orchard.s3.region | quote }}
|
|
- name: ORCHARD_S3_BUCKET
|
|
value: {{ .Values.orchard.s3.bucket | quote }}
|
|
- name: ORCHARD_S3_USE_PATH_STYLE
|
|
value: {{ .Values.orchard.s3.usePathStyle | quote }}
|
|
{{- if or .Values.minio.enabled .Values.orchard.s3.existingSecret .Values.orchard.s3.accessKeyId }}
|
|
- name: ORCHARD_S3_ACCESS_KEY_ID
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ include "orchard.minio.secretName" . }}
|
|
key: {{ if .Values.minio.enabled }}root-user{{ else }}{{ .Values.orchard.s3.existingSecretAccessKeyKey }}{{ end }}
|
|
- name: ORCHARD_S3_SECRET_ACCESS_KEY
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ include "orchard.minio.secretName" . }}
|
|
key: {{ if .Values.minio.enabled }}root-password{{ else }}{{ .Values.orchard.s3.existingSecretSecretKeyKey }}{{ end }}
|
|
{{- end }}
|
|
- name: ORCHARD_DOWNLOAD_MODE
|
|
value: {{ .Values.orchard.download.mode | quote }}
|
|
- name: ORCHARD_PRESIGNED_URL_EXPIRY
|
|
value: {{ .Values.orchard.download.presignedUrlExpiry | quote }}
|
|
{{- if .Values.orchard.rateLimit }}
|
|
{{- if .Values.orchard.rateLimit.login }}
|
|
- name: ORCHARD_LOGIN_RATE_LIMIT
|
|
value: {{ .Values.orchard.rateLimit.login | quote }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- if .Values.orchard.purgeSeedData }}
|
|
- name: ORCHARD_PURGE_SEED_DATA
|
|
value: "true"
|
|
{{- end }}
|
|
{{- if .Values.orchard.database.poolSize }}
|
|
- name: ORCHARD_DATABASE_POOL_SIZE
|
|
value: {{ .Values.orchard.database.poolSize | quote }}
|
|
{{- end }}
|
|
{{- if .Values.orchard.database.maxOverflow }}
|
|
- name: ORCHARD_DATABASE_MAX_OVERFLOW
|
|
value: {{ .Values.orchard.database.maxOverflow | quote }}
|
|
{{- end }}
|
|
{{- if .Values.orchard.database.poolTimeout }}
|
|
- name: ORCHARD_DATABASE_POOL_TIMEOUT
|
|
value: {{ .Values.orchard.database.poolTimeout | quote }}
|
|
{{- end }}
|
|
{{- if .Values.orchard.pypiCache }}
|
|
{{- if .Values.orchard.pypiCache.workers }}
|
|
- name: ORCHARD_PYPI_CACHE_WORKERS
|
|
value: {{ .Values.orchard.pypiCache.workers | quote }}
|
|
{{- end }}
|
|
{{- if .Values.orchard.pypiCache.maxDepth }}
|
|
- name: ORCHARD_PYPI_CACHE_MAX_DEPTH
|
|
value: {{ .Values.orchard.pypiCache.maxDepth | quote }}
|
|
{{- end }}
|
|
{{- if .Values.orchard.pypiCache.maxAttempts }}
|
|
- name: ORCHARD_PYPI_CACHE_MAX_ATTEMPTS
|
|
value: {{ .Values.orchard.pypiCache.maxAttempts | quote }}
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- if .Values.orchard.auth }}
|
|
{{- if or .Values.orchard.auth.secretsManager .Values.orchard.auth.existingSecret .Values.orchard.auth.adminPassword }}
|
|
- name: ORCHARD_ADMIN_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: {{ include "orchard.auth.secretName" . }}
|
|
key: admin-password
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- if or (and .Values.orchard.database.secretsManager .Values.orchard.database.secretsManager.enabled) (and .Values.orchard.auth .Values.orchard.auth.secretsManager .Values.orchard.auth.secretsManager.enabled) }}
|
|
volumeMounts:
|
|
{{- if and .Values.orchard.database.secretsManager .Values.orchard.database.secretsManager.enabled }}
|
|
- name: db-secrets
|
|
mountPath: /mnt/secrets-store/db
|
|
readOnly: true
|
|
{{- end }}
|
|
{{- if and .Values.orchard.auth .Values.orchard.auth.secretsManager .Values.orchard.auth.secretsManager.enabled }}
|
|
- name: auth-secrets
|
|
mountPath: /mnt/secrets-store/auth
|
|
readOnly: true
|
|
{{- end }}
|
|
{{- end }}
|
|
livenessProbe:
|
|
{{- toYaml .Values.livenessProbe | nindent 12 }}
|
|
readinessProbe:
|
|
{{- toYaml .Values.readinessProbe | nindent 12 }}
|
|
resources:
|
|
{{- toYaml .Values.resources | nindent 12 }}
|
|
{{- if or (and .Values.orchard.database.secretsManager .Values.orchard.database.secretsManager.enabled) (and .Values.orchard.auth .Values.orchard.auth.secretsManager .Values.orchard.auth.secretsManager.enabled) }}
|
|
volumes:
|
|
{{- if and .Values.orchard.database.secretsManager .Values.orchard.database.secretsManager.enabled }}
|
|
- name: db-secrets
|
|
csi:
|
|
driver: secrets-store.csi.k8s.io
|
|
readOnly: true
|
|
volumeAttributes:
|
|
secretProviderClass: {{ include "orchard.fullname" . }}-db-secret
|
|
{{- end }}
|
|
{{- if and .Values.orchard.auth .Values.orchard.auth.secretsManager .Values.orchard.auth.secretsManager.enabled }}
|
|
- name: auth-secrets
|
|
csi:
|
|
driver: secrets-store.csi.k8s.io
|
|
readOnly: true
|
|
volumeAttributes:
|
|
secretProviderClass: {{ include "orchard.fullname" . }}-auth-secret
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- with .Values.nodeSelector }}
|
|
nodeSelector:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.affinity }}
|
|
affinity:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
{{- with .Values.tolerations }}
|
|
tolerations:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|