Add intel-fpga-device-plugin to ansible playbook

Enable FPGA device plugin for Kubernetes on each worker
node where intelfpga=enabled label is assigned.

Change-Id: I8aa6cdb7608d3772b0fca0eadaae1f1feb017096
Story: 2006495
Task: 37330
Signed-off-by: Alex Kozyrev <alex.kozyrev@windriver.com>
This commit is contained in:
Alex Kozyrev 2019-10-31 15:49:41 -04:00
parent c3d53cfc04
commit 71c83dc476
3 changed files with 102 additions and 0 deletions

View File

@ -300,3 +300,4 @@ wipe_ceph_osds: false
k8s_plugins:
# intel-gpu-plugin: intelgpu=enabled
# intel-qat-plugin: intelqat=enabled
# intel-fpga-plugin: intelfpga=enabled

View File

@ -0,0 +1,8 @@
---
- name: Create Intel FPGA device plugin config file
template:
src: "intel-fpga-plugin.yaml.j2"
dest: /etc/kubernetes/intel-fpga-daemonset.yaml
- name: Activate Intel FPGA device plugin
command: "kubectl --kubeconfig=/etc/kubernetes/admin.conf apply -f /etc/kubernetes/intel-fpga-daemonset.yaml"

View File

@ -0,0 +1,93 @@
# Intel FPGA device plugin
# Based on:
# https://github.com/intel/intel-device-plugins-for-kubernetes/blob/master/deployments/fpga_plugin/fpga_plugin.yaml
# and
# https://github.com/intel/intel-device-plugins-for-kubernetes/blob/master/deployments/fpga_plugin/fpga_plugin_service_account.yaml
#
# The following modifications have been made:
# - A nodeSelector of 'intelfpga' has been added to ensure the fpga device plugin
# pods only run on appropriately labelled nodes.
# - The daemonset is modified to tolerate all NoSchedule taints
# - A initContainers clause has been removed. The intel-fpga-initcontainer,
# that reprogramm FPGA on a container's startup, only works with CRI-O.
apiVersion: v1
kind: ServiceAccount
metadata:
name: intel-fpga-plugin-controller
namespace: kube-system
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: node-getter
rules:
- apiGroups: [""]
resources: ["nodes"]
verbs: ["get"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: get-nodes
namespace: kube-system
subjects:
- kind: ServiceAccount
name: intel-fpga-plugin-controller
namespace: kube-system
roleRef:
kind: ClusterRole
name: node-getter
apiGroup: rbac.authorization.k8s.io
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: intel-fpga-plugin
namespace: kube-system
labels:
app: intel-fpga-plugin
spec:
selector:
matchLabels:
app: intel-fpga-plugin
template:
metadata:
labels:
app: intel-fpga-plugin
spec:
nodeSelector:
intelfpga: enabled
tolerations:
- operator: Exists
effect: NoSchedule
serviceAccountName: intel-fpga-plugin-controller
containers:
- name: intel-fpga-plugin
env:
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
image: "{{ docker_registry.url }}/starlingx/intel-fpga-plugin:master-distroless-stable-latest"
imagePullPolicy: IfNotPresent
securityContext:
readOnlyRootFilesystem: true
volumeMounts:
- name: devfs
mountPath: /dev
- name: sysfs
mountPath: /sys
- name: kubeletsockets
mountPath: /var/lib/kubelet/device-plugins
volumes:
- name: devfs
hostPath:
path: /dev
- name: sysfs
hostPath:
path: /sys
- name: kubeletsockets
hostPath:
path: /var/lib/kubelet/device-plugins