mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 18:35:44 +03:00
This changeset is some pre-requisite boilerplate that is required for introducing CSI volume management for client nodes. It extracts out fingerprinting logic from the csi instance manager. This change is to facilitate reusing the csimanager to also manage the node-local CSI functionality, as it is the easiest place for us to guaruntee health checking and to provide additional visibility into the running operations through the fingerprinter mechanism and goroutine. It also introduces the VolumeMounter interface that will be used to manage staging/publishing unstaging/unpublishing of volumes on the host.
35 lines
978 B
Go
35 lines
978 B
Go
package csimanager
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
|
|
"github.com/hashicorp/nomad/client/pluginmanager"
|
|
"github.com/hashicorp/nomad/nomad/structs"
|
|
)
|
|
|
|
var (
|
|
DriverNotFoundErr = errors.New("Driver not found")
|
|
)
|
|
|
|
type MountInfo struct {
|
|
}
|
|
|
|
type VolumeMounter interface {
|
|
MountVolume(ctx context.Context, vol *structs.CSIVolume, alloc *structs.Allocation) (*MountInfo, error)
|
|
UnmountVolume(ctx context.Context, vol *structs.CSIVolume, alloc *structs.Allocation) error
|
|
}
|
|
|
|
type Manager interface {
|
|
// PluginManager returns a PluginManager for use by the node fingerprinter.
|
|
PluginManager() pluginmanager.PluginManager
|
|
|
|
// MounterForVolume returns a VolumeMounter for the given requested volume.
|
|
// If there is no plugin registered for this volume type, a DriverNotFoundErr
|
|
// will be returned.
|
|
MounterForVolume(ctx context.Context, volume *structs.CSIVolume) (VolumeMounter, error)
|
|
|
|
// Shutdown shuts down the Manager and unmounts any locally attached volumes.
|
|
Shutdown()
|
|
}
|