GitXplorerGitXplorer
h

helm-common

public
6 stars
1 forks
0 issues

Commits

List of commits on branch main.
Unverified
d3fc846cd69b18165aea1ba479b95e7b77ebccf9

doc: update

rrtrompier committed 2 years ago
Verified
2c5dad84683f386e176d7056edeffd4c4ef9595a

feat: push to public registry (#2)

rrtrompier committed 2 years ago
Verified
96a9ab03b01a56f1ff8be1d3c744ce574365b928

doc: improve

rrtrompier committed 2 years ago
Verified
5f73440fb0987cb84d6ea2f27601007d129fa49c

doc: remove badge version

rrtrompier committed 2 years ago
Verified
a2d37600412c4c6f08ff6e214256b30e6494adc5

feat: possibility to override image tag programmatically (#1)

ooOraph committed 2 years ago
Unverified
44d5eff8e9bb0dd2faa2f831f9d2e7d29b5399f0

fix: rename common functions

rrtrompier committed 2 years ago

README

The README file for this repository.

Hugging Face Common Helm Chart

Version License Tests

Helm Chart containing Hugging Face common functions

Usage

How to install

Add this chart to your chart dependencies.

apiVersion: v2
name: my-chart
description: Your Helm chart description
icon: https://huggingface.co/front/assets/huggingface_logo-noborder.svg
type: application
version: 1.0.0
appVersion: "latest"

dependencies:
  - name: common
    version: x.x.x
    repository: https://HUGGINGFACE_PRIVATE_REGISTRY/chartrepo/charts

or if your project is open-source :

apiVersion: v2
name: my-chart
description: Your Helm chart description
icon: https://huggingface.co/front/assets/huggingface_logo-noborder.svg
type: application
version: 1.0.0
appVersion: "latest"
dependencies:
    - name: common
      version: x.x.x
      repository: oci://ghcr.io/huggingface/helm-common

Docker images management

Use a public docker image

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"

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

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"

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

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"

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

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"

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

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
...

Labels management

Use the common function to generate your resource labels.

_helpers.yaml

{{- define "yourComp.selectorLabels" -}}
{{ include "hf.labels.commons" . }}
app.kubernetes.io/component: your-component-name
{{- end }}

deployment.yaml

apiVersion: apps/v1
kind: Deployment
metadata:
  labels: {{- include "yourComp.selectorLabels" . | nindent 4 }}

Credits

This charts is inspired from Bitnami common functions.

License

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.