|
| 1 | +# Copyright (c) 2024 Intel Corporation |
| 2 | +# |
| 3 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +# you may not use this file except in compliance with the License. |
| 5 | +# You may obtain a copy of the License at |
| 6 | +# |
| 7 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +# |
| 9 | +# Unless required by applicable law or agreed to in writing, software |
| 10 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +# See the License for the specific language governing permissions and |
| 13 | +# limitations under the License. |
| 14 | +{{- $name := .Values.deploy.modelName | required ".Values.deploy.modelName is required." -}} |
| 15 | +--- |
| 16 | +apiVersion: apps/v1 |
| 17 | +kind: Deployment |
| 18 | +metadata: |
| 19 | + name: {{ include "tensorflow-serving.fullname" . }} |
| 20 | + labels: |
| 21 | + {{- include "tensorflow-serving.labels" . | nindent 4 }} |
| 22 | +spec: |
| 23 | + replicas: {{ .Values.deploy.replicas }} |
| 24 | + selector: |
| 25 | + matchLabels: |
| 26 | + {{- include "tensorflow-serving.selectorLabels" . | nindent 6 }} |
| 27 | + template: |
| 28 | + metadata: |
| 29 | + labels: |
| 30 | + {{- include "tensorflow-serving.labels" . | nindent 8 }} |
| 31 | + spec: |
| 32 | + securityContext: |
| 33 | + fsGroup: 1000 |
| 34 | + runAsUser: 1000 |
| 35 | + containers: |
| 36 | + - name: tensorflow-serving |
| 37 | + image: {{ .Values.deploy.image }} |
| 38 | + {{- if eq .Values.deploy.env.enabled true }} |
| 39 | + envFrom: |
| 40 | + - configMapRef: |
| 41 | + name: {{ .Values.deploy.env.configMapName }} |
| 42 | + {{- end }} |
| 43 | + env: |
| 44 | + - name: MODEL_NAME |
| 45 | + value: {{ .Values.deploy.modelName }} |
| 46 | + ports: |
| 47 | + - name: rest |
| 48 | + containerPort: 8500 |
| 49 | + protocol: TCP |
| 50 | + - name: grpc |
| 51 | + containerPort: 8501 |
| 52 | + protocol: TCP |
| 53 | + readinessProbe: |
| 54 | + tcpSocket: |
| 55 | + port: rest |
| 56 | + initialDelay: 15 |
| 57 | + timeoutSeconds: 1 |
| 58 | + volumeMounts: |
| 59 | + - mountPath: /dev/shm |
| 60 | + name: dshm |
| 61 | + {{- if .Values.deploy.storage.nfs.enabled }} |
| 62 | + - name: model |
| 63 | + mountPath: /models/{{ .Values.deploy.modelName }} |
| 64 | + {{- else }} |
| 65 | + - name: model |
| 66 | + mountPath: /models/{{ .Values.deploy.modelName }} |
| 67 | + {{- end }} |
| 68 | + resources: |
| 69 | + {{- toYaml .Values.deploy.resources | nindent 12 }} |
| 70 | + volumes: |
| 71 | + - name: dshm |
| 72 | + emptyDir: |
| 73 | + medium: Memory |
| 74 | + {{- if .Values.deploy.storage.nfs.enabled }} |
| 75 | + - name: model |
| 76 | + nfs: |
| 77 | + server: {{ .Values.deploy.storage.nfs.server }} |
| 78 | + path: {{ .Values.deploy.storage.nfs.path }} |
| 79 | + readOnly: {{ .Values.deploy.storage.nfs.readOnly }} |
| 80 | + {{- else }} |
| 81 | + - name: model |
| 82 | + persistentVolumeClaim: |
| 83 | + claimName: {{ include "tensorflow-serving.fullname" . }}-model-dir |
| 84 | + {{- end }} |
0 commit comments