diff --git a/containerd/containerd.go b/containerd/containerd.go index 2096711..973b585 100644 --- a/containerd/containerd.go +++ b/containerd/containerd.go @@ -4,10 +4,10 @@ import ( "github.com/containerd/containerd" ) -func isContainerdRunning(c *containerd.Client) (bool, error) { - return true, nil +func (d *Driver) isContainerdRunning() (bool, error) { + return d.client.IsServing(d.ctxContainerd) } -func getContainerdVersion(c *containerd.Client) (string, error) { - return "1.3.3", nil +func (d *Driver) getContainerdVersion() (containerd.Version, error) { + return d.client.Version(d.ctxContainerd) } diff --git a/containerd/driver.go b/containerd/driver.go index f8319f9..4ce5010 100644 --- a/containerd/driver.go +++ b/containerd/driver.go @@ -259,7 +259,7 @@ func (d *Driver) buildFingerprint() *drivers.Fingerprint { HealthDescription: drivers.DriverHealthy, } - isRunning, err := isContainerdRunning(d.client) + isRunning, err := d.isContainerdRunning() if err != nil { d.logger.Error("Error in buildFingerprint(): failed to get containerd status: %v", err) fp.Health = drivers.HealthStateUndetected @@ -274,13 +274,14 @@ func (d *Driver) buildFingerprint() *drivers.Fingerprint { } // Get containerd version - version, err := getContainerdVersion(d.client) + version, err := d.getContainerdVersion() if err != nil { d.logger.Warn("Error in buildFingerprint(): failed to get containerd version: %v", err) return fp } - fp.Attributes["driver.containerd.containerd_version"] = structs.NewStringAttribute(version) + fp.Attributes["driver.containerd.containerd_version"] = structs.NewStringAttribute(version.Version) + fp.Attributes["driver.containerd.containerd_revision"] = structs.NewStringAttribute(version.Revision) return fp }