Skip to content

Commit

Permalink
[gh-pages] remove build-index.sh
Browse files Browse the repository at this point in the history
This patch removes the build-index.sh script
Also adds documentation on how to use the new script at `main` to update
the Helm charts and index.

Signed-off-by: Carlos Eduardo Arango Gutierrez <eduardoa@nvidia.com>
  • Loading branch information
ArangoGutierrez authored and elezar committed Jul 16, 2024
1 parent 7759bb8 commit af8b8d6
Show file tree
Hide file tree
Showing 15 changed files with 1,187 additions and 5 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# NVIDIA device plugin for Kubernetes

> gh-pages branch
This branch is automatically updated by GitHub actions.
To manually update, please use the scriptd located on the `main` or `release-*` branches.

Example:

```bash
VERSION=v0.15.0
DOWNLOAD_URL=<github release assets url>
# Update the Helm package index on the `gh-pages`
./hack/update-helm-index.sh --version {{ .VERSION }}
#Push the change to the `gh-pages` branch
git -C releases/{{ .VERSION }} remote set-url origin git@github.com:NVIDIA/k8s-device-plugin.git
git -C releases/{{ .VERSION }} push origin gh-pages
```
5 changes: 0 additions & 5 deletions build-index.sh

This file was deleted.

6 changes: 6 additions & 0 deletions deployments/helm/gpu-feature-discovery/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: node-feature-discovery
repository: https://kubernetes-sigs.github.io/node-feature-discovery/charts
version: 0.15.3
digest: sha256:3952c6739251eec92cf1af75bb0f70b3da2aadc4fe1baf990e56b67276157618
generated: "2024-03-16T10:02:24.553151+02:00"
14 changes: 14 additions & 0 deletions deployments/helm/gpu-feature-discovery/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v2
name: gpu-feature-discovery
type: application
description: A Helm chart for gpu-feature-discovery on Kubernetes
version: "0.15.0"
appVersion: "0.15.0"
kubeVersion: ">= 1.10.0-0"
home: https://github.com/NVIDIA/k8s-device-plugin
dependencies:
- name: node-feature-discovery
alias: nfd
version: "0.15.3"
condition: nfd.enabled,gfd.enabled
repository: https://kubernetes-sigs.github.io/node-feature-discovery/charts
Binary file not shown.
219 changes: 219 additions & 0 deletions deployments/helm/gpu-feature-discovery/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,219 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "nvidia-device-plugin.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "nvidia-device-plugin.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Allow the release namespace to be overridden for multi-namespace deployments in combined charts
*/}}
{{- define "nvidia-device-plugin.namespace" -}}
{{- if .Values.namespaceOverride -}}
{{- .Values.namespaceOverride -}}
{{- else -}}
{{- .Release.Namespace -}}
{{- end -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "nvidia-device-plugin.chart" -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- printf "%s-%s" $name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "nvidia-device-plugin.labels" -}}
helm.sh/chart: {{ include "nvidia-device-plugin.chart" . }}
{{ include "nvidia-device-plugin.templateLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Template labels
*/}}
{{- define "nvidia-device-plugin.templateLabels" -}}
app.kubernetes.io/name: {{ include "nvidia-device-plugin.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Values.selectorLabelsOverride }}
{{ toYaml .Values.selectorLabelsOverride }}
{{- end }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "nvidia-device-plugin.selectorLabels" -}}
{{- if .Values.selectorLabelsOverride -}}
{{ toYaml .Values.selectorLabelsOverride }}
{{- else -}}
{{ include "nvidia-device-plugin.templateLabels" . }}
{{- end }}
{{- end }}

{{/*
Full image name with tag
*/}}
{{- define "nvidia-device-plugin.fullimage" -}}
{{- $tag := printf "v%s" .Chart.AppVersion }}
{{- .Values.image.repository -}}:{{- .Values.image.tag | default $tag -}}
{{- end }}

{{/*
Security context for the plugin
*/}}
{{- define "nvidia-device-plugin.securityContext" -}}
{{- if ne (len .Values.securityContext) 0 -}}
{{ toYaml .Values.securityContext }}
{{- else if .Values.compatWithCPUManager -}}
privileged: true
{{- else if ne (include "nvidia-device-plugin.allPossibleMigStrategiesAreNone" .) "true" -}}
capabilities:
add:
- SYS_ADMIN
{{- else -}}
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
{{- end -}}
{{- end -}}

{{/*
Security context for GFD
*/}}
{{- define "gpu-feature-discovery.securityContext" -}}
{{- if ne (len .Values.gfd.securityContext) 0 -}}
{{ toYaml .Values.gfd.securityContext }}
{{- else if ne (include "nvidia-device-plugin.allPossibleMigStrategiesAreNone" .) "true" -}}
capabilities:
add:
- SYS_ADMIN
{{- else -}}
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
{{- end -}}
{{- end -}}

{{/*
Check if migStrategy (from all possible configurations) is "none"
*/}}
{{- define "nvidia-device-plugin.allPossibleMigStrategiesAreNone" -}}
{{- $result := true -}}
{{- if .Values.migStrategy -}}
{{- if ne .Values.migStrategy "none" -}}
{{- $result = false -}}
{{- end -}}
{{- else if ne (include "nvidia-device-plugin.configMapName" .) "true" -}}
{{- $result = false -}}
{{- else -}}
{{- range $name, $contents := $.Values.config.map -}}
{{- $config := $contents | fromYaml -}}
{{- if $config.flags -}}
{{- if ne $config.flags.migStrategy "none" -}}
{{- $result = false -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}
{{- $result -}}
{{- end }}

{{/*
Check if an explicit set of configs has been provided or not
*/}}
{{- define "nvidia-device-plugin.hasEmbeddedConfigMap" -}}
{{- $result := true -}}
{{- if empty .Values.config.map -}}
{{- $result = false -}}
{{- end -}}
{{- $result -}}
{{- end }}

{{/*
Check if there is a ConfigMap in use or not
*/}}
{{- define "nvidia-device-plugin.hasConfigMap" -}}
{{- $result := false -}}
{{- if ne (include "nvidia-device-plugin.configMapName" .) "" -}}
{{- $result = true -}}
{{- end -}}
{{- $result -}}
{{- end }}

{{/*
Get the name of the default configuration
*/}}
{{- define "nvidia-device-plugin.hasDefaultConfig" -}}
{{- $result := "false" -}}
{{- if .Values.config.default -}}
{{- $result = "true" -}}
{{- else if not (empty .Values.config.map) -}}
{{- if has "named" .Values.config.fallbackStrategies -}}
{{- if hasKey .Values.config.map "default" -}}
{{- $result = "true" -}}
{{- end -}}
{{- end -}}
{{- if has "single" .Values.config.fallbackStrategies -}}
{{- if eq (.Values.config.map | keys | len) 1 -}}
{{- $result = "true" -}}
{{- end -}}
{{- end -}}
{{- if has "empty" .Values.config.fallbackStrategies -}}
{{- $result = "true" -}}
{{- end -}}
{{- end -}}
{{- $result -}}
{{- end }}

{{/*
Get the name of the configmap to use
*/}}
{{- define "nvidia-device-plugin.configMapName" -}}
{{- $result := "" -}}
{{- if .Values.config.name -}}
{{- $result = .Values.config.name -}}
{{- else if not (empty .Values.config.map) -}}
{{- $result = printf "%s-%s" (include "nvidia-device-plugin.fullname" .) "configs" -}}
{{- end -}}
{{- $result -}}
{{- end -}}

{{/*
Pod annotations for the plugin and GFD
*/}}
{{- define "nvidia-device-plugin.podAnnotations" -}}
{{- $annotations := deepCopy .local.Values.podAnnotations -}}
{{- if not (hasKey $annotations "checksum/config") -}}
{{- if eq (include "nvidia-device-plugin.hasEmbeddedConfigMap" .root) "true" -}}
{{- $_ := set $annotations "checksum/config" (include (print $.root.Template.BasePath "/configmap.yml") .root | sha256sum) -}}
{{- end -}}
{{- end -}}
{{- toYaml $annotations }}
{{- end -}}
14 changes: 14 additions & 0 deletions deployments/helm/gpu-feature-discovery/templates/configmap.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{{- if eq (include "nvidia-device-plugin.hasEmbeddedConfigMap" .) "true" }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "nvidia-device-plugin.configMapName" . }}
namespace: {{ include "nvidia-device-plugin.namespace" . }}
labels:
{{- include "nvidia-device-plugin.labels" . | nindent 4 }}
data:
{{- range $name, $contents := $.Values.config.map }}
{{ $name }}: |-
{{ $contents | indent 4 }}
{{- end -}}
{{- end -}}
Loading

0 comments on commit af8b8d6

Please sign in to comment.