Skip to content

Commit

Permalink
doc: update
Browse files Browse the repository at this point in the history
  • Loading branch information
rtrompier committed Feb 23, 2023
1 parent f4d5534 commit acf7d4f
Showing 1 changed file with 206 additions and 1 deletion.
207 changes: 206 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,212 @@ Helm Chart containing our common functions

## Usage

Coming soon ...
### Docker images management

#### Use a public docker image

To use a public docker image (on docker hub).

**`values.yaml`**
```yaml
global:
huggingface:
imageRegistry: ""
imagePullSecrets: []

images:
pullPolicy: IfNotPresent
nginx:
useGlobalRegistry: false
repository: nginx
tag: "1.22"
```
**`_helpers.yaml`**
```yaml
{{- define "nginx.image" -}}
{{ include "hf.common.images.image" (dict "imageRoot" .Values.images.nginx "global" .Values.global.huggingface) | quote }}
{{- end -}}
```

**`deployment.yaml`**
```yaml
...
containers:
- name: ...
image: {{ include "nginx.image" . }}
...
```
The common function will generate : `image: "nginx:1.22"`

#### Use a public docker image on specific repository (docker hub)

To use a public docker image (on docker hub).

**`values.yaml`**
```yaml
global:
huggingface:
imageRegistry: ""
imagePullSecrets: []
images:
pullPolicy: IfNotPresent
admin:
registry: huggingface
useGlobalRegistry: false
repository: datasets-server
tag: sha-27ad2f7
```

**`_helpers.yaml`**
```yaml
{{- define "admin.image" -}}
{{ include "hf.common.images.image" (dict "imageRoot" .Values.images.admin "global" .Values.global.huggingface) | quote }}
{{- end -}}
```

**`deployment.yaml`**
```yaml
...
containers:
- name: ...
image: {{ include "admin.image" . }}
...
```

The common function will generate : `image: "huggingface/datasets-server:sha-27ad2f7"`

#### Use a docker image from private registry (with global registry)

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`**
```yaml
global:
huggingface:
imageRegistry: "my-registry.com"
imagePullSecrets: []
images:
pullPolicy: IfNotPresent
app:
repository: project/app
tag: 1.0.0
```

**`_helpers.yaml`**
```yaml
{{- define "app.image" -}}
{{ include "hf.common.images.image" (dict "imageRoot" .Values.images.app "global" .Values.global.huggingface) | quote }}
{{- end -}}
```

**`deployment.yaml`**
```yaml
...
containers:
- name: ...
image: {{ include "app.image" . }}
...
```

The common function will generate : `image: "my-registry.com/project/app:1.0.0"`

#### Use a docker image from private registry (without global registry)

To use a docker image for a specific private private registry (not global).

**`values.yaml`**
```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`**
```yaml
{{- define "app.image" -}}
{{ include "hf.common.images.image" (dict "imageRoot" .Values.images.app "global" .Values.global.huggingface) | quote }}
{{- end -}}
```

**`deployment.yaml`**
```yaml
...
containers:
- name: ...
image: {{ include "app.image" . }}
...
```

The common function will generate : `image: "my-other-registry.com/project/app:1.0.0"`

### Pull Secret management

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`**
```yaml
global:
huggingface:
imageRegistry: "my-registry.com"
imagePullSecrets: [myregcred]
images:
pullPolicy: IfNotPresent
app:
repository: project/app
tag: 1.0.0
```

**`_helpers.yaml`**
```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`**
```yaml
...
spec:
{{- include "app.imagePullSecrets" . | nindent 6 }}
containers:
- name: app
image: {{ include "app.image" . }}
imagePullPolicy: {{ .Values.images.pullPolicy }}
...
```

The common function will generate :

```yaml
...
spec:
imagePullSecrets:
- name: regcred
containers:
- name: proxy
image: "my-registry.com/project/app:1.0.0"
imagePullPolicy: IfNotPresent
...
```


## Credits

Expand Down

0 comments on commit acf7d4f

Please sign in to comment.