node

package
v0.2.2-beta Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2021 License: Apache-2.0 Imports: 54 Imported by: 0

Documentation

Overview

Package node contains implementation of CSI Node component

Index

Constants

View Source
const (
	// LivenessDefaultTTL default TTL for node liveness checker
	LivenessDefaultTTL = 2 * time.Minute
	// LivenessDefaultTimeout hard timeout for node liveness checker
	LivenessDefaultTimeout = 10 * time.Minute
)
View Source
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"
)
View Source
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

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

NodeExpandVolume returns empty response

func (*CSINodeService) NodeGetCapabilities

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

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

NodeGetVolumeStats returns empty response

func (*CSINodeService) NodePublishVolume

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

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

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

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

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

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

func (*DummyLivenessHelper) OK

func (d *DummyLivenessHelper) OK()

OK dummy implementation of OK

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) Fail

func (h *LivenessCheckHelper) Fail()

Fail marks check as failed

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

func (m *VolumeManager) Reconcile(req ctrl.Request) (ctrl.Result, error)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL