driver

package
v1.56.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2026 License: Apache-2.0 Imports: 50 Imported by: 3

Documentation

Index

Constants

View Source
const (
	// DevicePathKey represents key for device path in PublishContext
	// devicePath is the device path where the volume is attached to.
	DevicePathKey = "devicePath"
	// VolumeIDKey represents key for volume ID in PublishContext
	// Used for node-local volumes to pass the real volume ID.
	VolumeIDKey = "volumeID"
)

constants of keys in PublishContext.

View Source
const (
	// VolumeTypeKey represents key for volume type.
	VolumeTypeKey = "type"

	// IopsPerGBKey represents key for IOPS per GB.
	IopsPerGBKey = "iopspergb"

	// AllowAutoIOPSPerGBIncreaseKey represents key for allowing automatic increase of IOPS.
	AllowAutoIOPSPerGBIncreaseKey = "allowautoiopspergbincrease"

	// AllowAutoIOPSIncreaseOnModifyKey represents key for allowing IOPS increase on resizing if IopsPerGB is set to ensure desired ratio is maintained.
	AllowAutoIOPSIncreaseOnModifyKey = "allowautoiopsincreaseonmodify"

	// VolumeInitializationRateKey represents key for volume initialization rate when creating volumes from snapshots.
	VolumeInitializationRateKey = "volumeinitializationrate"

	// IopsKey represents key for IOPS for volume.
	IopsKey = "iops"

	// ThroughputKey represents key for throughput.
	ThroughputKey = "throughput"

	// EncryptedKey represents key for whether filesystem is encrypted.
	EncryptedKey = "encrypted"

	// KmsKeyIDKey represents key for KMS encryption key.
	KmsKeyIDKey = "kmskeyid"

	// PVCNameKey contains name of the PVC for which is a volume provisioned.
	PVCNameKey = "csi.storage.k8s.io/pvc/name"

	// PVCNamespaceKey contains namespace of the PVC for which is a volume provisioned.
	PVCNamespaceKey = "csi.storage.k8s.io/pvc/namespace"

	// PVNameKey contains name of the final PV that will be used for the dynamically
	// provisioned volume.
	PVNameKey = "csi.storage.k8s.io/pv/name"

	// VolumeSnapshotNameKey contains name of the snapshot.
	VolumeSnapshotNameKey = "csi.storage.k8s.io/volumesnapshot/name"

	// VolumeSnapshotNamespaceKey contains namespace of the snapshot.
	VolumeSnapshotNamespaceKey = "csi.storage.k8s.io/volumesnapshot/namespace"

	// VolumeSnapshotContentNameKey contains name of the VolumeSnapshotContent that is the source
	// for the snapshot.
	VolumeSnapshotContentNameKey = "csi.storage.k8s.io/volumesnapshotcontent/name"

	// DeprecatedBlockExpressKey was previously `BlockExpressKey` now deprecated as all io2 volumes now support up to 256,000 IOPS.
	// See https://docs.aws.amazon.com/ebs/latest/userguide/ebs-volume-types.html.
	DeprecatedBlockExpressKey = "blockexpress"

	// FSTypeKey configures the file system type that will be formatted during volume creation.
	FSTypeKey = "csi.storage.k8s.io/fstype"

	// BlockSizeKey configures the block size when formatting a volume.
	BlockSizeKey = "blocksize"

	// InodeSizeKey configures the inode size when formatting a volume.
	InodeSizeKey = "inodesize"

	// BytesPerInodeKey configures the `bytes-per-inode` when formatting a volume.
	BytesPerInodeKey = "bytesperinode"

	// NumberOfInodesKey configures the `number-of-inodes` when formatting a volume.
	NumberOfInodesKey = "numberofinodes"

	// Ext4BigAllocKey enables the bigalloc option when formatting an ext4 volume.
	Ext4BigAllocKey = "ext4bigalloc"

	// Ext4ClusterSizeKey configures the cluster size when formatting an ext4 volume with the bigalloc option enabled.
	Ext4ClusterSizeKey = "ext4clustersize"

	// Ext4EncryptionSupportKey enables the encrypt option when formatting an ext4 volume.
	Ext4EncryptionSupportKey = "ext4encryptionsupport"

	// TagKeyPrefix contains the prefix of a volume parameter that designates it as
	// a tag to be attached to the resource.
	TagKeyPrefix = "tagSpecification"

	// OutpostArnKey represents key for outpost's arn.
	OutpostArnKey = "outpostarn"

	// BlockAttachUntilInitializedKey will prevent restored volume from being attached until it is fully initialized.
	BlockAttachUntilInitializedKey = "blockattachuntilinitialized"
)

constants of keys in volume parameters.

View Source
const (
	// FastSnapshotRestoreAvailabilityZones represents key for fast snapshot restore availability zones.
	FastSnapshotRestoreAvailabilityZones = "fastsnapshotrestoreavailabilityzones"

	// LockMode represents a key for indicating whether snapshots are locked in Governance or Compliance mode.
	LockMode = "lockmode"

	// LockDuration is a key for the duration for which to lock the snapshots, specified in days.
	LockDuration = "lockduration"

	// LockExpirationDate is a key for specifying the expiration date for the snapshot lock, specified in the format "YYYY-MM-DDThh:mm:ss.sssZ".
	LockExpirationDate = "lockexpirationdate"

	// LockCoolOffPeriod is a key specifying the cooling-off period for compliance mode, specified in hours.
	LockCoolOffPeriod = "lockcooloffperiod"
)

constants of keys in snapshot parameters.

View Source
const (
	// ResourceLifecycleTagPrefix is prefix of tag for provisioned EBS volume that
	// marks them as owned by the cluster. Used only when --cluster-id is set.
	ResourceLifecycleTagPrefix = "kubernetes.io/cluster/"

	// ResourceLifecycleOwned is the value we use when tagging resources to indicate
	// that the resource is considered owned and managed by the cluster,
	// and in particular that the lifecycle is tied to the lifecycle of the cluster.
	// From k8s.io/legacy-cloud-providers/aws/tags.go.
	ResourceLifecycleOwned = "owned"

	// NameTag is tag applied to provisioned EBS volume for backward compatibility with
	// in-tree volume plugin. Used only when --cluster-id is set.
	NameTag = "Name"

	// KubernetesClusterTag is tag applied to provisioned EBS volume for backward compatibility with
	// in-tree volume plugin. Used only when --cluster-id is set.
	// See https://github.com/kubernetes/cloud-provider-aws/blob/release-1.20/pkg/providers/v1/tags.go#L38-L41.
	KubernetesClusterTag = "KubernetesCluster"

	// PVCNameTag is tag applied to provisioned EBS volume for backward compatibility
	// with in-tree volume plugin. Value of the tag is PVC name. It is applied only when
	// the external provisioner sidecar is started with --extra-create-metadata=true and
	// thus provides such metadata to the CSI driver.
	PVCNameTag = "kubernetes.io/created-for/pvc/name"

	// PVCNamespaceTag is tag applied to provisioned EBS volume for backward compatibility
	// with in-tree volume plugin. Value of the tag is PVC namespace. It is applied only when
	// the external provisioner sidecar is started with --extra-create-metadata=true and
	// thus provides such metadata to the CSI driver.
	PVCNamespaceTag = "kubernetes.io/created-for/pvc/namespace"

	// PVNameTag is tag applied to provisioned EBS volume for backward compatibility
	// with in-tree volume plugin. Value of the tag is PV name. It is applied only when
	// the external provisioner sidecar is started with --extra-create-metadata=true and
	// thus provides such metadata to the CSI driver.
	PVNameTag = "kubernetes.io/created-for/pv/name"
)

constants for volume tags and their values.

View Source
const (
	DefaultCSIEndpoint                       = "unix://tmp/csi.sock"
	DefaultModifyVolumeRequestHandlerTimeout = 2 * time.Second
)

constants for default command line flag values.

View Source
const (
	// FSTypeExt3 represents the ext3 filesystem type.
	FSTypeExt3 = "ext3"
	// FSTypeExt4 represents the ext4 filesystem type.
	FSTypeExt4 = "ext4"
	// FSTypeXfs represents the xfs filesystem type.
	FSTypeXfs = "xfs"
	// FSTypeNtfs represents the ntfs filesystem type.
	FSTypeNtfs = "ntfs"
)

constants for fstypes.

Supported access modes.

View Source
const (
	ModificationKeyVolumeType = "type"
	// DeprecatedModificationKeyVolumeType is retained for backwards compatibility, but not recommended.
	DeprecatedModificationKeyVolumeType = "volumeType"

	ModificationKeyIOPS = "iops"

	ModificationKeyThroughput = "throughput"

	ModificationAddTag = "tagSpecification"

	ModificationDeleteTag = "tagDeletion"
)
View Source
const (
	WellKnownZoneTopologyKey = "topology.kubernetes.io/zone"
	// ZoneIDTopologyKey name is purposefully consistent with the CCM's ZoneID topology key.
	// This key is only used for provisioning by az-id and will not be used for node topology
	// to prevent any backwards compatibility issues.
	ZoneIDTopologyKey = "topology.k8s.aws/zone-id"
	OSTopologyKey     = "kubernetes.io/os"
)
View Source
const (
	// NodeLocalVolumeHandlePrefix is the prefix for node-local volume handles.
	NodeLocalVolumeHandlePrefix = "local-ebs://"
)

constants for node-local volumes.

View Source
const (
	// VolumeAttributePartition represents key for partition config in VolumeContext
	// this represents the partition number on a device used to mount.
	VolumeAttributePartition = "partition"
)

constants of keys in VolumeContext.

View Source
const (

	// VolumeOperationAlreadyExists is message fmt returned to CO when there is another in-flight call on the given volumeID.
	VolumeOperationAlreadyExists = "An operation with the given volume=%q is already in progress"
)

Variables

View Source
var (
	AgentNotReadyNodeTaintKey string
	AwsPartitionKey           string
	AwsAccountIDKey           string
	AwsRegionKey              string
	AwsOutpostIDKey           string
	// Deprecated: Use the WellKnownZoneTopologyKey instead.
	ZoneTopologyKey string
)

Initialized in NewDriver (depend on driver name).

View Source
var (
	FileSystemConfigs = map[string]fileSystemConfig{
		FSTypeExt3: {
			NotSupportedParams: map[string]struct{}{
				Ext4BigAllocKey:          {},
				Ext4ClusterSizeKey:       {},
				Ext4EncryptionSupportKey: {},
			},
		},
		FSTypeExt4: {
			NotSupportedParams: map[string]struct{}{},
		},
		FSTypeXfs: {
			NotSupportedParams: map[string]struct{}{
				BytesPerInodeKey:         {},
				NumberOfInodesKey:        {},
				Ext4BigAllocKey:          {},
				Ext4ClusterSizeKey:       {},
				Ext4EncryptionSupportKey: {},
			},
		},
		FSTypeNtfs: {
			NotSupportedParams: map[string]struct{}{
				BlockSizeKey:             {},
				InodeSizeKey:             {},
				BytesPerInodeKey:         {},
				NumberOfInodesKey:        {},
				Ext4BigAllocKey:          {},
				Ext4ClusterSizeKey:       {},
				Ext4EncryptionSupportKey: {},
			},
		},
	}
)
View Source
var (
	ValidFSTypes = map[string]struct{}{
		FSTypeExt3: {},
		FSTypeExt4: {},
		FSTypeXfs:  {},
		FSTypeNtfs: {},
	}
)

Functions

func BuildOutpostArn added in v0.7.0

func BuildOutpostArn(segments map[string]string) string

BuildOutpostArn returns the string representation of the outpost ARN from the given csi.TopologyRequirement.segments.

func GetVersionJSON added in v0.2.0

func GetVersionJSON() (string, error)

func InitOtelTracing added in v1.23.0

func InitOtelTracing() (*otlptrace.Exporter, error)

func ValidateDriverOptions added in v0.5.0

func ValidateDriverOptions(options *Options) error

Types

type ControllerService added in v1.30.0

type ControllerService struct {
	rpc.UnimplementedModifyServer
	csi.UnimplementedControllerServer
	// contains filtered or unexported fields
}

ControllerService represents the controller service of CSI driver.

func NewControllerService added in v1.30.0

func NewControllerService(c cloud.Cloud, o *Options) *ControllerService

NewControllerService creates a new controller service.

func (*ControllerService) ControllerExpandVolume added in v1.30.0

func (*ControllerService) ControllerGetCapabilities added in v1.30.0

func (*ControllerService) ControllerGetVolume added in v1.30.0

func (*ControllerService) ControllerModifyVolume added in v1.30.0

func (*ControllerService) ControllerPublishVolume added in v1.30.0

func (*ControllerService) ControllerUnpublishVolume added in v1.30.0

func (*ControllerService) CreateSnapshot added in v1.30.0

func (*ControllerService) CreateVolume added in v1.30.0

func (*ControllerService) DeleteSnapshot added in v1.30.0

func (*ControllerService) DeleteVolume added in v1.30.0

func (*ControllerService) GetCSIDriverModificationCapability added in v1.30.0

func (*ControllerService) GetCapacity added in v1.30.0

func (*ControllerService) ListSnapshots added in v1.30.0

func (*ControllerService) ListVolumes added in v1.30.0

func (*ControllerService) ModifyVolumeProperties added in v1.30.0

func (*ControllerService) ValidateVolumeCapabilities added in v1.30.0

type Driver

type Driver struct {
	csi.UnimplementedIdentityServer
	// contains filtered or unexported fields
}

func (*Driver) GetPluginInfo

func (d *Driver) GetPluginInfo(ctx context.Context, req *csi.GetPluginInfoRequest) (*csi.GetPluginInfoResponse, error)

func (*Driver) Probe

func (d *Driver) Probe(ctx context.Context, req *csi.ProbeRequest) (*csi.ProbeResponse, error)

func (*Driver) Run

func (d *Driver) Run() error

func (*Driver) Stop

func (d *Driver) Stop()

type JSONPatch added in v1.19.0

type JSONPatch struct {
	OP    string `json:"op,omitempty"`
	Path  string `json:"path,omitempty"`
	Value any    `json:"value"`
}

JSONPatch struct for JSON patch operations.

type Mode added in v0.5.0

type Mode string

Mode is the operating mode of the CSI driver.

const (
	// ControllerMode is the mode that only starts the controller service.
	ControllerMode Mode = "controller"
	// NodeMode is the mode that only starts the node service.
	NodeMode Mode = "node"
	// AllMode is the mode that only starts both the controller and the node service.
	AllMode Mode = "all"

	// MetadataLabelerMode is the mode that starts the metadata labeler.
	MetadataLabelerMode = "metadataLabeler"
)

type NodeService added in v1.30.0

type NodeService struct {
	csi.UnimplementedNodeServer
	// contains filtered or unexported fields
}

NodeService represents the node service of CSI driver.

func NewNodeService added in v1.30.0

NewNodeService creates a new node service.

func (*NodeService) NodeExpandVolume added in v1.30.0

func (*NodeService) NodeGetCapabilities added in v1.30.0

func (*NodeService) NodeGetInfo added in v1.30.0

func (*NodeService) NodeGetVolumeStats added in v1.30.0

func (*NodeService) NodePublishVolume added in v1.30.0

func (*NodeService) NodeStageVolume added in v1.30.0

func (*NodeService) NodeUnpublishVolume added in v1.30.0

func (*NodeService) NodeUnstageVolume added in v1.30.0

type Options added in v1.30.0

type Options struct {
	Mode Mode

	// Kubeconfig is an absolute path to a kubeconfig file.
	// If empty, the in-cluster config will be loaded.
	Kubeconfig string

	// Endpoint is the endpoint for the CSI driver server
	Endpoint string
	// HTTPEndpoint is the TCP network address where the HTTP server for metrics will listen
	HTTPEndpoint string
	// MetricsCertFile is the location of the certificate for serving the metrics server over HTTPS
	MetricsCertFile string
	// MetricsKeyFile is the location of the key for serving the metrics server over HTTPS
	MetricsKeyFile string
	// EnableOtelTracing is a flag to enable opentelemetry tracing for the driver
	EnableOtelTracing bool

	// ExtraTags is a map of tags that will be attached to each dynamically provisioned
	// resource.
	ExtraTags map[string]string
	// ExtraVolumeTags is a map of tags that will be attached to each dynamically provisioned
	// volume.
	//
	// Deprecated: Use ExtraTags instead.
	ExtraVolumeTags map[string]string
	// ID of the kubernetes cluster.
	KubernetesClusterID string
	// flag to enable sdk debug log
	AwsSdkDebugLog bool
	// flag to warn on invalid tag, instead of returning an error
	WarnOnInvalidTag bool
	// flag to set user agent
	UserAgentExtra string
	// flag to enable batching of API calls
	Batching bool
	// flag to set the timeout for volume modification requests to be coalesced into a single
	// volume modification call to AWS.
	ModifyVolumeRequestHandlerTimeout time.Duration
	// flag to enable deprecated metrics
	DeprecatedMetrics bool
	// flag to enable node-local volume support
	EnableNodeLocalVolumes bool

	// VolumeAttachLimit specifies the value that shall be reported as "maximum number of attachable volumes"
	// in CSINode objects. It is similar to https://kubernetes.io/docs/concepts/storage/storage-limits/#custom-limits
	// which allowed administrators to specify custom volume limits by configuring the kube-scheduler. Also, each AWS
	// machine type has different volume limits. By default, the EBS CSI driver parses the machine type name and then
	// decides the volume limit. However, this is only a rough approximation and not good enough in most cases.
	// Specifying the volume attach limit via command line is the alternative until a more sophisticated solution presents
	// itself (dynamically discovering the maximum number of attachable volume per EC2 machine type, see also
	// https://github.com/kubernetes-sigs/aws-ebs-csi-driver/issues/347).
	VolumeAttachLimit int64
	// ReservedVolumeAttachments specifies number of volume attachments reserved for system use.
	// Typically 1 for the root disk, but may be larger when more system disks are attached to nodes.
	// This option is not used when --volume-attach-limit is specified.
	// When -1, the amount of reserved attachments is loaded from instance metadata that captured state at node boot
	// and may include not only system disks but also CSI volumes (and therefore it may be wrong).
	ReservedVolumeAttachments int
	// ALPHA: WindowsHostProcess indicates whether the driver is running in a Windows privileged container
	WindowsHostProcess bool
	// LegacyXFSProgs formats XFS volumes with `bigtime=0,inobtcount=0,reflink=0,nrext64=0`, so that they can be mounted onto nodes with linux kernel ≤ v5.4. Volumes formatted with this option may experience issues after 2038, and will be unable to use some XFS features (for example, reflinks).
	LegacyXFSProgs bool
	// CsiMountPointPath is the path where CSI volumes are expected to be mounted on the node.
	CsiMountPointPath string
	// MetadataSources dictates which sources are used to retrieve instance metadata.
	// The driver will attempt to rely on each source in order until one succeeds.
	// Valid options include 'imds' and 'kubernetes'.
	MetadataSources []string
}

Options contains options and configuration settings for the driver.

func (*Options) AddFlags added in v1.30.0

func (o *Options) AddFlags(f *flag.FlagSet)

func (*Options) Validate added in v1.30.0

func (o *Options) Validate() error

type VersionInfo added in v0.2.0

type VersionInfo struct {
	DriverVersion string `json:"driverVersion"`
	GitCommit     string `json:"gitCommit"`
	BuildDate     string `json:"buildDate"`
	GoVersion     string `json:"goVersion"`
	Compiler      string `json:"compiler"`
	Platform      string `json:"platform"`
}

func GetVersion added in v0.2.0

func GetVersion() VersionInfo

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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