driver

package
v1.23.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Keys for PV and PVC parameters as reported by external-provisioner.
	ParameterKeyPVCName      = "csi.storage.k8s.io/pvc/name"
	ParameterKeyPVCNamespace = "csi.storage.k8s.io/pvc/namespace"
	ParameterKeyPVName       = "csi.storage.k8s.io/pv/name"

	// User provided labels.
	ParameterKeyLabels = "labels"
)

CreateVolume parameters.

View Source
const (
	UmountTimeout = time.Second * 5
	// GCSFuseKernelParamsFilePollInterval is the interval at which the GCSFuse kernel
	// parameters file is polled and any changes to kernel parameter files are applied.
	GCSFuseKernelParamsFilePollInterval = time.Second * 5
	FuseMountType                       = "fuse"
)
View Source
const (
	CreateVolumeCSIFullMethod      = "/csi.v1.Controller/CreateVolume"
	DeleteVolumeCSIFullMethod      = "/csi.v1.Controller/DeleteVolume"
	NodePublishVolumeCSIFullMethod = "/csi.v1.Node/NodePublishVolume"

	// START of GCS Fuse Volume Attributes
	VolumeContextKeyMountOptions               = "mountOptions"
	VolumeContextKeyFileCacheCapacity          = "fileCacheCapacity"
	VolumeContextKeyFileCacheForRangeRead      = "fileCacheForRangeRead"
	VolumeContextKeyMetadataStatCacheCapacity  = "metadataStatCacheCapacity"
	VolumeContextKeyMetadataTypeCacheCapacity  = "metadataTypeCacheCapacity"
	VolumeContextKeyMetadataCacheTTLSeconds    = "metadataCacheTTLSeconds"
	VolumeContextKeyGcsfuseLoggingSeverity     = "gcsfuseLoggingSeverity"
	VolumeContextKeySkipCSIBucketAccessCheck   = "skipCSIBucketAccessCheck"
	VolumeContextKeyHostNetworkPodKSA          = "hostNetworkPodKSA"
	VolumeContextKeyIdentityProvider           = "identityProvider"
	VolumeContextKeyDisableMetrics             = "disableMetrics"
	VolumeContextKeyIdentityPool               = "identityPool"
	VolumeContextKeyMultiNICIndex              = "multiNICIndex"
	VolumeContextEnableCloudProfilerForSidecar = "enableCloudProfilerForSidecar"
	// Legacy key, kept for backward compatibility
	//nolint:revive,stylecheck
	VolumeContextKeyMetadataCacheTtlSeconds = "metadataCacheTtlSeconds"

	VolumeContextKeyServiceAccountName = "csi.storage.k8s.io/serviceAccount.name"
	//nolint:gosec
	VolumeContextKeyServiceAccountToken    = "csi.storage.k8s.io/serviceAccount.tokens"
	VolumeContextKeyPodName                = "csi.storage.k8s.io/pod.name"
	VolumeContextKeyPodNamespace           = "csi.storage.k8s.io/pod.namespace"
	VolumeContextKeyEphemeral              = "csi.storage.k8s.io/ephemeral"
	VolumeContextKeyBucketName             = "bucketName"
	TokenServerSidecarMinVersion           = "v1.17.2-gke.0" // #nosec G101
	SidecarBucketAccessCheckMinVersion     = "v1.20.0-gke.0"
	SidecarCloudProfilerMinVersion         = "v1.19.0-gke.0"
	MachineTypeAutoConfigSidecarMinVersion = "v1.15.1-gke.0" // #nosec G101
	GCSFuseProfilesMinVersion              = "v1.19.3-gke.0"
	GCSFuseFileCacheMediumMinVersion       = "v1.21.0-gke.0"
	GCSFuseKernelParamsMinVersion          = "v1.22.0-gke.0"
	MultiNICMinVersion                     = "v1.22.2-gke.0"
	FlagFileForDefaultingPath              = "flags-for-defaulting"
	GCSFuseProfileFlag                     = "profile"
	LocalSocketAddressArg                  = "experimental-local-socket-address"
)
View Source
const DefaultName = "gcsfuse.csi.storage.gke.io"
View Source
const (
	MinimumVolumeSizeInBytes int64 = 1 * util.Mb
)

Variables

This section is empty.

Functions

func AddSourceRouteForDevice added in v1.22.0

func AddSourceRouteForDevice(mgr NetworkManager, device string) (string, error)

AddSourceRouteForDevice checks for an existing source routing for device, and adds routing table information if necessary.

To check this manually, run `ip route show all` and look for lines like

10.144.16.1 dev eth0 proto dhcp scope link src 10.144.16.8 metric 1024

This says that the gateway for eth0 is 10.144.16.1, and the source IP for traffic emanating from eth0, or the source to bind to for sending from the device, is 10.144.16.8.

The source IP used is returned.

func GetDeviceForNumaNode added in v1.22.0

func GetDeviceForNumaNode(mgr NetworkManager, node int) (device, message string, err error)

GetDeviceForNumaNode returns a device name for the node, if one exists. If there are multiple devices, a gVINC driver is perferred. The message return value is a string that can be displayed in an event as a warning to the user.

If no devices are associated with a NUMA node, then this uses node as an index into the list of gVNIC & virtio devices. This is to allow use with platforms that have multiple devices but no NUMA alignment, for example n2-standard-64.

If there are any NUMA-associated devices, but none matching `node`, then this will error.

func ParseFlagMapFromFlagFile added in v1.15.0

func ParseFlagMapFromFlagFile(flagFileContent string) map[string]string

func PutFlagsFromDriverToTargetPath added in v1.15.0

func PutFlagsFromDriverToTargetPath(flagMap map[string]string, targetPath string, fileName string) error

Types

type FeatureGCSFuseProfiles added in v1.20.0

type FeatureGCSFuseProfiles struct {
	Enabled                       bool
	ScannerConfig                 *profiles.ScannerConfig
	EnableGcsfuseProfilesInternal bool
}

type GCSDriver

type GCSDriver struct {
	// contains filtered or unexported fields
}

func NewGCSDriver

func NewGCSDriver(config *GCSDriverConfig, recorder record.EventRecorder) (*GCSDriver, error)

func (*GCSDriver) RecordEventf added in v1.22.0

func (driver *GCSDriver) RecordEventf(object runtime.Object, eventtype, reason, messageFmt string, args ...interface{})

RecordEventf wraps EventRecorder.Eventf for the recorder in driver.

func (*GCSDriver) Run

func (driver *GCSDriver) Run(ctx context.Context, cancel context.CancelFunc, endpoint string)

func (*GCSDriver) ValidateControllerServiceRequest

func (driver *GCSDriver) ValidateControllerServiceRequest(c csi.ControllerServiceCapability_RPC_Type) error

type GCSDriverConfig

type GCSDriverConfig struct {
	Name                           string // Driver name
	Version                        string // Driver version
	NodeID                         string // Node name
	RunController                  bool   // Run CSI controller service
	RunNode                        bool   // Run CSI node service
	StorageServiceManager          storage.ServiceManager
	TokenManager                   auth.TokenManager
	Mounter                        mount.Interface
	NetworkManager                 NetworkManager
	K8sClients                     clientset.Interface
	MetricsManager                 metrics.Manager
	DisableAutoconfig              bool
	EnableSidecarBucketAccessCheck bool
	WINodeLabelCheck               bool
	EnableCloudProfilerForSidecar  bool
	FeatureOptions                 *GCSDriverFeatureOptions
	AssumeGoodSidecarVersion       bool
}

type GCSDriverFeatureOptions added in v1.18.0

type GCSDriverFeatureOptions struct {
	EnableGCSFuseKernelParams bool
	FeatureGCSFuseProfiles    *FeatureGCSFuseProfiles
}

type LinkDevice added in v1.22.0

type LinkDevice struct {
	Name string

	// Driver is the driver name of the device, eg gve or virtio_net.
	Driver string

	// NumaNode is the node of the device, or -1 if no affinity.
	NumaNode int
}

LinkDevice is information for a particular interface like eth0.

type NetworkManager added in v1.22.0

type NetworkManager interface {
	Lock()
	Unlock()
	GetRouteTable() (string, error)
	UpdateRouteTable(line string) error
	ListDevices() ([]LinkDevice, error)
	ListRoutesForDevice(device string) ([]Route, error)
	ListTables() (map[int]bool, error)
	ListRulesForTable(table int) ([]Rule, error)
	ListRoutesForTable(table int) ([]Route, error)
	AddRule(table int, sourceIP string) error
	AddRoute(table int, gatewayIP, device string) error
}

NetworkManager sets up routing tables to configure NIC usage. It should be used with GetDeviceForNumaNode and AddSourceRouteForDevice; its purpose is to split application logic from system manipulation, for testing.

The routines are not synchronized, because, eg, the combined operation of GetRouteTable and UpdateRouteTable need to be collectively atomic. The Lock and Unlock functions expose a mutex that can be used to serialize operations for a NetworkManager.

func NewNetworkManager added in v1.22.0

func NewNetworkManager() NetworkManager

NewNetworkManager returns a real network manager that manipulates routing tables.

type NonBlockingGRPCServer

type NonBlockingGRPCServer interface {
	// Start services at the endpoint
	Start(endpoint string, ids csi.IdentityServer, cs csi.ControllerServer, ns csi.NodeServer)
	// Waits for the service to stop
	Wait()
	// Stops the service gracefully
	Stop()
	// Stops the service forcefully
	ForceStop()
}

Defines Non blocking GRPC server interfaces.

func NewNonBlockingGRPCServer

func NewNonBlockingGRPCServer() NonBlockingGRPCServer

type Route added in v1.22.0

type Route struct {
	Device  string
	Gateway string
	Source  string
	Table   int
}

Route is a simplification of netlink Route.

type Rule added in v1.22.0

type Rule struct {
	Source string
	Table  int
}

Rule is a simplification of netlink Rule.

Jump to

Keyboard shortcuts

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