Skip to content

Commit e58369e

Browse files
committed
rename deprecated prestart to createRuntime
`prestart` hook is marked as deprecated in the OCI runtime spec: https://github.com/opencontainers/runtime-spec/blob/main/config.md#posix-platform-hooks Renamed `prestart` to the `createRuntime` as suggested in the spec. Replaced `CDI hook` with `OCI hook` to be more clear. CDI is just a way to update OCI config and theoretically there is no such thing as CDI hook.
1 parent 1fa557e commit e58369e

17 files changed

+44
-42
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ The FPGA plugin comes as three parts.
6666

6767
- the [device plugin](#device-plugin)
6868
- the [admission controller](#admission-controller)
69-
- the [CDI prestart hook](#CDI-prestart-hook)
69+
- the [OCI createRuntime hook](#OCI-createRuntime-hook)
7070

7171
Refer to each individual sub-components documentation for more details.
7272
Brief overviews of the sub-components are below.
@@ -88,9 +88,9 @@ is responsible for performing mapping from user-friendly function IDs to the
8888
Interface ID and Bitstream ID that are required for FPGA programming. It also
8989
implements access control by namespacing FPGA configuration information.
9090

91-
#### CDI Prestart Hook
91+
#### OCI createRuntime Hook
9292

93-
The [FPGA CDI prestart hook](cmd/fpga_crihook/README.md) performs discovery
93+
The [FPGA OCI createRuntime hook](cmd/fpga_crihook/README.md) performs discovery
9494
of the requested FPGA function bitstream and programs FPGA devices based on the
9595
environment variables in the workload description.
9696

build/docker/intel-fpga-initcontainer.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,6 @@ LABEL version='devel'
8787
LABEL release='1'
8888
LABEL name='intel-fpga-initcontainer'
8989
LABEL summary='Intel® FPGA programming CDI hook for Kubernetes'
90-
LABEL description='The FPGA prestart CDI hook performs discovery of the requested FPGA function bitstream and programs FPGA devices based on the environment variables in the workload description'
90+
LABEL description='The FPGA OCI createRuntime hook performs discovery of the requested FPGA function bitstream and programs FPGA devices based on the environment variables in the workload description'
9191
COPY --from=builder /install_root /
9292
ENTRYPOINT [ "/usr/bin/sh", "-c", "cp -a /usr/local/fpga-sw/* /opt/intel/fpga-sw/" ]

build/docker/templates/intel-fpga-initcontainer.Dockerfile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ FROM ${FINAL_BASE}
2222

2323
LABEL name='intel-fpga-initcontainer'
2424
LABEL summary='Intel® FPGA programming CDI hook for Kubernetes'
25-
LABEL description='The FPGA prestart CDI hook performs discovery of the requested FPGA function bitstream and programs FPGA devices based on the environment variables in the workload description'
25+
LABEL description='The FPGA OCI createRuntime hook performs discovery of the requested FPGA function bitstream and programs FPGA devices based on the environment variables in the workload description'
2626

2727
COPY --from=builder /install_root /
2828

cmd/fpga_admissionwebhook/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,23 @@ devices to Kubernetes.
2323
2424
The FPGA admission controller webhook is responsible for performing mapping from user-friendly
2525
function IDs to the Interface ID and Bitstream ID that are required for FPGA programming by
26-
the [FPGA CDI prestart hook](../fpga_crihook/README.md).
26+
the [FPGA OCI createRuntime hook](../fpga_crihook/README.md).
2727

2828
Mappings are stored in namespaced custom resource definition (CRD) objects, therefore the admission
2929
controller also performs access control, determining which bitstream can be used for which namespace.
3030
More details can be found in the [Mappings](#mappings) section.
3131

3232
The admission controller also keeps the user from bypassing namespaced mapping restrictions,
3333
by denying admission of any pods that are trying to use internal knowledge of InterfaceID or
34-
Bitstream ID environment variables used by the prestart hook.
34+
Bitstream ID environment variables used by the createRuntime hook.
3535

3636
## Dependencies
3737

3838
This component is one of a set of components that work together. You may also want to
3939
install the following:
4040

4141
- [FPGA device plugin](../fpga_plugin/README.md)
42-
- [FPGA CDI prestart hook](../fpga_crihook/README.md)
42+
- [FPGA OCI createRuntime hook](../fpga_crihook/README.md)
4343

4444
All components have the same basic dependencies as the
4545
[generic plugin framework dependencies](../../README.md#about)
@@ -129,7 +129,7 @@ The same mapping, but with its mode field set to `region`, would translate
129129
and the corresponding AF IDs are set in environment variables for the container.
130130
Though in this case the cluster administrator would probably want to rename
131131
the mapping `arria10.dcp1.2-nlb0-preprogrammed` to something like `arria10.dcp1.2-nlb0-orchestrated`
132-
to reflect its mode. The [FPGA CDI prestart hook](../fpga_crihook/README.md) then loads the requested
132+
to reflect its mode. The [FPGA OCI createRuntime hook](../fpga_crihook/README.md) then loads the requested
133133
bitstream to a region before the container is started.
134134

135135
Mappings of resource names are configured with objects of `AcceleratorFunction` and
@@ -183,4 +183,4 @@ and they are applicable to pods created in the corresponding namespaces.
183183

184184
## Next steps
185185

186-
Continue with [FPGA CDI prestart hook](../fpga_crihook/README.md).
186+
Continue with [FPGA OCI createRuntime hook](../fpga_crihook/README.md).

cmd/fpga_crihook/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Intel FPGA CDI prestart hook for Kubernetes
1+
# Intel FPGA OCI createRuntime hook for Kubernetes
22

33
Table of Contents
44

@@ -11,7 +11,7 @@ Table of Contents
1111
The FPGA CDI hook is one of the components used to add support for Intel FPGA
1212
devices to Kubernetes.
1313

14-
The FPGA prestart hook is passed by the [FPGA device plugin](../fpga_plugin/README.md) as
14+
The FPGA OCI createRuntime hook is passed by the [FPGA device plugin](../fpga_plugin/README.md) as
1515
a CDI device attribute to the Kubelet and then to the CRI runtime.
1616
It performs discovery of the requested FPGA function bitstream and then programs FPGA devices
1717
based on the environment variables in the workload description.

cmd/fpga_crihook/testdata/config-correct.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@
5252
}
5353
],
5454
"hooks": {
55-
"prestart": [
55+
"createRuntime": [
5656
{
5757
"path": "/usr/local/bin/fpga_crihook",
5858
"args": [
5959
"/usr/local/bin/fpga_crihook"
6060
],
6161
"env": [
62-
"stage=prestart"
62+
"stage=createRuntime"
6363
]
6464
}
6565
]

cmd/fpga_crihook/testdata/config-no-FPGA-devices.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@
5252
}
5353
],
5454
"hooks": {
55-
"prestart": [
55+
"createRuntime": [
5656
{
5757
"path": "/usr/local/bin/fpga_crihook",
5858
"args": [
5959
"/usr/local/bin/fpga_crihook"
6060
],
6161
"env": [
62-
"stage=prestart"
62+
"stage=createRuntime"
6363
]
6464
}
6565
]

cmd/fpga_crihook/testdata/config-no-afu.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@
5151
}
5252
],
5353
"hooks": {
54-
"prestart": [
54+
"createRuntime": [
5555
{
5656
"path": "/usr/local/bin/fpga_crihook",
5757
"args": [
5858
"/usr/local/bin/fpga_crihook"
5959
],
6060
"env": [
61-
"stage=prestart"
61+
"stage=createRuntime"
6262
]
6363
}
6464
]

cmd/fpga_crihook/testdata/config-no-devices.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@
5252
}
5353
],
5454
"hooks": {
55-
"prestart": [
55+
"createRuntime": [
5656
{
5757
"path": "/usr/local/bin/fpga_crihook",
5858
"args": [
5959
"/usr/local/bin/fpga_crihook"
6060
],
6161
"env": [
62-
"stage=prestart"
62+
"stage=createRuntime"
6363
]
6464
}
6565
]

cmd/fpga_crihook/testdata/config-no-env.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@
4242
}
4343
],
4444
"hooks": {
45-
"prestart": [
45+
"createRuntime": [
4646
{
4747
"path": "/usr/local/bin/fpga_crihook",
4848
"args": [
4949
"/usr/local/bin/fpga_crihook"
5050
],
5151
"env": [
52-
"stage=prestart"
52+
"stage=createRuntime"
5353
]
5454
}
5555
]

cmd/fpga_crihook/testdata/config-no-linux.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@
5252
}
5353
],
5454
"hooks": {
55-
"prestart": [
55+
"createRuntime": [
5656
{
5757
"path": "/usr/local/bin/fpga_crihook",
5858
"args": [
5959
"/usr/local/bin/fpga_crihook"
6060
],
6161
"env": [
62-
"stage=prestart"
62+
"stage=createRuntime"
6363
]
6464
}
6565
]

cmd/fpga_crihook/testdata/config-no-process.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@
3131
}
3232
],
3333
"hooks": {
34-
"prestart": [
34+
"createRuntime": [
3535
{
3636
"path": "/usr/local/bin/fpga_crihook",
3737
"args": [
3838
"/usr/local/bin/fpga_crihook"
3939
],
4040
"env": [
41-
"stage=prestart"
41+
"stage=createRuntime"
4242
]
4343
}
4444
]

cmd/fpga_crihook/testdata/config-no-region.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@
5151
}
5252
],
5353
"hooks": {
54-
"prestart": [
54+
"createRuntime": [
5555
{
5656
"path": "/usr/local/bin/fpga_crihook",
5757
"args": [
5858
"/usr/local/bin/fpga_crihook"
5959
],
6060
"env": [
61-
"stage=prestart"
61+
"stage=createRuntime"
6262
]
6363
}
6464
]

cmd/fpga_crihook/testdata/config-non-existing-bitstream.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,14 @@
5252
}
5353
],
5454
"hooks": {
55-
"prestart": [
55+
"createRuntime": [
5656
{
5757
"path": "/usr/local/bin/fpga_crihook",
5858
"args": [
5959
"/usr/local/bin/fpga_crihook"
6060
],
6161
"env": [
62-
"stage=prestart"
62+
"stage=createRuntime"
6363
]
6464
}
6565
]

cmd/fpga_crihook/testdata/config-region-afu-dont-match.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@
5353
}
5454
],
5555
"hooks": {
56-
"prestart": [
56+
"createRuntime": [
5757
{
5858
"path": "/usr/local/bin/fpga_crihook",
5959
"args": [
6060
"/usr/local/bin/fpga_crihook"
6161
],
6262
"env": [
63-
"stage=prestart"
63+
"stage=createRuntime"
6464
]
6565
}
6666
]

cmd/fpga_plugin/README.md

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,20 @@ Kubernetes:
4747
which can be used to dynamically convert logical resource names in pod specifications into actual FPGA
4848
resource names, as advertised by the device plugin.
4949

50-
The webhook can also set environment variables to instruct the CDI prestart hook to program the FPGA
50+
The webhook can also set environment variables to instruct the OCI createRuntime hook to program the FPGA
5151
before launching the container.
5252

5353
> **NOTE:** Installation of the [FPGA admission controller webhook](../fpga_admissionwebhook/README.md) can be skipped if the
5454
> FPGA device plugin is operated with the Intel Device Plugins Operator
5555
> since it integrates the controller's functionality.
5656
> However, [the mappings](../fpga_admissionwebhook/README.md#mappings-deployment) still must be deployed."
5757
58-
- [FPGA CDI prestart hook](../fpga_crihook/README.md)
58+
- [FPGA OCI createRuntime hook](../fpga_crihook/README.md)
5959

60-
A [CDI](https://github.com/cncf-tags/container-device-interface) prestart hook that, upon instruction from the FPGA admission
61-
controller, programs the FPGA before the container is launched.
60+
An [OCI](https://github.com/opencontainers/runtime-spec/blob/main/config.md#createRuntime-hooks) createRuntime hook that,
61+
upon instruction from the FPGA admission controller, programs the FPGA before the container is launched.
62+
The FPGA plugin uses [Container Device Interface](https://github.com/cncf-tags/container-device-interface) to pass the hook
63+
to the Kubelet.
6264

6365
The repository also contains an [FPGA helper tool](../fpga_tool/README.md) that may be useful during
6466
development, initial deployment and debugging.
@@ -102,13 +104,13 @@ major components:
102104

103105
- [FPGA device plugin](README.md) (this component)
104106
- [FPGA admission controller webhook](../fpga_admissionwebhook/README.md)
105-
- [FPGA CDI prestart hook](../fpga_crihook/README.md)
107+
- [FPGA OCI createRuntime hook](../fpga_crihook/README.md)
106108

107109
The CDI hook is only *required* if `region` mode is being used, but is installed by default by the
108110
[FPGA plugin DaemonSet YAML](/deployments/fpga_plugin/base/intel-fpga-plugin-daemonset.yaml), and is benign
109111
in `af` mode.
110112

111-
If using the `af` mode, and therefore *not* using the CDI prestart hook, any runtime can be used
113+
If using the `af` mode, and therefore *not* using the OCI createRuntime hook, any runtime can be used
112114
(that is, the CDI is not supported by all runtimes).
113115

114116
The FPGA device plugin requires a Linux Kernel FPGA driver to be installed and enabled to
@@ -146,7 +148,7 @@ The following images are available on the Docker hub:
146148

147149
- [The FPGA plugin](https://hub.docker.com/r/intel/intel-fpga-plugin)
148150
- [The FPGA admisson webhook](https://hub.docker.com/r/intel/intel-fpga-admissionwebhook)
149-
- [The FPGA CDI prestart hook (in the `initcontainer` image)](https://hub.docker.com/r/intel/intel-fpga-initcontainer)
151+
- [The FPGA OCI createRuntime hook (in the `initcontainer` image)](https://hub.docker.com/r/intel/intel-fpga-initcontainer)
150152

151153
Depending on the FPGA mode, run either
152154
```bash
@@ -206,7 +208,7 @@ $ kubectl annotate node <node_name> 'fpga.intel.com/device-plugin-mode=af'
206208
And restart the pods on the nodes.
207209

208210
> **Note:** The FPGA plugin [DaemonSet YAML](/deployments/fpga_plugin/base/intel-fpga-plugin-daemonset.yaml)
209-
> also deploys the [FPGA CDI prestart hook](../fpga_crihook/README.md) `initcontainer` image, but it will be
211+
> also deploys the [FPGA OCI createRuntime hook](../fpga_crihook/README.md) `initcontainer` image, but it will be
210212
> benign (un-used) when running the FPGA plugin in `af` mode.
211213
212214
#### Verify Plugin Registration
@@ -222,6 +224,6 @@ fpga.intel.com/region-ce48969398f05f33946d560708be108a: 1
222224
```
223225

224226
> **Note:** The FPGA plugin [DaemonSet YAML](/deployments/fpga_plugin/fpga_plugin.yaml)
225-
> also deploys the [FPGA CDI prestart hook](../fpga_crihook/README.md) `initcontainer` image as well. You may
227+
> also deploys the [FPGA OCI createRuntime hook](../fpga_crihook/README.md) `initcontainer` image as well. You may
226228
> also wish to build that image locally before deploying the FPGA plugin to avoid deploying
227229
> the Docker hub default image.

cmd/fpga_plugin/fpga_plugin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ const (
5353
scanPeriod = 5 * time.Second
5454

5555
// CDI hook attributes.
56-
HookName = "prestart"
56+
HookName = "createRuntime"
5757
HookPath = "/opt/intel/fpga-sw/intel-fpga-crihook"
5858
)
5959

0 commit comments

Comments
 (0)