|
| 1 | +{{- range $model := .Values.models }} |
| 2 | +--- |
| 3 | +apiVersion: apps/v1 |
| 4 | +kind: Deployment |
| 5 | +metadata: |
| 6 | + name: {{ printf "%s-%s-api" (include "flux-image-gen.fullname" $) $model }} |
| 7 | + labels: |
| 8 | + {{- include "flux-image-gen.labels" $ | nindent 4 }} |
| 9 | + {{- include "flux-image-gen.modelLabels" . | nindent 4 }} |
| 10 | +spec: |
| 11 | + replicas: {{ $.Values.api.replicaCount }} |
| 12 | + {{- with $.Values.api.deploymentStrategy }} |
| 13 | + strategy: |
| 14 | + {{- toYaml . | nindent 4 }} |
| 15 | + {{- end }} |
| 16 | + selector: |
| 17 | + matchLabels: |
| 18 | + {{- include "flux-image-gen.selectorLabels" $ | nindent 6 }} |
| 19 | + {{- include "flux-image-gen.modelLabels" . | nindent 6 }} |
| 20 | + template: |
| 21 | + metadata: |
| 22 | + {{- with $.Values.api.podAnnotations }} |
| 23 | + annotations: |
| 24 | + {{- toYaml . | nindent 8 }} |
| 25 | + {{- end }} |
| 26 | + labels: |
| 27 | + {{- include "flux-image-gen.labels" $ | nindent 8 }} |
| 28 | + {{- include "flux-image-gen.modelLabels" . | nindent 8 }} |
| 29 | + {{- with $.Values.api.podLabels }} |
| 30 | + {{- toYaml . | nindent 8 }} |
| 31 | + {{- end }} |
| 32 | + spec: |
| 33 | + {{- with $.Values.api.imagePullSecrets }} |
| 34 | + imagePullSecrets: |
| 35 | + {{- toYaml . | nindent 8 }} |
| 36 | + {{- end }} |
| 37 | + securityContext: |
| 38 | + {{- toYaml $.Values.api.podSecurityContext | nindent 8 }} |
| 39 | + containers: |
| 40 | + - name: {{ $.Chart.Name }} |
| 41 | + securityContext: |
| 42 | + {{- toYaml $.Values.api.securityContext | nindent 12 }} |
| 43 | + image: "{{ $.Values.image.repository }}:{{ $.Values.image.tag | default $.Chart.AppVersion }}" |
| 44 | + imagePullPolicy: {{ $.Values.image.pullPolicy }} |
| 45 | + {{- with $.Values.api.commandOverride }} |
| 46 | + {{- if . }} |
| 47 | + command: |
| 48 | + {{- . | toYaml | nindent 12 }} |
| 49 | + {{- end }} |
| 50 | + {{- end }} |
| 51 | + ports: |
| 52 | + - name: http |
| 53 | + containerPort: {{ $.Values.api.service.port }} |
| 54 | + protocol: TCP |
| 55 | + {{- if $.Values.api.startupProbe }} |
| 56 | + startupProbe: |
| 57 | + {{- toYaml $.Values.api.startupProbe | nindent 12 }} |
| 58 | + {{- end }} |
| 59 | + {{- if $.Values.api.livenessProbe }} |
| 60 | + livenessProbe: |
| 61 | + {{- toYaml $.Values.api.livenessProbe | nindent 12 }} |
| 62 | + {{- end }} |
| 63 | + {{- if $.Values.api.readinessProbe }} |
| 64 | + readinessProbe: |
| 65 | + {{- toYaml $.Values.api.readinessProbe | nindent 12 }} |
| 66 | + {{- end }} |
| 67 | + resources: |
| 68 | + {{- toYaml $.Values.api.resources | nindent 12 }} |
| 69 | + {{- with $.Values.api.volumeMounts }} |
| 70 | + volumeMounts: |
| 71 | + {{- toYaml . | nindent 12 }} |
| 72 | + {{- end }} |
| 73 | + # Make stdout from python visible in k8s logs |
| 74 | + tty: true |
| 75 | + env: |
| 76 | + - name: FLUX_MODEL_NAME |
| 77 | + value: {{ $model }} |
| 78 | + - name: PYTHONUNBUFFERED |
| 79 | + value: "1" |
| 80 | + {{- if $.Values.api.huggingfaceToken }} |
| 81 | + - name: HUGGING_FACE_HUB_TOKEN |
| 82 | + value: {{ quote $.Values.api.huggingfaceToken }} |
| 83 | + {{- end }} |
| 84 | + {{- with $.Values.api.envFrom }} |
| 85 | + envFrom: |
| 86 | + {{- toYaml . | nindent 12 }} |
| 87 | + {{- end }} |
| 88 | + {{- with $.Values.api.volumes }} |
| 89 | + volumes: |
| 90 | + {{- toYaml . | nindent 8 }} |
| 91 | + {{- end }} |
| 92 | + {{- with $.Values.api.nodeSelector }} |
| 93 | + nodeSelector: |
| 94 | + {{- toYaml . | nindent 8 }} |
| 95 | + {{- end }} |
| 96 | + {{- with $.Values.api.affinity }} |
| 97 | + affinity: |
| 98 | + {{- toYaml . | nindent 8 }} |
| 99 | + {{- end }} |
| 100 | + {{- with $.Values.api.tolerations }} |
| 101 | + tolerations: |
| 102 | + {{- toYaml . | nindent 8 }} |
| 103 | + {{- end }} |
| 104 | +{{- end -}} |
0 commit comments