Helm Chart containing our common functions
To use a public docker image (on docker hub).
values.yaml
global:
huggingface:
imageRegistry: ""
imagePullSecrets: []
images:
pullPolicy: IfNotPresent
nginx:
useGlobalRegistry: false
repository: nginx
tag: "1.22"
_helpers.yaml
{{- define "nginx.image" -}}
{{ include "hf.common.images.image" (dict "imageRoot" .Values.images.nginx "global" .Values.global.huggingface) | quote }}
{{- end -}}
deployment.yaml
...
containers:
- name: ...
image: {{ include "nginx.image" . }}
...
The common function will generate : image: "nginx:1.22"
To use a public docker image (on docker hub).
values.yaml
global:
huggingface:
imageRegistry: ""
imagePullSecrets: []
images:
pullPolicy: IfNotPresent
admin:
registry: huggingface
useGlobalRegistry: false
repository: datasets-server
tag: sha-27ad2f7
_helpers.yaml
{{- define "admin.image" -}}
{{ include "hf.common.images.image" (dict "imageRoot" .Values.images.admin "global" .Values.global.huggingface) | quote }}
{{- end -}}
deployment.yaml
...
containers:
- name: ...
image: {{ include "admin.image" . }}
...
The common function will generate : image: "huggingface/datasets-server:sha-27ad2f7"
To use a docker image from a global private registry. A global registry is usefull to avoid duplicate your registry for all your images.
values.yaml
global:
huggingface:
imageRegistry: "my-registry.com"
imagePullSecrets: []
images:
pullPolicy: IfNotPresent
app:
repository: project/app
tag: 1.0.0
_helpers.yaml
{{- define "app.image" -}}
{{ include "hf.common.images.image" (dict "imageRoot" .Values.images.app "global" .Values.global.huggingface) | quote }}
{{- end -}}
deployment.yaml
...
containers:
- name: ...
image: {{ include "app.image" . }}
...
The common function will generate : image: "my-registry.com/project/app:1.0.0"
To use a docker image for a specific private private registry (not global).
values.yaml
global:
huggingface:
imageRegistry: "my-registry.com"
imagePullSecrets: []
images:
pullPolicy: IfNotPresent
app:
registry: my-other-registry.com
repository: project/app
tag: 1.0.0
_helpers.yaml
{{- define "app.image" -}}
{{ include "hf.common.images.image" (dict "imageRoot" .Values.images.app "global" .Values.global.huggingface) | quote }}
{{- end -}}
deployment.yaml
...
containers:
- name: ...
image: {{ include "app.image" . }}
...
The common function will generate : image: "my-other-registry.com/project/app:1.0.0"
If your registry is private, you will need an imagePullSecret to allow your cluster to pull the docker image. You can set it globally to avoid duplicate.
values.yaml
global:
huggingface:
imageRegistry: "my-registry.com"
imagePullSecrets: [myregcred]
images:
pullPolicy: IfNotPresent
app:
repository: project/app
tag: 1.0.0
_helpers.yaml
{{- define "app.image" -}}
{{ include "hf.common.images.image" (dict "imageRoot" .Values.images.app "global" .Values.global.huggingface) | quote }}
{{- end -}}
{{- define "app.imagePullSecrets" -}}
{{- include "hf.common.images.renderPullSecrets" (dict "images" (list .Values.images) "context" $) -}}
{{- end -}}
deployment.yaml
...
spec:
{{- include "app.imagePullSecrets" . | nindent 6 }}
containers:
- name: app
image: {{ include "app.image" . }}
imagePullPolicy: {{ .Values.images.pullPolicy }}
...
The common function will generate :
...
spec:
imagePullSecrets:
- name: regcred
containers:
- name: proxy
image: "my-registry.com/project/app:1.0.0"
imagePullPolicy: IfNotPresent
...
This charts is inspired from Bitnami common functions.
Copyright © 2023 HuggingFace
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.