diff --git a/api/docs/CHANGELOG.md b/api/docs/CHANGELOG.md
index 17c72c1bbd..8b7bc484a8 100644
--- a/api/docs/CHANGELOG.md
+++ b/api/docs/CHANGELOG.md
@@ -13,6 +13,11 @@ keywords: "API, Docker, rcli, REST, documentation"
will be rejected.
-->
+## v1.53 API changes
+
+* `GET /info` now includes an `NRI` field. If the Node Resource Interface (NRI)
+ is enabled, this field contains information describing it.
+
## v1.52 API changes
* `GET /images/{name}/get` now accepts multiple `platform` query-arguments
diff --git a/api/docs/v1.53.yaml b/api/docs/v1.53.yaml
index 121529dd10..debd6d72ce 100644
--- a/api/docs/v1.53.yaml
+++ b/api/docs/v1.53.yaml
@@ -2943,6 +2943,31 @@ definitions:
The unique identifier for the device within its source driver.
For CDI devices, this would be an FQDN like "vendor.com/gpu=0".
+ NRIInfo:
+ description: |
+ Information about the Node Resource Interface (NRI).
+
+ This field is only present if NRI is enabled.
+ type: "object"
+ x-nullable: true
+ properties:
+ Info:
+ description: |
+ Information about NRI, provided as "label" / "value" pairs.
+
+
+
+ > **Note**: The information returned in this field, including the
+ > formatting of values and labels, should not be considered stable,
+ > and may change without notice.
+ type: "array"
+ items:
+ type: "array"
+ items:
+ type: "string"
+ example:
+ - ["plugin-path", "/opt/docker/nri/plugins"]
+
ErrorDetail:
type: "object"
properties:
@@ -6980,6 +7005,8 @@ definitions:
type: "array"
items:
$ref: "#/definitions/DeviceInfo"
+ NRI:
+ $ref: "#/definitions/NRIInfo"
Warnings:
description: |
List of warnings / informational messages about missing features, or
diff --git a/api/swagger.yaml b/api/swagger.yaml
index fe8604a032..f7760e3b42 100644
--- a/api/swagger.yaml
+++ b/api/swagger.yaml
@@ -2946,6 +2946,31 @@ definitions:
The unique identifier for the device within its source driver.
For CDI devices, this would be an FQDN like "vendor.com/gpu=0".
+ NRIInfo:
+ description: |
+ Information about the Node Resource Interface (NRI).
+
+ This field is only present if NRI is enabled.
+ type: "object"
+ x-nullable: true
+ properties:
+ Info:
+ description: |
+ Information about NRI, provided as "label" / "value" pairs.
+
+
+
+ > **Note**: The information returned in this field, including the
+ > formatting of values and labels, should not be considered stable,
+ > and may change without notice.
+ type: "array"
+ items:
+ type: "array"
+ items:
+ type: "string"
+ example:
+ - ["plugin-path", "/opt/docker/nri/plugins"]
+
ErrorDetail:
type: "object"
properties:
@@ -6983,6 +7008,8 @@ definitions:
type: "array"
items:
$ref: "#/definitions/DeviceInfo"
+ NRI:
+ $ref: "#/definitions/NRIInfo"
Warnings:
description: |
List of warnings / informational messages about missing features, or
diff --git a/api/types/system/info.go b/api/types/system/info.go
index bca0459df2..20df949e42 100644
--- a/api/types/system/info.go
+++ b/api/types/system/info.go
@@ -74,6 +74,7 @@ type Info struct {
FirewallBackend *FirewallInfo `json:"FirewallBackend,omitempty"`
CDISpecDirs []string
DiscoveredDevices []DeviceInfo `json:",omitempty"`
+ NRI *NRIInfo `json:",omitempty"`
Containerd *ContainerdInfo `json:",omitempty"`
@@ -163,3 +164,8 @@ type DeviceInfo struct {
// Example: CDI FQDN like "vendor.com/gpu=0", or other driver-specific device ID
ID string `json:"ID"`
}
+
+// NRIInfo describes the NRI configuration.
+type NRIInfo struct {
+ Info [][2]string `json:"Info,omitempty"`
+}
diff --git a/daemon/info.go b/daemon/info.go
index 05a1c6de02..490145c7f7 100644
--- a/daemon/info.go
+++ b/daemon/info.go
@@ -72,6 +72,7 @@ func (daemon *Daemon) SystemInfo(ctx context.Context) (*system.Info, error) {
LiveRestoreEnabled: cfg.LiveRestoreEnabled,
Isolation: daemon.defaultIsolation,
CDISpecDirs: promoteNil(cfg.CDISpecDirs),
+ NRI: daemon.nri.GetInfo(),
}
daemon.fillContainerStates(v)
diff --git a/daemon/internal/nri/nri.go b/daemon/internal/nri/nri.go
index 48d26c28fb..ba69db2328 100644
--- a/daemon/internal/nri/nri.go
+++ b/daemon/internal/nri/nri.go
@@ -29,6 +29,7 @@ import (
nrilog "github.com/containerd/nri/pkg/log"
containertypes "github.com/moby/moby/api/types/container"
"github.com/moby/moby/api/types/mount"
+ "github.com/moby/moby/api/types/system"
"github.com/moby/moby/v2/daemon/container"
"github.com/moby/moby/v2/daemon/internal/rootless"
"github.com/moby/moby/v2/daemon/pkg/opts"
@@ -91,6 +92,25 @@ func NewNRI(ctx context.Context, cfg Config) (*NRI, error) {
return n, nil
}
+// GetInfo returns status for inclusion in the system info API.
+func (n *NRI) GetInfo() *system.NRIInfo {
+ if n == nil {
+ return nil
+ }
+ n.mu.RLock()
+ defer n.mu.RUnlock()
+ if n.adap == nil {
+ return nil
+ }
+ info := system.NRIInfo{}
+ info.Info = append(info.Info, [2]string{"plugin-path", n.cfg.DaemonConfig.PluginPath})
+ info.Info = append(info.Info, [2]string{"plugin-config-path", n.cfg.DaemonConfig.PluginConfigPath})
+ if n.cfg.DaemonConfig.SocketPath != "" {
+ info.Info = append(info.Info, [2]string{"socket-path", n.cfg.DaemonConfig.SocketPath})
+ }
+ return &info
+}
+
// Shutdown stops the NRI instance and releases its resources.
func (n *NRI) Shutdown(ctx context.Context) {
n.mu.Lock()
diff --git a/daemon/server/router/system/system_routes.go b/daemon/server/router/system/system_routes.go
index aab0ef5369..0d2d4f0ca6 100644
--- a/daemon/server/router/system/system_routes.go
+++ b/daemon/server/router/system/system_routes.go
@@ -118,6 +118,10 @@ func (s *systemRouter) getInfo(ctx context.Context, w http.ResponseWriter, r *ht
"BridgeNfIp6tables": json.RawMessage("false"),
}))
}
+ if versions.LessThan(version, "1.53") {
+ // Field introduced in API v1.53.
+ info.NRI = nil
+ }
return compat.Wrap(info, legacyOptions...), nil
})
diff --git a/vendor/github.com/moby/moby/api/types/system/info.go b/vendor/github.com/moby/moby/api/types/system/info.go
index bca0459df2..20df949e42 100644
--- a/vendor/github.com/moby/moby/api/types/system/info.go
+++ b/vendor/github.com/moby/moby/api/types/system/info.go
@@ -74,6 +74,7 @@ type Info struct {
FirewallBackend *FirewallInfo `json:"FirewallBackend,omitempty"`
CDISpecDirs []string
DiscoveredDevices []DeviceInfo `json:",omitempty"`
+ NRI *NRIInfo `json:",omitempty"`
Containerd *ContainerdInfo `json:",omitempty"`
@@ -163,3 +164,8 @@ type DeviceInfo struct {
// Example: CDI FQDN like "vendor.com/gpu=0", or other driver-specific device ID
ID string `json:"ID"`
}
+
+// NRIInfo describes the NRI configuration.
+type NRIInfo struct {
+ Info [][2]string `json:"Info,omitempty"`
+}