hí ộ
This commit is contained in:
6
templates/charts/generic-inference-service-v1/Chart.yaml
Normal file
6
templates/charts/generic-inference-service-v1/Chart.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
apiVersion: v2
|
||||
name: generic-inference-service
|
||||
description: HTTP inference runtime that downloads a pinned model during pod startup
|
||||
type: application
|
||||
version: 0.1.0
|
||||
appVersion: "1"
|
||||
@@ -0,0 +1,105 @@
|
||||
{{- $s := .Values.spec -}}
|
||||
{{- $p := .Values.platform -}}
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ $p.workloadName }}
|
||||
namespace: {{ $p.namespace }}
|
||||
labels:
|
||||
{{- toYaml $p.labels | nindent 4 }}
|
||||
annotations:
|
||||
{{- toYaml $p.annotations | nindent 4 }}
|
||||
spec:
|
||||
replicas: {{ $s.replicas }}
|
||||
progressDeadlineSeconds: {{ default 1800 (default (dict) $p.rollout).progressDeadlineSeconds }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- toYaml $p.selector | nindent 6 }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- toYaml $p.labels | nindent 8 }}
|
||||
annotations:
|
||||
{{- toYaml $p.annotations | nindent 8 }}
|
||||
spec:
|
||||
automountServiceAccountToken: false
|
||||
securityContext:
|
||||
runAsNonRoot: {{ if $s.runtime.runAsRoot }}false{{ else }}true{{ end }}
|
||||
fsGroup: 10001
|
||||
seccompProfile:
|
||||
type: RuntimeDefault
|
||||
{{- with (default (dict) $p.scheduling).nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with (default (dict) $p.scheduling).tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: model
|
||||
emptyDir: {}
|
||||
initContainers:
|
||||
- name: download-model
|
||||
image: {{ $p.modelDownload.fetchImage | quote }}
|
||||
command: ["python", "/app/model_fetcher.py"]
|
||||
env:
|
||||
- name: HF_REPO_ID
|
||||
value: {{ $s.resolvedModel.source.repoId | quote }}
|
||||
- name: HF_COMMIT
|
||||
value: {{ $s.resolvedModel.source.commit | quote }}
|
||||
- name: MODEL_MAX_BYTES
|
||||
value: {{ $p.modelDownload.maxBytes | quote }}
|
||||
- name: HF_HOME
|
||||
value: /tmp/huggingface
|
||||
{{- with $s.resolvedModel.credentialRef }}
|
||||
- name: HF_TOKEN
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ . | quote }}
|
||||
key: token
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: model
|
||||
mountPath: /models
|
||||
resources:
|
||||
{{- toYaml $p.modelDownload.resources | nindent 12 }}
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
capabilities:
|
||||
drop: [ALL]
|
||||
containers:
|
||||
- name: runtime
|
||||
image: {{ $s.runtime.resolvedImage | quote }}
|
||||
{{- with $s.runtime.command }}
|
||||
command:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- with $s.runtime.args }}
|
||||
args:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
ports:
|
||||
{{- toYaml $s.runtime.ports | nindent 12 }}
|
||||
env:
|
||||
- name: MODEL_PATH
|
||||
value: /models/model
|
||||
{{- range $name, $value := $s.env }}
|
||||
- name: {{ $name }}
|
||||
value: {{ $value | quote }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- name: model
|
||||
mountPath: /models
|
||||
readOnly: true
|
||||
resources:
|
||||
{{- toYaml $p.resources | nindent 12 }}
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
capabilities:
|
||||
drop: [ALL]
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: {{ $s.healthCheck.path | quote }}
|
||||
port: {{ $s.healthCheck.port }}
|
||||
initialDelaySeconds: {{ $s.healthCheck.initialDelaySeconds }}
|
||||
@@ -0,0 +1,22 @@
|
||||
{{- $s := .Values.spec -}}
|
||||
{{- $p := .Values.platform -}}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ $p.serviceName }}
|
||||
namespace: {{ $p.namespace }}
|
||||
labels:
|
||||
{{- toYaml $p.labels | nindent 4 }}
|
||||
annotations:
|
||||
{{- toYaml $p.annotations | nindent 4 }}
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
{{- toYaml $p.selector | nindent 4 }}
|
||||
ports:
|
||||
{{- range $s.runtime.ports }}
|
||||
- name: {{ .name }}
|
||||
port: {{ .containerPort }}
|
||||
targetPort: {{ .containerPort }}
|
||||
protocol: TCP
|
||||
{{- end }}
|
||||
12
templates/charts/generic-inference-service-v1/values.yaml
Normal file
12
templates/charts/generic-inference-service-v1/values.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
spec: {}
|
||||
platform:
|
||||
modelDownload:
|
||||
fetchImage: example/model-fetcher@sha256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
maxBytes: 20000000000
|
||||
resources:
|
||||
requests:
|
||||
cpu: 250m
|
||||
memory: 512Mi
|
||||
limits:
|
||||
cpu: "2"
|
||||
memory: 2Gi
|
||||
Reference in New Issue
Block a user