Skip to content

Commit

Permalink
Move the tf-serving HPA into the helm chart. (#396)
Browse files Browse the repository at this point in the history
* Upgrade chart to 0.4.0 and add templated hpa.yaml.

* move hpa configuration from addons into the helmfile.

* Match the image tags to the chart's appVersion.
  • Loading branch information
willgraf authored Dec 3, 2020
1 parent 7845a8d commit 00bf58e
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 28 deletions.
22 changes: 0 additions & 22 deletions conf/addons/hpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,6 @@
---
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: tf-serving
namespace: deepcell
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: tf-serving
minReplicas: 1
maxReplicas: {{ $max_gpus }}
metrics:
- type: Object
object:
metricName: tf_serving_gpu_usage
target:
apiVersion: v1
kind: Namespace
name: tf_serving_gpu_usage
targetValue: 70
---
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: segmentation-consumer
namespace: deepcell
Expand Down
5 changes: 2 additions & 3 deletions conf/charts/tf-serving/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
name: tf-serving
version: 0.3.0
version: 0.4.0
#kubeVersion: ^1.9.8
description: This helm chart provides the Tensorflow-serving backend functionality of the Deepcell application.
keywords:
Expand All @@ -13,7 +13,6 @@ maintainers:
email: [email protected]
url: vanvalen.caltech.edu
engine: gotpl
appVersion: 0.1.0
appVersion: 0.4.0
deprecated: false
tillerVersion: ^2.9.1

23 changes: 23 additions & 0 deletions conf/charts/tf-serving/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{{- if (.Values.hpa.enabled) }}
---
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: {{ template "fullname" . }}
labels:
app: {{ template "name" . }}
chart: {{ template "chart" . }}
release: {{ .Release.Name }}
heritage: {{ .Release.Service }}
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ template "fullname" . }}
minReplicas: {{ .Values.hpa.minReplicas }}
maxReplicas: {{ .Values.hpa.maxReplicas }}
metrics:
{{ toYaml .Values.hpa.metrics | indent 4 }}
{{- end }}
10 changes: 8 additions & 2 deletions conf/charts/tf-serving/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ replicas: 0

image:
repository: vanvalenlab/kiosk-tf-serving
tag: latest
tag: 0.4.0
pullPolicy: IfNotPresent

configWriter:
Expand All @@ -16,7 +16,7 @@ configWriter:

image:
repository: vanvalenlab/kiosk-tf-serving-config-writer
tag: latest
tag: 0.4.0
pullPolicy: IfNotPresent

service:
Expand Down Expand Up @@ -55,6 +55,12 @@ tolerations: {}

affinity: {}

hpa:
enabled: false
minReplicas: 0
maxReplicas: 1
metrics: {}

env:
PORT: 8500
REST_API_PORT: 8501
Expand Down
16 changes: 15 additions & 1 deletion conf/helmfile.d/0310.tf-serving.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ releases:
vendor: vanvalenlab
default: true
chart: '{{ env "CHARTS_PATH" | default "/conf/charts" }}/tf-serving'
version: 0.3.0
version: 0.4.0
values:
- replicas: 0

Expand Down Expand Up @@ -77,6 +77,20 @@ releases:
prometheus.io/port: "8501"
prometheus.io/scrape: "true"

hpa:
enabled: true
minReplicas: 1
maxReplicas: {{ int (env "GPU_NODE_MAX_SIZE" | default 1) }}
metrics:
- type: Object
object:
metricName: tf_serving_gpu_usage
target:
apiVersion: v1
kind: Namespace
name: tf_serving_gpu_usage
targetValue: 70

annotations:
prometheus.io/path: /monitoring/prometheus/metrics
prometheus.io/port: "8501"
Expand Down

0 comments on commit 00bf58e

Please sign in to comment.