[WIP] Add tensorflow inception model to incubator (#165)

* initial commit

* update chart home

* add resource limits and readinessProbe
This commit is contained in:
Lachlan Evenson
2017-02-03 11:23:41 -08:00
committed by Vic Iglesias
parent 00e7aea7f0
commit 345b47c868
7 changed files with 233 additions and 0 deletions
@@ -0,0 +1,21 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
+10
View File
@@ -0,0 +1,10 @@
name: tensorflow-inception
home: https://github.com/kubernetes/charts
version: 0.1.0
description: A Helm chart for Kubernetes
sources:
- https://github.com/tensorflow/
- https://tensorflow.github.io/serving/serving_inception.html
maintainers:
- name: Lachlan Evenson
email: lachlan.evenson@gmail.com
+93
View File
@@ -0,0 +1,93 @@
# Tensorflow Inception Model Chart
TensorFlow is an open source software library for numerical computation using data flow graphs.
* https://www.tensorflow.org/
My hope was to make TensorFlow more accessible by simplifying the following document -- https://tensorflow.github.io/serving/serving_inception.html
## Chart Details
This chart will do the following:
* 1 x TensorFlow inception model server on an external LoadBalancer
## Installing the Chart
To install the chart with the release name `my-release`:
```bash
$ helm repo add incubator http://storage.googleapis.com/kubernetes-charts-incubator
$ helm install --name my-release incubator/tensorflow-inception
```
## Configuration
The following tables lists the configurable parameters of the TensorFlow inception chart and their default values.
| Parameter | Description | Default |
| ----------------------- | ---------------------------------- | ---------------------------------------------------------- |
| `Image` | Container image name | `quay.io/lachie83/inception_serving` |
| `ImageTag` | Container image tag | `latest` |
| `Replicas` | k8s deployment replicas | `1` |
| `Component` | k8s selector key | `tensorflow-inception` |
| `Cpu` | container requested cpu | `100m` |
| `Memory` | container requested memory | `512Mi` |
| `ServicePort` | k8s service port | `9090` |
| `ContainerPort` | Container listening port | `9090` |
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`.
Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,
```bash
$ helm install --name my-release -f values.yaml incubator/tensorflow-inception
```
> **Tip**: You can use the default [values.yaml](values.yaml)
## Example
```bash
docker run -v ~/Downloads:/downloads quay.io/lachie83/inception_serving /serving/bazel-bin/tensorflow_serving/example/inception_client --server=$INCEPTION_SERVICE_IP:9090 --image=/downloads/dog.jpg
D1028 17:07:30.650550118 7 ev_posix.c:101] Using polling engine: poll
outputs {
key: "classes"
value {
dtype: DT_STRING
tensor_shape {
dim {
size: 1
}
dim {
size: 5
}
}
string_val: "golden retriever"
string_val: "cocker spaniel, English cocker spaniel, cocker"
string_val: "clumber, clumber spaniel"
string_val: "tennis ball"
string_val: "Labrador retriever"
}
}
outputs {
key: "scores"
value {
dtype: DT_FLOAT
tensor_shape {
dim {
size: 1
}
dim {
size: 5
}
}
float_val: 9.7533788681
float_val: 6.67022132874
float_val: 6.18963956833
float_val: 5.90754127502
float_val: 5.4464302063
}
}
E1028 17:07:33.565394639 7 chttp2_transport.c:1810] close_transport: {"created":"@1477674453.565348591","description":"FD shutdown","file":"src/core/lib/iomgr/ev_poll_posix.c","file_line":427}
```
@@ -0,0 +1,9 @@
Getting Started:
1. Use the inception-client in a container to submit an image from a mounted volume on your system to the service by running these commands in the same shell:
**** NOTE: It may take a few minutes for the LoadBalancer IP to be available. ****
**** You can watch the status of by running 'kubectl get svc --namespace {{ .Release.Namespace }} -w {{ template "fullname" . }}' ****
export INCEPTION_SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo docker run -v ~/Downloads:/downloads quay.io/lachie83/inception_serving /serving/bazel-bin/tensorflow_serving/example/inception_client --server=$INCEPTION_SERVICE_IP:9090 --image=/downloads/dog.jpg
@@ -0,0 +1,16 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 24 -}}
{{- end -}}
{{/*
Create a fully qualified name.
We truncate at 24 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
*/}}
{{- define "fullname" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" .Release.Name $name | trunc 24 -}}
{{- end -}}
@@ -0,0 +1,64 @@
apiVersion: v1
kind: Service
metadata:
name: {{ template "fullname" . }}
labels:
heritage: {{.Release.Service | quote }}
release: {{.Release.Name | quote }}
chart: "{{.Chart.Name}}-{{.Chart.Version}}"
component: "{{.Release.Name}}-{{.Values.Component}}"
annotations:
"helm.sh/created": {{.Release.Time.Seconds | quote }}
spec:
ports:
- port: {{.Values.ServicePort}}
targetPort: {{.Values.ContainerPort}}
selector:
component: "{{.Release.Name}}-{{.Values.Component}}"
type: {{.Values.ServiceType}}
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: {{ template "fullname" . }}
labels:
heritage: {{.Release.Service | quote }}
release: {{.Release.Name | quote }}
chart: "{{.Chart.Name}}-{{.Chart.Version}}"
component: "{{.Release.Name}}-{{.Values.Component}}"
annotations:
"helm.sh/created": {{.Release.Time.Seconds | quote }}
spec:
replicas: {{ default 1 .Values.Replicas }}
strategy:
type: RollingUpdate
selector:
matchLabels:
component: "{{.Release.Name}}-{{.Values.Component}}"
template:
metadata:
labels:
heritage: {{.Release.Service | quote }}
release: {{.Release.Name | quote }}
chart: "{{.Chart.Name}}-{{.Chart.Version}}"
component: "{{.Release.Name}}-{{.Values.Component}}"
spec:
containers:
- name: {{ template "fullname" . }}
image: "{{.Values.Image}}:{{.Values.ImageTag}}"
imagePullPolicy: "{{.Values.ImagePullPolicy}}"
command:
- "/bin/sh"
- "-c"
args:
- "/serving/bazel-bin/tensorflow_serving/model_servers/tensorflow_model_server --port={{.Values.ContainerPort}} --model_name=inception --model_base_path=/serving/inception-export"
ports:
- containerPort: {{.Values.ContainerPort}}
readinessProbe:
tcpSocket:
port: {{.Values.ContainerPort}}
initialDelaySeconds: 15
timeoutSeconds: 1
resources:
{{ toYaml .Values.Resources | indent 12 }}
@@ -0,0 +1,20 @@
# Default values for tensorflow-inception.
# This is a YAML-formatted file.
# Declare name/value pairs to be passed into your templates.
# name: value
ServiceType: LoadBalancer
ServicePort: 9090
ContainerPort: 9090
Component: "tensorflow-inception"
Replicas: 1
Image: "quay.io/lachie83/inception_serving"
ImageTag: "latest"
ImagePullPolicy: "IfNotPresent"
Resources:
limits:
cpu: 100m
memory: 256Mi
requests:
cpu: 100m
memory: 256Mi