Skip to content

Commit acf7d4f

Browse files
committed
doc: update
1 parent f4d5534 commit acf7d4f

1 file changed

Lines changed: 206 additions & 1 deletion

File tree

README.md

Lines changed: 206 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,212 @@ Helm Chart containing our common functions
88

99
## Usage
1010

11-
Coming soon ...
11+
### Docker images management
12+
13+
#### Use a public docker image
14+
15+
To use a public docker image (on docker hub).
16+
17+
**`values.yaml`**
18+
```yaml
19+
global:
20+
huggingface:
21+
imageRegistry: ""
22+
imagePullSecrets: []
23+
24+
images:
25+
pullPolicy: IfNotPresent
26+
nginx:
27+
useGlobalRegistry: false
28+
repository: nginx
29+
tag: "1.22"
30+
```
31+
32+
**`_helpers.yaml`**
33+
```yaml
34+
{{- define "nginx.image" -}}
35+
{{ include "hf.common.images.image" (dict "imageRoot" .Values.images.nginx "global" .Values.global.huggingface) | quote }}
36+
{{- end -}}
37+
```
38+
39+
**`deployment.yaml`**
40+
```yaml
41+
...
42+
containers:
43+
- name: ...
44+
image: {{ include "nginx.image" . }}
45+
...
46+
```
47+
The common function will generate : `image: "nginx:1.22"`
48+
49+
#### Use a public docker image on specific repository (docker hub)
50+
51+
To use a public docker image (on docker hub).
52+
53+
**`values.yaml`**
54+
```yaml
55+
global:
56+
huggingface:
57+
imageRegistry: ""
58+
imagePullSecrets: []
59+
60+
images:
61+
pullPolicy: IfNotPresent
62+
admin:
63+
registry: huggingface
64+
useGlobalRegistry: false
65+
repository: datasets-server
66+
tag: sha-27ad2f7
67+
```
68+
69+
**`_helpers.yaml`**
70+
```yaml
71+
{{- define "admin.image" -}}
72+
{{ include "hf.common.images.image" (dict "imageRoot" .Values.images.admin "global" .Values.global.huggingface) | quote }}
73+
{{- end -}}
74+
```
75+
76+
**`deployment.yaml`**
77+
```yaml
78+
...
79+
containers:
80+
- name: ...
81+
image: {{ include "admin.image" . }}
82+
...
83+
```
84+
85+
The common function will generate : `image: "huggingface/datasets-server:sha-27ad2f7"`
86+
87+
#### Use a docker image from private registry (with global registry)
88+
89+
To use a docker image from a global private registry.
90+
A global registry is usefull to avoid duplicate your registry for all your images.
91+
92+
**`values.yaml`**
93+
```yaml
94+
global:
95+
huggingface:
96+
imageRegistry: "my-registry.com"
97+
imagePullSecrets: []
98+
99+
images:
100+
pullPolicy: IfNotPresent
101+
app:
102+
repository: project/app
103+
tag: 1.0.0
104+
```
105+
106+
**`_helpers.yaml`**
107+
```yaml
108+
{{- define "app.image" -}}
109+
{{ include "hf.common.images.image" (dict "imageRoot" .Values.images.app "global" .Values.global.huggingface) | quote }}
110+
{{- end -}}
111+
```
112+
113+
**`deployment.yaml`**
114+
```yaml
115+
...
116+
containers:
117+
- name: ...
118+
image: {{ include "app.image" . }}
119+
...
120+
```
121+
122+
The common function will generate : `image: "my-registry.com/project/app:1.0.0"`
123+
124+
#### Use a docker image from private registry (without global registry)
125+
126+
To use a docker image for a specific private private registry (not global).
127+
128+
**`values.yaml`**
129+
```yaml
130+
global:
131+
huggingface:
132+
imageRegistry: "my-registry.com"
133+
imagePullSecrets: []
134+
135+
images:
136+
pullPolicy: IfNotPresent
137+
app:
138+
registry: my-other-registry.com
139+
repository: project/app
140+
tag: 1.0.0
141+
```
142+
143+
**`_helpers.yaml`**
144+
```yaml
145+
{{- define "app.image" -}}
146+
{{ include "hf.common.images.image" (dict "imageRoot" .Values.images.app "global" .Values.global.huggingface) | quote }}
147+
{{- end -}}
148+
```
149+
150+
**`deployment.yaml`**
151+
```yaml
152+
...
153+
containers:
154+
- name: ...
155+
image: {{ include "app.image" . }}
156+
...
157+
```
158+
159+
The common function will generate : `image: "my-other-registry.com/project/app:1.0.0"`
160+
161+
### Pull Secret management
162+
163+
If your registry is private, you will need an imagePullSecret to allow your cluster to pull the docker image.
164+
You can set it globally to avoid duplicate.
165+
166+
**`values.yaml`**
167+
```yaml
168+
global:
169+
huggingface:
170+
imageRegistry: "my-registry.com"
171+
imagePullSecrets: [myregcred]
172+
173+
images:
174+
pullPolicy: IfNotPresent
175+
app:
176+
repository: project/app
177+
tag: 1.0.0
178+
```
179+
180+
**`_helpers.yaml`**
181+
```yaml
182+
{{- define "app.image" -}}
183+
{{ include "hf.common.images.image" (dict "imageRoot" .Values.images.app "global" .Values.global.huggingface) | quote }}
184+
{{- end -}}
185+
186+
{{- define "app.imagePullSecrets" -}}
187+
{{- include "hf.common.images.renderPullSecrets" (dict "images" (list .Values.images) "context" $) -}}
188+
{{- end -}}
189+
```
190+
191+
**`deployment.yaml`**
192+
```yaml
193+
...
194+
spec:
195+
{{- include "app.imagePullSecrets" . | nindent 6 }}
196+
containers:
197+
- name: app
198+
image: {{ include "app.image" . }}
199+
imagePullPolicy: {{ .Values.images.pullPolicy }}
200+
...
201+
```
202+
203+
The common function will generate :
204+
205+
```yaml
206+
...
207+
spec:
208+
imagePullSecrets:
209+
- name: regcred
210+
containers:
211+
- name: proxy
212+
image: "my-registry.com/project/app:1.0.0"
213+
imagePullPolicy: IfNotPresent
214+
...
215+
```
216+
12217

13218
## Credits
14219

0 commit comments

Comments
 (0)