Documentation ¶
Overview ¶
Package node contains implementation of CSI Node component
Index ¶
- Constants
- type CSINodeService
- func (s *CSINodeService) Check(ctx context.Context, req *grpc_health_v1.HealthCheckRequest) (*grpc_health_v1.HealthCheckResponse, error)
- func (s *CSINodeService) GetLivenessHelper() LivenessHelper
- func (s *CSINodeService) NodeExpandVolume(ctx context.Context, req *csi.NodeExpandVolumeRequest) (*csi.NodeExpandVolumeResponse, error)
- func (s *CSINodeService) NodeGetCapabilities(ctx context.Context, req *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error)
- func (s *CSINodeService) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error)
- func (s *CSINodeService) NodeGetVolumeStats(ctx context.Context, req *csi.NodeGetVolumeStatsRequest) (*csi.NodeGetVolumeStatsResponse, error)
- func (s *CSINodeService) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error)
- func (s *CSINodeService) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRequest) (*csi.NodeStageVolumeResponse, error)
- func (s *CSINodeService) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error)
- func (s *CSINodeService) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error)
- func (s *CSINodeService) Probe(context.Context, *csi.ProbeRequest) (*csi.ProbeResponse, error)
- func (s *CSINodeService) Watch(req *grpc_health_v1.HealthCheckRequest, srv grpc_health_v1.Health_WatchServer) error
- type DummyLivenessHelper
- type LivenessCheckHelper
- type LivenessHelper
- type VolumeManager
- func (m *VolumeManager) Discover() error
- func (m *VolumeManager) Reconcile(req ctrl.Request) (ctrl.Result, error)
- func (m *VolumeManager) SetListBlk(listBlk lsblk.WrapLsblk)
- func (m *VolumeManager) SetProvisioners(provs map[p.VolumeType]p.Provisioner)
- func (m *VolumeManager) SetupWithManager(mgr ctrl.Manager) error
Constants ¶
const ( // LivenessDefaultTTL default TTL for node liveness checker LivenessDefaultTTL = 2 * time.Minute // LivenessDefaultTimeout hard timeout for node liveness checker LivenessDefaultTimeout = 10 * time.Minute )
const ( // UnknownPodName is used when pod name isn't provided in request UnknownPodName = "UNKNOWN" // EphemeralKey in volume context means that in node publish request we need to create ephemeral volume EphemeralKey = "csi.storage.k8s.io/ephemeral" )
const ( // DiscoverDrivesTimeout is the timeout for Discover method DiscoverDrivesTimeout = 300 * time.Second // VolumeOperationsTimeout is the timeout for local Volume creation/deletion VolumeOperationsTimeout = 900 * time.Second )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CSINodeService ¶
type CSINodeService struct { VolumeManager csi.IdentityServer grpc_health_v1.HealthServer // contains filtered or unexported fields }
CSINodeService is the implementation of NodeServer interface from GO CSI specification. Contains VolumeManager in a such way that it is a single instance in the driver
func NewCSINodeService ¶
func NewCSINodeService(client api.DriveServiceClient, nodeID string, logger *logrus.Logger, k8sClient *k8s.KubeClient, k8sCache k8s.CRReader, recorder eventRecorder, featureConf featureconfig.FeatureChecker) *CSINodeService
NewCSINodeService is the constructor for CSINodeService struct Receives an instance of DriveServiceClient to interact with DriveManager, ID of a node where it works, logrus logger and base.KubeClient Returns an instance of CSINodeService
func (*CSINodeService) Check ¶
func (s *CSINodeService) Check(ctx context.Context, req *grpc_health_v1.HealthCheckRequest) (*grpc_health_v1.HealthCheckResponse, error)
Check does the health check and changes the status of the server based on drives cache size
func (*CSINodeService) GetLivenessHelper ¶
func (s *CSINodeService) GetLivenessHelper() LivenessHelper
GetLivenessHelper return instance of livenesshelper used by node service
func (*CSINodeService) NodeExpandVolume ¶
func (s *CSINodeService) NodeExpandVolume(ctx context.Context, req *csi.NodeExpandVolumeRequest) (*csi.NodeExpandVolumeResponse, error)
NodeExpandVolume returns empty response
func (*CSINodeService) NodeGetCapabilities ¶
func (s *CSINodeService) NodeGetCapabilities(ctx context.Context, req *csi.NodeGetCapabilitiesRequest) (*csi.NodeGetCapabilitiesResponse, error)
NodeGetCapabilities is the implementation of CSI Spec NodeGetCapabilities. Provides Node capabilities of CSI driver to k8s. STAGE/UNSTAGE Volume for now. Receives golang context and CSI Spec NodeGetCapabilitiesRequest Returns CSI Spec NodeGetCapabilitiesResponse and nil error
func (*CSINodeService) NodeGetInfo ¶
func (s *CSINodeService) NodeGetInfo(ctx context.Context, req *csi.NodeGetInfoRequest) (*csi.NodeGetInfoResponse, error)
NodeGetInfo is the implementation of CSI Spec NodeGetInfo. It plays a role in CSI Topology feature when Controller chooses a node where to deploy a volume. Receives golang context and CSI Spec NodeGetInfoRequest Returns CSI Spec NodeGetInfoResponse with topology NodeIDTopologyLabelKey: NodeID and nil error
func (*CSINodeService) NodeGetVolumeStats ¶
func (s *CSINodeService) NodeGetVolumeStats(ctx context.Context, req *csi.NodeGetVolumeStatsRequest) (*csi.NodeGetVolumeStatsResponse, error)
NodeGetVolumeStats returns empty response
func (*CSINodeService) NodePublishVolume ¶
func (s *CSINodeService) NodePublishVolume(ctx context.Context, req *csi.NodePublishVolumeRequest) (*csi.NodePublishVolumeResponse, error)
NodePublishVolume is the implementation of CSI Spec NodePublishVolume. Performs each time pod starts consume a volume. This method perform bind mount of volume with appropriate VolumeID from the StagingTargetPath to TargetPath. Receives golang context and CSI Spec NodePublishVolumeRequest Returns CSI Spec NodePublishVolumeResponse or error if something went wrong
func (*CSINodeService) NodeStageVolume ¶
func (s *CSINodeService) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRequest) (*csi.NodeStageVolumeResponse, error)
NodeStageVolume is the implementation of CSI Spec NodeStageVolume. Performs when the first pod consumes a volume. This method mounts volume with appropriate VolumeID into the StagingTargetPath from request. Receives golang context and CSI Spec NodeStageVolumeRequest Returns CSI Spec NodeStageVolumeResponse or error if something went wrong
func (*CSINodeService) NodeUnpublishVolume ¶
func (s *CSINodeService) NodeUnpublishVolume(ctx context.Context, req *csi.NodeUnpublishVolumeRequest) (*csi.NodeUnpublishVolumeResponse, error)
NodeUnpublishVolume is the implementation of CSI Spec NodePublishVolume. Performs each time pod stops consume a volume. This method unmounts volume with appropriate VolumeID from the TargetPath. Receives golang context and CSI Spec NodeUnpublishVolumeRequest Returns CSI Spec NodeUnpublishVolumeResponse or error if something went wrong
func (*CSINodeService) NodeUnstageVolume ¶
func (s *CSINodeService) NodeUnstageVolume(ctx context.Context, req *csi.NodeUnstageVolumeRequest) (*csi.NodeUnstageVolumeResponse, error)
NodeUnstageVolume is the implementation of CSI Spec NodeUnstageVolume. Performs when the last pod stops consume a volume. This method unmounts volume with appropriate VolumeID from the StagingTargetPath from request. Receives golang context and CSI Spec NodeUnstageVolumeRequest Returns CSI Spec NodeUnstageVolumeResponse or error if something went wrong
func (*CSINodeService) Probe ¶
func (s *CSINodeService) Probe(context.Context, *csi.ProbeRequest) (*csi.ProbeResponse, error)
Probe is the implementation of CSI Spec Probe for IdentityServer. This method checks if CSI driver is ready to serve requests overrides same method from identityServer struct in controller package
func (*CSINodeService) Watch ¶
func (s *CSINodeService) Watch(req *grpc_health_v1.HealthCheckRequest, srv grpc_health_v1.Health_WatchServer) error
Watch is used by clients to receive updates when the svc status changes. Watch only dummy implemented just to satisfy the interface.
type DummyLivenessHelper ¶
type DummyLivenessHelper struct {
CheckResult bool
}
DummyLivenessHelper is a dummy implementation of LivenessHelper interface
func (*DummyLivenessHelper) Check ¶
func (d *DummyLivenessHelper) Check() bool
Check dummy implementation of Check
func (*DummyLivenessHelper) Fail ¶
func (d *DummyLivenessHelper) Fail()
Fail dummy implementation of Fail
type LivenessCheckHelper ¶
type LivenessCheckHelper struct {
// contains filtered or unexported fields
}
LivenessCheckHelper is a helper for node liveness checking
func NewLivenessCheckHelper ¶
func NewLivenessCheckHelper(logger *logrus.Logger, ttl *time.Duration, timeout *time.Duration) *LivenessCheckHelper
NewLivenessCheckHelper returns new instance of LivenessCheckHelper
func (*LivenessCheckHelper) Check ¶
func (h *LivenessCheckHelper) Check() bool
Check returns computed liveness check result
func (*LivenessCheckHelper) OK ¶
func (h *LivenessCheckHelper) OK()
OK marks check as OK, update TTL
type LivenessHelper ¶
type LivenessHelper interface { OK() Fail() Check() bool }
LivenessHelper is an interface that provide method for liveness check
type VolumeManager ¶
type VolumeManager struct {
// contains filtered or unexported fields
}
VolumeManager is the struct to perform volume operations on node side with real storage devices
func NewVolumeManager ¶
func NewVolumeManager( client api.DriveServiceClient, executor command.CmdExecutor, logger *logrus.Logger, k8sClient *k8s.KubeClient, k8sCache k8s.CRReader, recorder eventRecorder, nodeID string) *VolumeManager
NewVolumeManager is the constructor for VolumeManager struct Receives an instance of DriveServiceClient to interact with DriveManager, CmdExecutor to execute linux commands, logrus logger, base.KubeClient and ID of a node where VolumeManager works Returns an instance of VolumeManager
func (*VolumeManager) Discover ¶
func (m *VolumeManager) Discover() error
Discover inspects actual drives structs from DriveManager and create volume object if partition exist on some of them (in case of VolumeManager restart). Updates Drives CRs based on gathered from DriveManager information. Also this method creates AC CRs. Performs at some intervals in a goroutine Returns error if something went wrong during discovering
func (*VolumeManager) Reconcile ¶
Reconcile is the main Reconcile loop of VolumeManager. This loop handles creation of volumes matched to Volume CR on VolumeManagers's node if Volume.Spec.CSIStatus is Creating. Also this loop handles volume deletion on the node if Volume.Spec.CSIStatus is Removing. Returns reconcile result as ctrl.DiscoverResult or error if something went wrong
func (*VolumeManager) SetListBlk ¶
func (m *VolumeManager) SetListBlk(listBlk lsblk.WrapLsblk)
SetListBlk sets listBlk for current VolumeManager instance uses in Sanity testing
func (*VolumeManager) SetProvisioners ¶
func (m *VolumeManager) SetProvisioners(provs map[p.VolumeType]p.Provisioner)
SetProvisioners sets provisioners for current VolumeManager instance uses for UTs and Sanity tests purposes
func (*VolumeManager) SetupWithManager ¶
func (m *VolumeManager) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager registers VolumeManager to ControllerManager
Directories ¶
Path | Synopsis |
---|---|
Package provisioners contains code for Volume CR reconcile handling during which volumes on node are created or removed It operates by underlying structures such as a drives/partitions/file system and encapsulates all low-level work with these objects.
|
Package provisioners contains code for Volume CR reconcile handling during which volumes on node are created or removed It operates by underlying structures such as a drives/partitions/file system and encapsulates all low-level work with these objects. |
utilwrappers
Package utilwrappers consists of code that manipulates by os utils and use code from linuxutils for that Interfaces descriptions: 1.
|
Package utilwrappers consists of code that manipulates by os utils and use code from linuxutils for that Interfaces descriptions: 1. |