From ef5f8b3451331c48139fbfec16842806defd0418 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernd=20Sch=C3=B6rgers?= Date: Fri, 2 Oct 2020 14:39:38 +0200 Subject: [PATCH] [intel-gpu-plugin] New chart (#76) --- charts/intel-gpu-plugin/.helmignore | 23 ++++++ charts/intel-gpu-plugin/Chart.yaml | 17 +++++ charts/intel-gpu-plugin/README.md | 73 +++++++++++++++++++ .../intel-gpu-plugin/templates/_helpers.tpl | 62 ++++++++++++++++ .../intel-gpu-plugin/templates/daemonset.yaml | 71 ++++++++++++++++++ .../templates/serviceaccount.yaml | 12 +++ charts/intel-gpu-plugin/values.yaml | 50 +++++++++++++ 7 files changed, 308 insertions(+) create mode 100644 charts/intel-gpu-plugin/.helmignore create mode 100644 charts/intel-gpu-plugin/Chart.yaml create mode 100644 charts/intel-gpu-plugin/README.md create mode 100644 charts/intel-gpu-plugin/templates/_helpers.tpl create mode 100644 charts/intel-gpu-plugin/templates/daemonset.yaml create mode 100644 charts/intel-gpu-plugin/templates/serviceaccount.yaml create mode 100644 charts/intel-gpu-plugin/values.yaml diff --git a/charts/intel-gpu-plugin/.helmignore b/charts/intel-gpu-plugin/.helmignore new file mode 100644 index 00000000..0e8a0eb3 --- /dev/null +++ b/charts/intel-gpu-plugin/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/intel-gpu-plugin/Chart.yaml b/charts/intel-gpu-plugin/Chart.yaml new file mode 100644 index 00000000..7c3a799b --- /dev/null +++ b/charts/intel-gpu-plugin/Chart.yaml @@ -0,0 +1,17 @@ +apiVersion: v2 +name: intel-gpu-plugin +version: 1.0.0 +appVersion: 0.18.1 +description: The Intel GPU plugin facilitates offloading the processing of computation intensive workloads to GPU hardware +keywords: + - kubernetes + - cluster + - hardware + - gpu +home: https://github.com/k8s-at-home/charts/tree/master/charts/intel-gpu-plugin +icon: https://avatars0.githubusercontent.com/u/17888862?s=400&v=4 +sources: + - https://github.com/intel/intel-device-plugins-for-kubernetes/blob/master/cmd/gpu_plugin +maintainers: + - name: billimek + email: jeff@billimek.com diff --git a/charts/intel-gpu-plugin/README.md b/charts/intel-gpu-plugin/README.md new file mode 100644 index 00000000..86f1ef89 --- /dev/null +++ b/charts/intel-gpu-plugin/README.md @@ -0,0 +1,73 @@ +# intel-gpu-plugin helm chart + +This is a helm chart that will deploy [intel-gpu-plugin](https://github.com/intel/intel-device-plugins-for-kubernetes/blob/master/cmd/gpu_plugin) as a DaemonSet. + +The GPU plugin facilitates offloading the processing of computation intensive workloads to GPU hardware. + +## TL;DR + +```shell +helm repo add k8s-at-home https://k8s-at-home.com/charts/ +helm install k8s-at-home/intel-gpu-plugin +``` + +## Installing the Chart + +To install the chart with the release name `my-release`: + +```shell +helm install my-release k8s-at-home/intel-gpu-plugin +``` + +## Uninstalling the Chart + +To uninstall/delete the `my-release` deployment: + +```shell +helm delete my-release --purge +``` + +The command removes all the Kubernetes components associated with the chart and deletes the release. + +## Configuration + +The following tables lists the configurable parameters of the Sentry chart and their default values. +Read through the [values.yaml](https://github.com/k8s-at-home/charts/blob/master/charts/intel-gpu-plugin/values.yaml) file. It has several commented out suggested values. + +| Parameter | Description | Default | +| ------------------------------------------- | -------------------------------------------------------------------------------------------- | ----------------------------------------------------- | +| `image.repository` | Image repository | `intel/intel-gpu-plugin` | +| `image.tag` | Image tag. Possible values listed [here](https://hub.docker.com/r/intel/intel-gpu-plugin/tags). | `0.18.1` | +| `image.pullPolicy` | Image pull policy | `IfNotPresent` | +| `strategyType` | Specifies the strategy used to replace old Pods by new ones | `Recreate` | +| `podAnnotations` | Key-value pairs to add as pod annotations | `{}` | + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, + +```shell +helm install my-release \ + --set image.pullPolicy="Always" \ + k8s-at-home/intel-gpu-plugin +``` + +Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example, + +```shell +helm install my-release -f values.yaml k8s-at-home/intel-gpu-plugin +``` + +### Node Feature Discovery + +If your cluster runs [Node Feature Discovery](https://github.com/k8s-at-home/charts/blob/master/charts/node-feature-discovery), you can deploy the device plugin only on nodes with Intel GPU by specifying the desired `nodeSelector` or `affinity` in your values. For example (make sure to update to your exact feature label): + +```yaml +affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + - key: feature.node.kubernetes.io/pci-0300_8086.present + operator: In + values: + - "true" +``` diff --git a/charts/intel-gpu-plugin/templates/_helpers.tpl b/charts/intel-gpu-plugin/templates/_helpers.tpl new file mode 100644 index 00000000..dc8d9c7e --- /dev/null +++ b/charts/intel-gpu-plugin/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "intel-gpu-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 "intel-gpu-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 }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "intel-gpu-plugin.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "intel-gpu-plugin.labels" -}} +helm.sh/chart: {{ include "intel-gpu-plugin.chart" . }} +{{ include "intel-gpu-plugin.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "intel-gpu-plugin.selectorLabels" -}} +app.kubernetes.io/name: {{ include "intel-gpu-plugin.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "intel-gpu-plugin.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "intel-gpu-plugin.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/intel-gpu-plugin/templates/daemonset.yaml b/charts/intel-gpu-plugin/templates/daemonset.yaml new file mode 100644 index 00000000..7fd79ca4 --- /dev/null +++ b/charts/intel-gpu-plugin/templates/daemonset.yaml @@ -0,0 +1,71 @@ +--- +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: {{ include "intel-gpu-plugin.fullname" . }} + labels: + {{- include "intel-gpu-plugin.labels" . | nindent 4 }} +spec: + selector: + matchLabels: + {{- include "intel-gpu-plugin.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "intel-gpu-plugin.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "intel-gpu-plugin.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + env: + - name: NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + volumeMounts: + - name: devfs + mountPath: /dev/dri + readOnly: true + - name: sysfs + mountPath: /sys/class/drm + readOnly: true + - name: kubeletsockets + mountPath: /var/lib/kubelet/device-plugins + resources: + {{- toYaml .Values.resources | nindent 12 }} + volumes: + - name: devfs + hostPath: + path: /dev/dri + - name: sysfs + hostPath: + path: /sys/class/drm + - name: kubeletsockets + hostPath: + path: /var/lib/kubelet/device-plugins + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/intel-gpu-plugin/templates/serviceaccount.yaml b/charts/intel-gpu-plugin/templates/serviceaccount.yaml new file mode 100644 index 00000000..b6e2d795 --- /dev/null +++ b/charts/intel-gpu-plugin/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "intel-gpu-plugin.serviceAccountName" . }} + labels: + {{- include "intel-gpu-plugin.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/intel-gpu-plugin/values.yaml b/charts/intel-gpu-plugin/values.yaml new file mode 100644 index 00000000..b0a27245 --- /dev/null +++ b/charts/intel-gpu-plugin/values.yaml @@ -0,0 +1,50 @@ +# Default values for intel-gpu-plugin. + +image: + repository: intel/intel-gpu-plugin + pullPolicy: IfNotPresent + tag: 0.18.1 + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +nodeSelector: {} + +tolerations: [] + +affinity: {}