diff --git a/adaptant/index.yaml b/adaptant/index.yaml index 9c31816..8226197 100644 --- a/adaptant/index.yaml +++ b/adaptant/index.yaml @@ -5,7 +5,7 @@ entries: category: Analytics apiVersion: v2 appVersion: 0.0.1 - created: "2020-11-17T22:13:53.763107667+01:00" + created: "2020-11-17T22:30:13.888628943+01:00" description: Prometheus exporter for EdgeTPU metrics digest: 53b3dc0a7412c33fa98b76f09c1fa66c4bb8445e6c6bdadbe050f897fe928b85 icon: https://raw.githubusercontent.com/adaptant-labs/charts/master/adaptant/icon_adaptant_R.png @@ -27,7 +27,7 @@ entries: k8s-auto-labeller: - apiVersion: v2 appVersion: 0.0.1 - created: "2020-11-17T22:13:53.76389149+01:00" + created: "2020-11-17T22:30:13.889314703+01:00" description: Kubernetes controller for automated node label reconciliation digest: eb92f5b578f0230bec239b0add2384dfb36388ecc5e9cbf52a6eedc387d375e9 icon: https://raw.githubusercontent.com/adaptant-labs/charts/master/adaptant/icon_adaptant_R.png @@ -50,7 +50,7 @@ entries: k8s-dt-node-labeller: - apiVersion: v2 appVersion: 0.1.0 - created: "2020-11-17T22:13:53.764481231+01:00" + created: "2020-11-17T22:30:13.890021921+01:00" description: Devicetree node labeller for Kubernetes digest: 7badf418fba846ef073c44d544259866f98a44d9cf4755b3739f1edc12accdca icon: https://raw.githubusercontent.com/adaptant-labs/charts/master/adaptant/icon_adaptant_R.png @@ -73,7 +73,7 @@ entries: k8s-node-label-monitor: - apiVersion: v2 appVersion: 0.1.0 - created: "2020-11-17T22:13:53.765129439+01:00" + created: "2020-11-17T22:30:13.890858309+01:00" description: Kubernetes node label monitor digest: 262bd90517d5377785b3fb4ed8eedc05b29133ef7d7b5524ae421c48b64c8c95 icon: https://raw.githubusercontent.com/adaptant-labs/charts/master/adaptant/icon_adaptant_R.png @@ -93,4 +93,30 @@ entries: urls: - https://adaptant-labs.github.io/charts/adaptant/k8s-node-label-monitor-0.1.0.tgz version: 0.1.0 -generated: "2020-11-17T22:13:53.761661819+01:00" + ncs2-device-plugin: + - apiVersion: v2 + appVersion: 0.1.0 + created: "2020-11-17T22:30:13.892691984+01:00" + description: Intel NCS2 device plugin for Kubernetes + digest: 23a32dc568f41ac3ba13acc211c7f3d64d04e6cc9cddc78911895ef40b6fbd53 + icon: https://raw.githubusercontent.com/adaptant-labs/charts/master/adaptant/icon_adaptant_R.png + keywords: + - kubernetes + - kubernetes-device-plugins + - kubernetes-labels + - kubernetes-nodes + - ncs2 + - myriad + - movidius + - movidius-vpu + maintainers: + - email: labs@adaptant.io + name: Adaptant Labs + name: ncs2-device-plugin + sources: + - https://github.com/adaptant-labs/ncs2-device-plugin + type: application + urls: + - https://adaptant-labs.github.io/charts/adaptant/ncs2-device-plugin-0.1.0.tgz + version: 0.1.0 +generated: "2020-11-17T22:30:13.887556374+01:00" diff --git a/adaptant/ncs2-device-plugin-0.1.0.tgz b/adaptant/ncs2-device-plugin-0.1.0.tgz new file mode 100644 index 0000000..c8940ca Binary files /dev/null and b/adaptant/ncs2-device-plugin-0.1.0.tgz differ diff --git a/charts/ncs2-device-plugin/.helmignore b/charts/ncs2-device-plugin/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/ncs2-device-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/ncs2-device-plugin/Chart.yaml b/charts/ncs2-device-plugin/Chart.yaml new file mode 100644 index 0000000..a5a3734 --- /dev/null +++ b/charts/ncs2-device-plugin/Chart.yaml @@ -0,0 +1,21 @@ +apiVersion: v2 +name: ncs2-device-plugin +description: Intel NCS2 device plugin for Kubernetes +type: application +version: 0.1.0 +appVersion: 0.1.0 +keywords: + - kubernetes + - kubernetes-device-plugins + - kubernetes-labels + - kubernetes-nodes + - ncs2 + - myriad + - movidius + - movidius-vpu +icon: https://raw.githubusercontent.com/adaptant-labs/charts/master/adaptant/icon_adaptant_R.png +sources: + - https://github.com/adaptant-labs/ncs2-device-plugin +maintainers: + - name: Adaptant Labs + email: labs@adaptant.io diff --git a/charts/ncs2-device-plugin/templates/_helpers.tpl b/charts/ncs2-device-plugin/templates/_helpers.tpl new file mode 100644 index 0000000..1a8348f --- /dev/null +++ b/charts/ncs2-device-plugin/templates/_helpers.tpl @@ -0,0 +1,63 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "ncs2-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 "ncs2-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 }} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "ncs2-device-plugin.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "ncs2-device-plugin.labels" -}} +helm.sh/chart: {{ include "ncs2-device-plugin.chart" . }} +{{ include "ncs2-device-plugin.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "ncs2-device-plugin.selectorLabels" -}} +app.kubernetes.io/name: {{ include "ncs2-device-plugin.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "ncs2-device-plugin.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "ncs2-device-plugin.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/ncs2-device-plugin/templates/clusterrole.yaml b/charts/ncs2-device-plugin/templates/clusterrole.yaml new file mode 100644 index 0000000..a1ced7d --- /dev/null +++ b/charts/ncs2-device-plugin/templates/clusterrole.yaml @@ -0,0 +1,10 @@ +{{- if .Values.rbac.create -}} +kind: ClusterRole +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: system:{{ include "ncs2-device-plugin.serviceAccountName" . }} +rules: +- apiGroups: [""] + resources: ["nodes"] + verbs: ["list", "patch", "update", "get"] +{{- end -}} diff --git a/charts/ncs2-device-plugin/templates/clusterrolebinding.yaml b/charts/ncs2-device-plugin/templates/clusterrolebinding.yaml new file mode 100644 index 0000000..056c7b7 --- /dev/null +++ b/charts/ncs2-device-plugin/templates/clusterrolebinding.yaml @@ -0,0 +1,14 @@ +{{- if .Values.rbac.create -}} +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: system:{{ include "ncs2-device-plugin.serviceAccountName" . }} +subjects: + - kind: ServiceAccount + name: {{ include "ncs2-device-plugin.serviceAccountName" . }} + namespace: {{ .Values.serviceAccount.namespace }} +roleRef: + kind: ClusterRole + name: system:{{ include "ncs2-device-plugin.serviceAccountName" . }} + apiGroup: rbac.authorization.k8s.io +{{- end -}} diff --git a/charts/ncs2-device-plugin/templates/daemonset.yaml b/charts/ncs2-device-plugin/templates/daemonset.yaml new file mode 100644 index 0000000..75dfd6b --- /dev/null +++ b/charts/ncs2-device-plugin/templates/daemonset.yaml @@ -0,0 +1,55 @@ +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: {{ include "ncs2-device-plugin.fullname" . }} + labels: + {{- include "ncs2-device-plugin.labels" . | nindent 4 }} + namespace: {{ .Values.serviceAccount.namespace }} +spec: + selector: + matchLabels: + {{- include "ncs2-device-plugin.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "ncs2-device-plugin.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "ncs2-device-plugin.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + volumes: + {{- toYaml .Values.volumes | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + volumeMounts: + {{- toYaml .Values.podVolumeMounts | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- with .Values.podEnv }} + env: + {{- toYaml . | nindent 12 }} + {{- end }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- 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/ncs2-device-plugin/templates/serviceaccount.yaml b/charts/ncs2-device-plugin/templates/serviceaccount.yaml new file mode 100644 index 0000000..5cb8d69 --- /dev/null +++ b/charts/ncs2-device-plugin/templates/serviceaccount.yaml @@ -0,0 +1,15 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "ncs2-device-plugin.serviceAccountName" . }} + {{- if .Values.serviceAccount.namespace }} + namespace: {{ .Values.serviceAccount.namespace }} + {{- end }} + labels: + {{- include "ncs2-device-plugin.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/ncs2-device-plugin/values.yaml b/charts/ncs2-device-plugin/values.yaml new file mode 100644 index 0000000..3a62ebb --- /dev/null +++ b/charts/ncs2-device-plugin/values.yaml @@ -0,0 +1,68 @@ +image: + registry: docker.io + repository: adaptant/ncs2-device-plugin + pullPolicy: IfNotPresent + tag: 0.1.0 + +imagePullSecrets: [] +nameOverride: "ncs2-device-plugin" +fullnameOverride: "ncs2-device-plugin" + +labels: + addonmanager.kubernetes.io/mode: Reconcile + +serviceAccount: + create: true + annotations: {} + name: "ncs2-device-plugin" + namespace: kube-system + +volumes: + # pyudev depends on udev events being passed through from the host + - name: host-udev + hostPath: + path: "/run/udev" + +podAnnotations: {} + +podSecurityContext: {} + +securityContext: {} + +podEnv: + - name: NODE_NAME + valueFrom: + fieldRef: + fieldPath: spec.nodeName + +podVolumeMounts: + - name: host-udev + mountPath: "/run/udev" + +resources: {} + +autoscaling: + enabled: false + +nodeSelector: {} + +tolerations: [] + +affinity: + nodeAffinity: + requiredDuringSchedulingIgnoredDuringExecution: + nodeSelectorTerms: + - matchExpressions: + # k8s-auto-labeller + - key: accelerators/ncs2 + operator: Exists + - matchExpressions: + # USB-attached NCS2 (using NFD discovery) + - key: feature.node.kubernetes.io/usb-ff_03e7_2485.present + operator: In + values: + - "true" + +# Install default RBAC roles and bindings +rbac: + create: true