Skip to content

Commit c923b71

Browse files
authored
Merge pull request #414 from rojkov/fpga-plugin-kustomize
fpga: finalize plugin kustomization
2 parents 4ff8fca + e87d94d commit c923b71

24 files changed

+239
-424
lines changed

cmd/fpga_admissionwebhook/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ mutatingwebhookconfiguration.admissionregistration.k8s.io/intelfpgawebhook-mutat
9898
clusterrole.rbac.authorization.k8s.io/intelfpgawebhook-manager-role created
9999
clusterrolebinding.rbac.authorization.k8s.io/intelfpgawebhook-manager-rolebinding created
100100
service/intelfpgawebhook-webhook-service created
101-
deployment.apps/intelfpgawebhook-controller-manager created
101+
deployment.apps/intelfpgawebhook-webhook created
102102
certificate.cert-manager.io/intelfpgawebhook-serving-cert created
103103
issuer.cert-manager.io/intelfpgawebhook-selfsigned-issuer created
104104
```

cmd/fpga_plugin/README.md

Lines changed: 64 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,12 @@
1111
* [Getting the source code](#getting-the-source-code)
1212
* [Verify node kubelet config](#verify-node-kubelet-config)
1313
* [Deploying as a DaemonSet](#deploying-as-a-daemonset)
14-
* [Create a service account](#create-a-service-account)
15-
* [Deploying `region` mode](#deploying-region-mode)
16-
* [Deploying `af` mode](#deploying-af-mode)
17-
* [Deploy the DaemonSet](#deploy-the-daemonset)
1814
* [Verify plugin registration](#verify-plugin-registration)
1915
* [Building the plugin image](#building-the-plugin-image)
2016
* [Deploy by hand](#deploy-by-hand)
2117
* [Build FPGA device plugin](#build-fpga-device-plugin)
2218
* [Run FPGA device plugin in af mode](#run-fpga-device-plugin-in-af-mode)
2319
* [Run FPGA device plugin in region mode](#run-fpga-device-plugin-in-region-mode)
24-
* [Next steps](#next-steps)
2520

2621
# Introduction
2722

@@ -177,82 +172,83 @@ $ ls /var/lib/kubelet/device-plugins/kubelet.sock
177172

178173
## Deploying as a DaemonSet
179174

180-
You can deploy the plugin in either of the modes, using the
181-
[DaemonSet YAML](../../deployments/fpga_plugin/fpga_plugin.yaml)
182-
supplied. Details are in the following sections. Actions common to both deployment modes are detailed
183-
first. Mode specific actions are then detailed.
175+
As a pre-requisite you need to have [cert-manager](https://cert-manager.io)
176+
up and running:
184177

185-
If you intend to deploy your own image, you will need to reference the
186-
[image build section](#build-the-plugin-image) first.
187-
188-
If you do not want to deploy the `devel` tagged image, you will need to edit the
189-
YAML deployment files to reference your required image.
190-
191-
### For beta testing: new deployment model
192-
193-
The FPGA plugin deployment is currently being rewritten to enable
194-
straight-forward deployment of both `af` and
195-
`region` modes. The deployment has two steps:
178+
```bash
179+
$ kubectl apply --validate=false -f https://github.com/jetstack/cert-manager/releases/download/v0.15.1/cert-manager.yaml
180+
$ kubectl get pods -n cert-manager
181+
NAME READY STATUS RESTARTS AGE
182+
cert-manager-7747db9d88-bd2nl 1/1 Running 0 1m
183+
cert-manager-cainjector-87c85c6ff-59sb5 1/1 Running 0 1m
184+
cert-manager-webhook-64dc9fff44-29cfc 1/1 Running 0 1m
196185

197-
1. Run `scripts/fpga-plugin-prepare-for-kustomization.sh`. This will
198-
create the necessary secrets: a key and a signed certificate for
199-
the FPGA admission controller.
186+
```
200187

201-
2. Depending on the FPGA mode, run either
202-
```bash
203-
$ kubectl create -k deployments/fpga_plugin/overlays/af
204-
```
205-
or
206-
```bash
207-
$ kubectl create -k deployments/fpga_plugin/overlays/region
208-
```
209-
This will create the service account and deploy
210-
both the FPGA plugin and the admission controller in the chosen mode.
188+
Depending on the FPGA mode, run either
189+
```bash
190+
$ kubectl apply -k https://github.com/intel/intel-device-plugins-for-kubernetes/deployments/fpga_plugin/overlays/af
191+
namespace/intelfpgaplugin-system created
192+
customresourcedefinition.apiextensions.k8s.io/acceleratorfunctions.fpga.intel.com created
193+
customresourcedefinition.apiextensions.k8s.io/fpgaregions.fpga.intel.com created
194+
mutatingwebhookconfiguration.admissionregistration.k8s.io/intelfpgaplugin-mutating-webhook-configuration created
195+
clusterrole.rbac.authorization.k8s.io/intelfpgaplugin-manager-role created
196+
clusterrole.rbac.authorization.k8s.io/intelfpgaplugin-node-getter created
197+
clusterrolebinding.rbac.authorization.k8s.io/intelfpgaplugin-get-nodes created
198+
clusterrolebinding.rbac.authorization.k8s.io/intelfpgaplugin-manager-rolebinding created
199+
service/intelfpgaplugin-webhook-service created
200+
deployment.apps/intelfpgaplugin-webhook created
201+
daemonset.apps/intelfpgaplugin-fpgadeviceplugin created
202+
certificate.cert-manager.io/intelfpgaplugin-serving-cert created
203+
issuer.cert-manager.io/intelfpgaplugin-selfsigned-issuer created
204+
```
205+
or
206+
```bash
207+
$ kubectl apply -k https://github.com/intel/intel-device-plugins-for-kubernetes/deployments/fpga_plugin/overlays/region
208+
namespace/intelfpgaplugin-system created
209+
customresourcedefinition.apiextensions.k8s.io/acceleratorfunctions.fpga.intel.com created
210+
customresourcedefinition.apiextensions.k8s.io/fpgaregions.fpga.intel.com created
211+
mutatingwebhookconfiguration.admissionregistration.k8s.io/intelfpgaplugin-mutating-webhook-configuration created
212+
clusterrole.rbac.authorization.k8s.io/intelfpgaplugin-manager-role created
213+
clusterrole.rbac.authorization.k8s.io/intelfpgaplugin-node-getter created
214+
clusterrolebinding.rbac.authorization.k8s.io/intelfpgaplugin-get-nodes created
215+
clusterrolebinding.rbac.authorization.k8s.io/intelfpgaplugin-manager-rolebinding created
216+
service/intelfpgaplugin-webhook-service created
217+
deployment.apps/intelfpgaplugin-webhook created
218+
daemonset.apps/intelfpgaplugin-fpgadeviceplugin created
219+
certificate.cert-manager.io/intelfpgaplugin-serving-cert created
220+
issuer.cert-manager.io/intelfpgaplugin-selfsigned-issuer created
221+
```
222+
The command should result in two pods running:
223+
```bash
224+
$ kubectl get pods -n intelfpgaplugin-system
225+
NAME READY STATUS RESTARTS AGE
226+
intelfpgaplugin-fpgadeviceplugin-skcw5 1/1 Running 0 57s
227+
intelfpgaplugin-webhook-7d6bcb8b57-k52b9 1/1 Running 0 57s
228+
```
211229

212-
This deployment model is under development. The remaining part of this
213-
document goes through the current deployment model: here for the
214-
FPGA plugin and in the next document for the FPGA admission controller.
230+
If you intend to deploy your own image, you will need to reference the
231+
[image build section](#build-the-plugin-image) first.
215232

216-
### Create a service account
233+
If you do not want to deploy the `devel` or release tagged image, you will need to create your
234+
own kustomization overlay referencing your required image.
217235

218-
To deploy the plugin in a production cluster, create a service account
219-
for the plugin:
236+
If you need the FPGA plugin on some nodes to operate in a different mode then add this
237+
annotation to the nodes:
220238

221239
```bash
222-
$ kubectl create -f deployments/fpga_plugin/fpga_plugin_service_account.yaml
223-
serviceaccount/intel-fpga-plugin-controller created
224-
clusterrole.rbac.authorization.k8s.io/node-getter created
225-
clusterrolebinding.rbac.authorization.k8s.io/get-nodes created
240+
$ kubectl annotate node <node_name> 'fpga.intel.com/device-plugin-mode=region'
226241
```
227-
228-
### Deploying `region` mode
229-
230-
To deploy the FPGA plugin DaemonSet in `region` mode, you need to set the plugin
231-
mode annotation on all of your nodes, otherwise the FPGA plugin will run in its default
232-
`af` mode.
233-
242+
or
234243
```bash
235-
$ kubectl annotate node --all 'fpga.intel.com/device-plugin-mode=region'
244+
$ kubectl annotate node <node_name> 'fpga.intel.com/device-plugin-mode=af'
236245
```
246+
And restart the pods on the nodes.
237247

238-
### Deploying `af` mode
239-
240-
To deploy the FPGA plugin DaemonSet in `af` mode, you do not need to set the mode annotation on
241-
your nodes, as the FPGA plugin runs in `af` mode by default.
242-
243-
> **Note:** The FPGA plugin [DaemonSet YAML](../../deployments/fpga_plugin/fpga_plugin.yaml)
248+
> **Note:** The FPGA plugin [DaemonSet YAML](../../deployments/fpga_plugin/base/intel-fpga-plugin-daemonset.yaml)
244249
> also deploys the [FPGA CRI-O hook](../fpga_criohook) `initcontainer` image, but it will be
245250
> benign (un-used) when running the FPGA plugin in `af` mode.
246251
247-
### Deploy the DaemonSet
248-
249-
You can then use the example DaemonSet YAML file provided to deploy the plugin.
250-
251-
```bash
252-
$ kubectl create -f deployments/fpga_plugin/fpga_plugin.yaml
253-
daemonset.apps/intel-fpga-plugin created
254-
```
255-
256252
### Verify plugin registration
257253

258254
Verify the FPGA plugin has been deployed on the nodes. The below shows the output
@@ -288,8 +284,8 @@ Successfully tagged intel/intel-fpga-plugin:devel
288284

289285
This image launches `fpga_plugin` in `af` mode by default.
290286

291-
To use your own container image, modify the
292-
[`deployments/fpga_plugin/fpga_plugin.yaml`](../../deployments/fpga_plugin/fpga_plugin.yaml)
287+
To use your own container image, create you own kustomization overlay patching
288+
[`deployments/fpga_plugin/base/intel-fpga-plugin-daemonset.yaml`](../../deployments/fpga_plugin/base/intel-fpga-plugin-daemonset.yaml)
293289
file.
294290

295291
## Deploy by hand
@@ -337,6 +333,3 @@ FPGA device plugin started in region mode
337333
device-plugin start server at: /var/lib/kubelet/device-plugins/fpga.intel.com-region-ce48969398f05f33946d560708be108a.sock
338334
device-plugin registered
339335
```
340-
# Next steps
341-
342-
Continue installation with the [FPGA admission controller webhook](../fpga_admissionwebhook/README.md).

demo/screencast-fpga-orchestrated.sh

Lines changed: 21 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,12 @@ cleanup()
3939
out 'Cleanup demo artifacts' 20
4040
out 'delete test pod:' 20
4141
command 'kubectl delete pod test-fpga-region || true' 20
42-
out 'delete ServiceAccount:' 20
43-
command 'kubectl delete ServiceAccount intel-fpga-plugin-controller --namespace kube-system || true' 20
44-
out 'delete ClusterRole:' 20
45-
command 'kubectl delete ClusterRole node-getter --namespace kube-system || true' 20
46-
out 'delete ClusterRoleBinding:' 20
47-
command 'kubectl delete ClusterRoleBinding get-nodes --namespace kube-system || true' 20
42+
out 'delete mappings' 20
43+
command 'kubectl delete -f plugins/deployments/fpga_admissionwebhook/mappings-collection.yaml || true' 200
44+
out 'delete namespace and all the objects in the intelfpgaplugin-system namespace:' 20
45+
command 'kubectl delete namespace intelfpgaplugin-system || true' 20
4846
out 'delete node annotation:' 20
4947
command 'kubectl annotate node --all fpga.intel.com/device-plugin-mode- || true' 20
50-
out 'delete plugin daemonset:' 20
51-
command 'kubectl delete daemonset intel-fpga-plugin --namespace kube-system || true' 20
52-
out 'delete webhook deployment:' 20
53-
command 'kubectl delete deployment intel-fpga-webhook-deployment || true' 20
5448
}
5549

5650
record()
@@ -83,26 +77,11 @@ screen2()
8377
}
8478

8579
screen3()
86-
{
87-
clear
88-
cd $GOPATH/src/github.com/intel/intel-device-plugins-for-kubernetes
89-
out '3. Deploy admission controller webhook'
90-
command 'kubectl apply -k deployments/fpga_admissionwebhook/default'
91-
sleep 2
92-
out 'Check if its pod is running:'
93-
command 'kubectl get pods -n intelfpgawebhook-system'
94-
out 'Deploy the mappings:'
95-
command 'kubectl apply -f deployments/fpga_admissionwebhook/mappings-collection.yaml'
96-
out 'Check pod logs:'
97-
command "kubectl logs $(kubectl get pods -n intelfpgawebhook-system| grep intelfpgawebhook-controller-manager | awk '{print $1}') -n intelfpgawebhook-system"
98-
}
99-
100-
screen4()
10180
{
10281
clear
10382
cd /srv/demo
10483
sudo rm -rf /srv/intel.com/fpga/Arria10.dcp1.2 /srv/intel.com/fpga/69528db6eb31577a8c3668f9faa081f6
105-
out '4. Create bistream storage'
84+
out '3. Create bistream storage'
10685
out 'Create directory for Arria10.dcp1.2 interface id:'
10786
command 'sudo mkdir -p /srv/intel.com/fpga/69528db6eb31577a8c3668f9faa081f6'
10887
out 'Create Arria10.dcp1.2 symlink for convenience:'
@@ -116,30 +95,30 @@ screen4()
11695
command 'ls -la /srv/intel.com/fpga/Arria10.dcp1.2/'
11796
}
11897

119-
screen5()
98+
screen4()
12099
{
121100
clear
122101
cd $GOPATH/src/github.com/intel/intel-device-plugins-for-kubernetes
123-
out '5. Deploy FPGA plugin'
124-
out 'Create a service account for the plugin'
125-
command 'kubectl create -f deployments/fpga_plugin/fpga_plugin_service_account.yaml'
126-
out 'Set region mode for the plugin:'
127-
command "kubectl annotate node --all 'fpga.intel.com/device-plugin-mode=region'"
128-
out 'Create plugin daemonset:'
129-
command 'kubectl create -f deployments/fpga_plugin/fpga_plugin.yaml'
130-
out 'Check if its pod is runnning:'
131-
command 'kubectl get pod --namespace kube-system |grep intel-fpga-plugin'
132-
out 'Check if it runs in 'region' mode:'
133-
command "kubectl logs $(kubectl get pods --namespace kube-system |grep intel-fpga-plugin|cut -f1 -d' ') --namespace kube-system"
102+
out '4. Deploy FPGA plugin'
103+
command 'kubectl apply -k deployments/fpga_plugin/overlays/region'
104+
sleep 2
105+
out 'Check if its pods are running:'
106+
command 'kubectl get pods -n intelfpgaplugin-system'
107+
out 'Deploy the mappings:'
108+
command 'kubectl apply -f deployments/fpga_admissionwebhook/mappings-collection.yaml'
109+
out 'Check webhook pod logs:'
110+
command "kubectl logs $(kubectl get pods -n intelfpgaplugin-system| grep intelfpgaplugin-webhook | awk '{print $1}') -n intelfpgaplugin-system"
111+
out 'Check if the plugin runs in 'region' mode:'
112+
command "kubectl logs $(kubectl get pods --namespace intelfpgaplugin-system |grep fpgadeviceplugin|cut -f1 -d' ') --namespace intelfpgaplugin-system"
134113
out 'Check if resource fpga.intel.com/region-<FPGA interface id> is allocatable:'
135114
command 'kubectl describe node |grep -A5 Allocatable'
136115
}
137116

138-
screen6()
117+
screen5()
139118
{
140119
clear
141120
cd $GOPATH/src/github.com/intel/intel-device-plugins-for-kubernetes
142-
out '6. Run OPAE workload that uses NLB3 bitstream'
121+
out '5. Run OPAE workload that uses NLB3 bitstream'
143122
out 'Program devices with a NLB0 bitstream that is not wanted by the workload:'
144123
command "sudo /opt/intel/fpga-sw/fpgatool -b /srv/intel.com/fpga/Arria10.dcp1.2/nlb0.gbs -d ${DEVICE_PREFIX}.0 pr"
145124
command "sudo /opt/intel/fpga-sw/fpgatool -b /srv/intel.com/fpga/Arria10.dcp1.2/nlb0.gbs -d ${DEVICE_PREFIX}.1 pr"
@@ -154,7 +133,7 @@ screen6()
154133
command 'cat /sys/class/*/*/*/afu_id'
155134
}
156135

157-
screen7()
136+
screen6()
158137
{
159138
clear
160139
out 'Summary:' 15
@@ -171,7 +150,7 @@ if [ "$1" == 'play' ] ; then
171150
if [ -n "$2" ] ; then
172151
screen$2
173152
else
174-
for n in $(seq 7) ; do screen$n ; sleep 3; done
153+
for n in $(seq 6) ; do screen$n ; sleep 3; done
175154
fi
176155
elif [ "$1" == 'cleanup' ] ; then
177156
cleanup

demo/screencast-fpga-preprogrammed.sh

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,7 @@ cleanup()
3939
out 'Cleanup demo artifacts' 200
4040
command 'kubectl delete pod test-fpga-preprogrammed || true' 200
4141
command 'kubectl delete -f plugins/deployments/fpga_admissionwebhook/mappings-collection.yaml || true' 200
42-
command 'kubectl delete -k plugins/deployments/fpga_admissionwebhook/default || true' 200
43-
command './plugins/scripts/deploy-fpgaplugin.sh cleanup' 200
42+
command 'kubectl delete namespace intelfpgaplugin-system || true' 20
4443
command 'kubectl annotate node --all fpga.intel.com/device-plugin-mode-' 200
4544
command 'rm -rf plugins' 200
4645
}
@@ -66,7 +65,7 @@ screen1()
6665
sleep 2
6766
out 'Check if docker is running k8s pods:'
6867
command 'docker ps --format "table {{.Names}}"'
69-
sleep 2
68+
sleep 1
7069
}
7170

7271
screen2()
@@ -75,43 +74,35 @@ screen2()
7574
rm -rf plugins
7675
out '2. Clone Intel Device Plugins for Kubernetes repository'
7776
command "git clone https://github.com/intel/intel-device-plugins-for-kubernetes plugins" 15
77+
sleep 1
7878
}
7979

8080
screen3()
8181
{
8282
clear
83-
out '3. Deploy admission controller webhook'
84-
command 'kubectl apply -k plugins/deployments/fpga_admissionwebhook/default'
83+
out '3. Deploy FPGA plugin'
84+
command 'kubectl apply -k plugins/deployments/fpga_plugin/overlays/af'
8585
sleep 3
8686
out 'Deploy example mappings:'
8787
command 'kubectl apply -f plugins/deployments/fpga_admissionwebhook/mappings-collection.yaml'
8888
sleep 3
89-
out 'Check if webhook pod is running:'
90-
command 'kubectl get pods -n intelfpgawebhook-system'
89+
out 'Check if the plugin pods are running:'
90+
command 'kubectl get pods -n intelfpgaplugin-system'
9191
sleep 2
92-
out 'Check its logs:'
93-
command "kubectl logs $(kubectl get pods -n intelfpgawebhook-system| grep intelfpgawebhook-controller-manager | awk '{print $1}') -n intelfpgawebhook-system"
94-
sleep 2
95-
}
96-
97-
screen4()
98-
{
99-
clear
100-
out '5. Deploy FPGA plugin'
101-
command './plugins/scripts/deploy-fpgaplugin.sh'
102-
sleep 4
103-
out 'Check if its pod is runnning:'
104-
command 'kubectl get pod | grep intel-fpga-plugin'
92+
out 'Check webhook pod logs:'
93+
command "kubectl logs $(kubectl get pods -n intelfpgaplugin-system| grep intelfpgaplugin-webhook | awk '{print $1}') -n intelfpgaplugin-system"
94+
out 'Check if the plugin runs in 'region' mode:'
95+
command "kubectl logs $(kubectl get pods --namespace intelfpgaplugin-system |grep fpgadeviceplugin|cut -f1 -d' ') --namespace intelfpgaplugin-system"
10596
sleep 2
10697
out 'Check if resource fpga.intel.com/af-<af id> is allocatable:'
10798
command 'kubectl describe node |grep -A4 Allocatable'
10899
sleep 2
109100
}
110101

111-
screen5()
102+
screen4()
112103
{
113104
clear
114-
out '6. Run OPAE workload that uses NLB3 bitstream'
105+
out '4. Run OPAE workload that uses NLB3 bitstream'
115106
out 'Check if devices are programmed with NLB3:'
116107
command 'cat /sys/class/*/*/*/afu_id'
117108
out 'Run workload:'
@@ -120,9 +111,10 @@ screen5()
120111
sleep 5
121112
out 'Look at the test output'
122113
command 'kubectl logs test-fpga-preprogrammed'
114+
sleep 2
123115
}
124116

125-
screen6()
117+
screen5()
126118
{
127119
clear
128120
out 'Summary:' 15
@@ -138,7 +130,7 @@ if [ "$1" == 'play' ] ; then
138130
if [ -n "$2" ] ; then
139131
screen$2
140132
else
141-
for n in $(seq 6) ; do screen$n ; sleep 3; done
133+
for n in $(seq 5) ; do screen$n ; sleep 3; done
142134
fi
143135
elif [ "$1" == 'cleanup' ] ; then
144136
cleanup

0 commit comments

Comments
 (0)