mirror of
https://github.com/bitnami/charts.git
synced 2026-03-14 14:57:22 +08:00
104 lines
5.0 KiB
YAML
104 lines
5.0 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: {{ template "common.names.fullname" . }}
|
|
labels: {{- include "common.labels.standard" . | nindent 4 }}
|
|
spec:
|
|
selector:
|
|
matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
|
|
replicas: {{ .Values.replicaCount }}
|
|
template:
|
|
metadata:
|
|
labels: {{- include "common.labels.standard" . | nindent 8 }}
|
|
{{- if or .Values.podAnnotations (and .Values.metrics.enabled .Values.metrics.podAnnotations) }}
|
|
annotations:
|
|
{{- if .Values.podAnnotations }}
|
|
{{- include "common.tplvalues.render" ( dict "value" .Values.podAnnotations "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
{{- if and .Values.metrics.enabled .Values.metrics.podAnnotations }}
|
|
{{- include "common.tplvalues.render" ( dict "value" .Values.metrics.podAnnotations "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
{{- end }}
|
|
spec:
|
|
{{- include "tensorflow-resnet.imagePullSecrets" . | nindent 6 }}
|
|
{{- if .Values.affinity }}
|
|
affinity: {{- include "common.tplvalues.render" ( dict "value" .Values.affinity "context" $) | nindent 8 }}
|
|
{{- else }}
|
|
affinity:
|
|
podAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAffinityPreset "component" "master" "context" $) | nindent 10 }}
|
|
podAntiAffinity: {{- include "common.affinities.pods" (dict "type" .Values.podAntiAffinityPreset "component" "master" "context" $) | nindent 10 }}
|
|
nodeAffinity: {{- include "common.affinities.nodes" (dict "type" .Values.nodeAffinityPreset.type "key" .Values.nodeAffinityPreset.key "values" .Values.nodeAffinityPreset.values) | nindent 10 }}
|
|
{{- end }}
|
|
{{- if .Values.nodeSelector }}
|
|
nodeSelector: {{- include "common.tplvalues.render" ( dict "value" .Values.nodeSelector "context" $) | nindent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.tolerations }}
|
|
tolerations: {{- include "common.tplvalues.render" (dict "value" .Values.tolerations "context" .) | nindent 8 }}
|
|
{{- end }}
|
|
initContainers:
|
|
- name: seed
|
|
image: {{ include "tensorflow-resnet.client.image" . }}
|
|
imagePullPolicy: {{ .Values.client.image.pullPolicy | quote }}
|
|
command:
|
|
- "/bin/sh"
|
|
- "-c"
|
|
- |
|
|
if [ -f /seed/.initialized ]; then
|
|
echo "Already initialized. Skipping"
|
|
else
|
|
curl -o /seed/resnet_v2_fp32_savedmodel_NHWC_jpg.tar.gz http://download.tensorflow.org/models/official/20181001_resnet/savedmodels/resnet_v2_fp32_savedmodel_NHWC_jpg.tar.gz
|
|
cd /seed/ && tar -xzf resnet_v2_fp32_savedmodel_NHWC_jpg.tar.gz --strip-components=2
|
|
rm resnet_v2_fp32_savedmodel_NHWC_jpg.tar.gz
|
|
touch /seed/.initialized
|
|
fi
|
|
volumeMounts:
|
|
- name: seed
|
|
mountPath: /seed
|
|
containers:
|
|
- name: tensorflow-serving
|
|
image: {{ include "tensorflow-resnet.server.image" . }}
|
|
imagePullPolicy: {{ .Values.server.image.pullPolicy | quote }}
|
|
ports:
|
|
- name: tf-serving
|
|
containerPort: {{ .Values.containerPorts.server }}
|
|
- name: tf-serving-api
|
|
containerPort: {{ .Values.containerPorts.restApi }}
|
|
{{- if .Values.livenessProbe.enabled }}
|
|
livenessProbe:
|
|
tcpSocket:
|
|
port: tf-serving
|
|
initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }}
|
|
periodSeconds: {{ .Values.livenessProbe.periodSeconds }}
|
|
timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }}
|
|
successThreshold: {{ .Values.livenessProbe.successThreshold }}
|
|
failureThreshold: {{ .Values.livenessProbe.failureThreshold }}
|
|
{{- end }}
|
|
{{- if .Values.readinessProbe.enabled }}
|
|
readinessProbe:
|
|
tcpSocket:
|
|
port: tf-serving
|
|
initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }}
|
|
periodSeconds: {{ .Values.readinessProbe.periodSeconds }}
|
|
timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }}
|
|
successThreshold: {{ .Values.readinessProbe.successThreshold }}
|
|
failureThreshold: {{ .Values.readinessProbe.failureThreshold }}
|
|
{{- end }}
|
|
env:
|
|
- name: TENSORFLOW_SERVING_MODEL_NAME
|
|
value: "resnet"
|
|
- name: TENSORFLOW_SERVING_PORT_NUMBER
|
|
value: "{{ .Values.server.port }}"
|
|
- name: TENSORFLOW_SERVING_REST_API_PORT_NUMBER
|
|
value: "{{ .Values.server.restApiPort }}"
|
|
- name: TENSORFLOW_SERVING_ENABLE_MONITORING
|
|
value: {{ ternary "yes" "no" .Values.metrics.enabled | quote }}
|
|
{{- if .Values.resources }}
|
|
resources: {{- toYaml .Values.resources | nindent 12 }}
|
|
{{- end }}
|
|
volumeMounts:
|
|
- name: seed
|
|
mountPath: "/bitnami/model-data"
|
|
volumes:
|
|
- name: seed
|
|
emptyDir: {}
|