Skip to content

Commit d1f8d2b

Browse files
committed
move packages related to v0.1.0 to the plugins/v010-adapter
Signed-off-by: Iceber Gu <[email protected]>
1 parent 326b88c commit d1f8d2b

File tree

10 files changed

+30
-375
lines changed

10 files changed

+30
-375
lines changed

README-v0.1.0.md

Lines changed: 2 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -1,110 +1,2 @@
1-
# nri - Node Resource Interface
2-
3-
*This version of NRI is supported through the included v010-adapter plugin.*
4-
5-
This project is a WIP for a new, CNI like, interface for managing resources on a node for Pods and Containers.
6-
7-
## Documentation
8-
9-
The basic interface, concepts and plugin design of the Container Network Interface (CNI) is an elegant way to handle multiple implementations of the network stack for containers.
10-
This concept can be used for additional interfaces to customize a container's runtime environment.
11-
This proposal covers a new interface for resource management on a node with a structured API and plugin design for containers.
12-
13-
## Lifecycle
14-
15-
The big selling point for CNI is that it has a structured interface for modifying the network namespace for a container.
16-
This is different from generic hooks as they lack a type safe API injected into the lifecycle of a container.
17-
The lifecycle point that CNI and NRI plugins will be injected into is the point between `Create` and `Start` of the container's init process.
18-
19-
`Create->NRI->Start`
20-
21-
## Configuration
22-
23-
Configuration is split into two parts. One is the payload that is specific to a plugin invocation while the second is the host level configuration and options that specify what plugins to run and provide additional configuration to a plugin.
24-
25-
### Filepath and Binaries
26-
27-
Plugin binary paths can be configured via the consumer but will default to `/opt/nri/bin`.
28-
Binaries are named with their type as the binary name, same as the CNI plugin naming scheme.
29-
30-
### Host Level Config
31-
32-
The config's default location will be `/etc/nri/resource.d/*.conf`.
33-
34-
```json
35-
{
36-
"version": "0.1",
37-
"plugins": [
38-
{
39-
"type": "konfine",
40-
"conf": {
41-
"systemReserved": [0, 1]
42-
}
43-
},
44-
{
45-
"type": "clearcfs"
46-
}
47-
]
48-
}
49-
```
50-
51-
### Input
52-
53-
Input to a plugin is provided via `STDIN` as a `json` payload.
54-
55-
```json
56-
{
57-
"version": "0.1",
58-
"state": "create",
59-
"id": "redis",
60-
"pid": 1234,
61-
"spec": {
62-
"resources": {},
63-
"cgroupsPath": "default/redis",
64-
"namespaces": {
65-
"pid": "/proc/44/ns/pid",
66-
"mount": "/proc/44/ns/mnt",
67-
"net": "/proc/44/ns/net"
68-
},
69-
"annotations": {
70-
"qos.class": "ls"
71-
}
72-
}
73-
}
74-
```
75-
76-
### Output
77-
78-
```json
79-
{
80-
"version": "0.1",
81-
"state": "create",
82-
"id": "redis",
83-
"pid": 1234,
84-
"cgroupsPath": "qos-ls/default/redis"
85-
}
86-
```
87-
88-
## Commands
89-
90-
* Invoke - provides invocations into different lifecycle changes of a container
91-
- states: `setup|pause|resume|update|delete`
92-
93-
## Packages
94-
95-
A Go based API and client package will be created for both producers of plugins and consumers, commonly being the container runtime (containerd).
96-
97-
### Sample Plugin
98-
99-
* [clearcfs](examples/clearcfs/main.go)
100-
101-
## Project details
102-
103-
nri is a containerd sub-project, licensed under the [Apache 2.0 license](./LICENSE).
104-
As a containerd sub-project, you will find the:
105-
106-
* [Project governance](https://github.com/containerd/project/blob/main/GOVERNANCE.md),
107-
* [Maintainers](https://github.com/containerd/project/blob/main/MAINTAINERS),
108-
* and [Contributing guidelines](https://github.com/containerd/project/blob/main/CONTRIBUTING.md)
109-
110-
information in our [`containerd/project`](https://github.com/containerd/project) repository.
1+
original v0.1.0 CLI invoke style version of NRI has been moved
2+
[v0.1.0 docs](/plugins/v010-adapter/0.1.0/README.md)

README.md

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,25 +23,15 @@ The goal is to enable NRI support in the most commonly used OCI runtimes,
2323
[containerd](https://github.com/containerd/containerd) and
2424
[CRI-O](https://github.com/cri-o/cri-o).
2525

26-
## Background
27-
28-
The revisited API is a major rewrite of NRI. It changes the scope of NRI
29-
and how it gets integrated into runtimes. It reworks how plugins are
30-
implemented, how they communicate with the runtime, and what kind of
31-
changes they can make to containers.
32-
33-
[NRI v0.1.0](README-v0.1.0.md) used an OCI hook-like one-shot plugin invocation
34-
mechanism where a separate instance of a plugin was spawned for every NRI
35-
event. This instance then used its standard input and output to receive a
36-
request and provide a response, both as JSON data.
37-
26+
### Plugins
3827
Plugins in NRI are daemon-like entities. A single instance of a plugin is
39-
now responsible for handling the full stream of NRI events and requests. A
40-
unix-domain socket is used as the transport for communication. Instead of
41-
JSON requests and responses NRI is defined as a formal, protobuf-based
42-
'NRI plugin protocol' which is compiled into ttRPC bindings. This should
43-
result in improved communication efficiency with lower per-message overhead,
44-
and enable straightforward implementation of stateful NRI plugins.
28+
responsible for handling the full stream of NRI events and requests.
29+
A unix-domain socket is used as the transport for communication.
30+
31+
NRI is defined as a formal, protobuf-based 'NRI plugin protocol' which is
32+
compiled into ttRPC bindings. This should result in improved communication
33+
efficiency with lower per-message overhead, and enable straightforward
34+
implementation of stateful NRI plugins.
4535

4636
## Components
4737

examples/clearcfs/main.go

Lines changed: 0 additions & 70 deletions
This file was deleted.

examples/go.mod

Lines changed: 0 additions & 20 deletions
This file was deleted.

examples/go.sum

Lines changed: 0 additions & 92 deletions
This file was deleted.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Node Resource Interface v0.1.0
2+
3+
*This version of NRI is supported through the included v010-adapter plugin.*
4+
5+
Refer to the original documentation: [NRI v0.1.0](https://github.com/containerd/nri/blob/v0.9.0/README-v0.1.0.md).
6+
If you're still using *nri v0.1.0*, We recommend refactoring to the latest NRI.
7+
8+
## Background
9+
10+
NRI v0.1.0 used an OCI hook-like one-shot plugin invocation mechanism where a separate instance of a plugin was spawned for every NRI event. This instance then used its standard input and output to receive a request and provide a response, both as JSON data.
11+
12+
## Other Packages
13+
14+
> other 0.1.0 files useful for v0.1.0 cll invoke style NRI plugins
15+
16+
* [v0.1.0 clearcfs example](https://github.com/containerd/nri/blob/v0.9.0/examples)
17+
* [v0.1.0 skel example](https://github.com/containerd/nri/tree/v0.9.0/skel)

client.go renamed to plugins/v010-adapter/0.1.0/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
"os/exec"
2626
"sync"
2727

28-
types "github.com/containerd/nri/types/v1"
28+
types "github.com/containerd/nri/plugins/v010-adapter/0.1.0/types/v1"
2929

3030
oci "github.com/opencontainers/runtime-spec/specs-go"
3131
)

types/v1/types.go renamed to plugins/v010-adapter/0.1.0/types/v1/types.go

File renamed without changes.

plugins/v010-adapter/v010-adapter.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ import (
2323

2424
"github.com/sirupsen/logrus"
2525

26-
"github.com/containerd/nri"
2726
"github.com/containerd/nri/pkg/api"
2827
"github.com/containerd/nri/pkg/stub"
29-
nriv1 "github.com/containerd/nri/types/v1"
28+
nri "github.com/containerd/nri/plugins/v010-adapter/0.1.0"
29+
nriv1 "github.com/containerd/nri/plugins/v010-adapter/0.1.0/types/v1"
3030
oci "github.com/opencontainers/runtime-spec/specs-go"
3131
)
3232

0 commit comments

Comments
 (0)