Skip to content

Commit

Permalink
adding chart tensorflow-serving-0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
softwarerecipes committed Oct 18, 2024
1 parent faabcf5 commit bc28147
Show file tree
Hide file tree
Showing 10 changed files with 365 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/tensorflow-serving-0.1.0/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
15 changes: 15 additions & 0 deletions charts/tensorflow-serving-0.1.0/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v2
appVersion: 1.16.0
description: TensorFlow Serving is a flexible, high-performance serving system for
machine learning models, designed for production environments. TensorFlow Serving
makes it easy to deploy new algorithms and experiments, while keeping the same server
architecture and APIs. TensorFlow Serving provides out-of-the-box integration with
TensorFlow models, but can be easily extended to serve other types of models and
data.
maintainers:
- email: [email protected]
name: tylertitsworth
url: https://github.com/tylertitsworth
name: tensorflow-serving
type: application
version: 0.1.0
31 changes: 31 additions & 0 deletions charts/tensorflow-serving-0.1.0/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# tensorflow-serving

![Version: 0.1.0](https://img.shields.io/badge/Version-0.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.16.0](https://img.shields.io/badge/AppVersion-1.16.0-informational?style=flat-square)

TensorFlow Serving is a flexible, high-performance serving system for machine learning models, designed for production environments. TensorFlow Serving makes it easy to deploy new algorithms and experiments, while keeping the same server architecture and APIs. TensorFlow Serving provides out-of-the-box integration with TensorFlow models, but can be easily extended to serve other types of models and data.

## Maintainers

| Name | Email | Url |
| ---- | ------ | --- |
| tylertitsworth | <[email protected]> | <https://github.com/tylertitsworth> |

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| deploy.env | object | `{"configMapName":"intel-proxy-config","enabled":true}` | Add Environment mapping |
| deploy.image | string | `"intel/intel-extension-for-tensorflow:serving-gpu"` | Intel Extension for Tensorflow Serving image |
| deploy.modelName | string | `""` | Model Name |
| deploy.replicas | int | `1` | Number of pods |
| deploy.resources.limits | object | `{"cpu":"4000m","gpu.intel.com/i915":1,"memory":"1Gi"}` | Maximum resources per pod |
| deploy.resources.limits."gpu.intel.com/i915" | int | `1` | Intel GPU Device Configuration |
| deploy.resources.requests | object | `{"cpu":"1000m","memory":"512Mi"}` | Minimum resources per pod |
| deploy.storage.nfs | object | `{"enabled":false,"path":"nil","readOnly":true,"server":"nil"}` | Network File System (NFS) storage for models |
| fullnameOverride | string | `""` | Full qualified Domain Name |
| nameOverride | string | `""` | Name of the serving service |
| pvc.size | string | `"5Gi"` | Size of the storage |
| service.type | string | `"NodePort"` | Type of service |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.14.2](https://github.com/norwoodj/helm-docs/releases/v1.14.2)
19 changes: 19 additions & 0 deletions charts/tensorflow-serving-0.1.0/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
1. Get the application URL by running these commands:
{{- if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "tensorflow-serving.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch its status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "tensorflow-serving.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "tensorflow-serving.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "tensorflow-serving.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
{{- end }}
2. Make a prediction
curl http://$NODE_IP:$NODE_PORT/v1/models/{{ .Values.deploy.modelName }}
curl -X POST http://$NODE_IP:$NODE_PORT/v1/models/{{ .Values.deploy.modelName }}:predict -d '{"data": []}'
51 changes: 51 additions & 0 deletions charts/tensorflow-serving-0.1.0/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "tensorflow-serving.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "tensorflow-serving.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "tensorflow-serving.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "tensorflow-serving.labels" -}}
helm.sh/chart: {{ include "tensorflow-serving.chart" . }}
{{ include "tensorflow-serving.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "tensorflow-serving.selectorLabels" -}}
app.kubernetes.io/name: {{ include "tensorflow-serving.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
84 changes: 84 additions & 0 deletions charts/tensorflow-serving-0.1.0/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
# Copyright (c) 2024 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
{{- $name := .Values.deploy.modelName | required ".Values.deploy.modelName is required." -}}
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "tensorflow-serving.fullname" . }}
labels:
{{- include "tensorflow-serving.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.deploy.replicas }}
selector:
matchLabels:
{{- include "tensorflow-serving.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "tensorflow-serving.labels" . | nindent 8 }}
spec:
securityContext:
fsGroup: 1000
runAsUser: 1000
containers:
- name: tensorflow-serving
image: {{ .Values.deploy.image }}
{{- if eq .Values.deploy.env.enabled true }}
envFrom:
- configMapRef:
name: {{ .Values.deploy.env.configMapName }}
{{- end }}
env:
- name: MODEL_NAME
value: {{ .Values.deploy.modelName }}
ports:
- name: rest
containerPort: 8500
protocol: TCP
- name: grpc
containerPort: 8501
protocol: TCP
readinessProbe:
tcpSocket:
port: rest
initialDelay: 15
timeoutSeconds: 1
volumeMounts:
- mountPath: /dev/shm
name: dshm
{{- if .Values.deploy.storage.nfs.enabled }}
- name: model
mountPath: /models/{{ .Values.deploy.modelName }}
{{- else }}
- name: model
mountPath: /models/{{ .Values.deploy.modelName }}
{{- end }}
resources:
{{- toYaml .Values.deploy.resources | nindent 12 }}
volumes:
- name: dshm
emptyDir:
medium: Memory
{{- if .Values.deploy.storage.nfs.enabled }}
- name: model
nfs:
server: {{ .Values.deploy.storage.nfs.server }}
path: {{ .Values.deploy.storage.nfs.path }}
readOnly: {{ .Values.deploy.storage.nfs.readOnly }}
{{- else }}
- name: model
persistentVolumeClaim:
claimName: {{ include "tensorflow-serving.fullname" . }}-model-dir
{{- end }}
29 changes: 29 additions & 0 deletions charts/tensorflow-serving-0.1.0/templates/pvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright (c) 2024 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
{{- if not .Values.deploy.storage.nfs.enabled }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "tensorflow-serving.fullname" . }}-model-dir
labels:
{{- include "tensorflow-serving.labels" . | nindent 4 }}
spec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: {{ .Values.pvc.size }}
{{- end }}
31 changes: 31 additions & 0 deletions charts/tensorflow-serving-0.1.0/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright (c) 2024 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: v1
kind: Service
metadata:
name: {{ include "tensorflow-serving.fullname" . }}
labels:
{{- include "tensorflow-serving.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
- name: rest
port: 8500
targetPort: rest
- name: grpc
port: 8501
targetPort: grpc
selector:
{{- include "tensorflow-serving.selectorLabels" . | nindent 4 }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright (c) 2024 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: v1
kind: Pod
metadata:
name: "{{ include "tensorflow-serving.fullname" . }}-test-connection"
labels:
{{- include "tensorflow-serving.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": test
spec:
containers:
- name: info
image: curlimages/curl
command: ['sh', '-c']
args: ['curl -f {{ include "tensorflow-serving.fullname" . }}:8501/v1/models/{{ .Values.deploy.modelName}}']
restartPolicy: OnFailure
53 changes: 53 additions & 0 deletions charts/tensorflow-serving-0.1.0/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Copyright (c) 2024 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# -- Name of the serving service
nameOverride: ""
# -- Full qualified Domain Name
fullnameOverride: ""
deploy:
# -- Intel Extension for Tensorflow Serving image
image: intel/intel-extension-for-tensorflow:serving-gpu
# -- Add Environment mapping
env:
configMapName: intel-proxy-config
enabled: true
# -- Model Name
modelName: ""
# -- Number of pods
replicas: 1
resources:
# -- Maximum resources per pod
limits:
cpu: 4000m
memory: 1Gi
# -- Intel GPU Device Configuration
gpu.intel.com/i915: 1
# -- Minimum resources per pod
requests:
cpu: 1000m
memory: 512Mi
storage:
# -- Network File System (NFS) storage for models
nfs:
enabled: false
server: nil
path: nil
readOnly: true
service:
# -- Type of service
type: NodePort
pvc:
# -- Size of the storage
size: 5Gi

0 comments on commit bc28147

Please sign in to comment.