Skip to content

Commit

Permalink
Add pre-pull charts in vessl package. (#55)
Browse files Browse the repository at this point in the history
* Add pre-pull charts in vessl package.

* Add newline in files.

* Remove default registry.

* Change chart name

* Change chart value.

* Change chart dir name.

* Apply code review.

* Add eod.

* Change image pull policy to always.
  • Loading branch information
minmul117 authored Jul 24, 2024
1 parent 79b7956 commit 93f14c6
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 0 deletions.
3 changes: 3 additions & 0 deletions charts/vessl/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,6 @@ dependencies:
version: "4.9.0"
condition: prometheus-adapter.enabled
repository: https://prometheus-community.github.io/helm-charts
- name: image-prepull
version: "0.1.0"
condition: image-prepull.enabled
22 changes: 22 additions & 0 deletions charts/vessl/charts/image-prepull/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# 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
.vscode/
5 changes: 5 additions & 0 deletions charts/vessl/charts/image-prepull/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
name: image-prepull
description: A Helm chart for pre-pulling images
version: 0.1.0
type: application
11 changes: 11 additions & 0 deletions charts/vessl/charts/image-prepull/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{{/*
Truncate and clean image name for use in container names
*/}}

{{- define "imagePrepull.truncateImageName" -}}
{{- $parts := splitList "/" . -}}
{{- $name := last $parts -}}
{{- $truncated := trunc 40 $name -}}
{{- $cleaned := regexReplaceAll "[^a-zA-Z0-9-]" $truncated "-" -}}
{{- $cleaned | lower -}}
{{- end -}}
33 changes: 33 additions & 0 deletions charts/vessl/charts/image-prepull/templates/daemonset.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: {{ .Release.Name }}-image-prepull
spec:
selector:
matchLabels:
app: image-prepull
template:
metadata:
labels:
app: image-prepull
spec:
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
tolerations:
- key: nvidia.com/gpu
operator: Exists
initContainers:
{{- range .Values.images }}
{{- $imageName := .name }}
{{- range .tags }}
- name: pull-{{ include "imagePrepull.truncateImageName" $imageName }}-{{ . | replace ":" "-" | replace "." "-" }}
image: {{ $imageName }}:{{ . }}
command: ['sh', '-c', 'echo Image {{ $imageName }}:{{ . }} pulled']
imagePullPolicy: {{ $.Values.imagePullPolicy }}
{{- end }}
{{- end }}
containers:
- name: pause
image: k8s.gcr.io/pause:3.2
17 changes: 17 additions & 0 deletions charts/vessl/charts/image-prepull/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
images:
- name: vllm/vllm-openai
tags:
- v0.5.2
- v0.5.1
- v0.5.0
- v0.4.3
- v0.4.2
- name: ghcr.io/huggingface/text-generation-inference
tags:
- 2.1.1
- 2.1.0
- 2.0.4
- 2.0.3
- 2.0.2
imagePullPolicy: Always
nodeSelector: {}
2 changes: 2 additions & 0 deletions charts/vessl/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -450,3 +450,5 @@ prometheus-adapter:
name:
as: "gpu_util"
metricsQuery: sum(<<.Series>>{<<.LabelMatchers>>}) by (<<.GroupBy>>)
image-prepull:
enabled: false

0 comments on commit 93f14c6

Please sign in to comment.