kubernetes

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 License: Apache-2.0 Imports: 42 Imported by: 0

Documentation

Overview

Copyright 2020 NetApp, Inc. All Rights Reserved.

Copyright 2020 NetApp, Inc. All Rights Reserved.

Copyright 2020 NetApp, Inc. All Rights Reserved.

Copyright 2020 NetApp, Inc. All Rights Reserved.

Index

Constants

View Source
const (
	CacheSyncPeriod         = 60 * time.Second
	PreSyncCacheWaitPeriod  = 10 * time.Second
	PostSyncCacheWaitPeriod = 30 * time.Second
	ResizeSyncPeriod        = 3 * time.Minute
	PVDeleteWaitPeriod      = 30 * time.Second
	PodDeleteWaitPeriod     = 60 * time.Second
	ImportPVCacheWaitPeriod = 180 * time.Second

	CacheBackoffInitialInterval     = 1 * time.Second
	CacheBackoffRandomizationFactor = 0.1
	CacheBackoffMultiplier          = 1.414
	CacheBackoffMaxInterval         = 5 * time.Second

	// Kubernetes-defined storage class parameters
	K8sFsType          = "fsType"
	CSIParameterPrefix = "csi.storage.k8s.io/"

	// Kubernetes-defined annotations
	// (Based on kubernetes/pkg/controller/volume/persistentvolume/controller.go)
	AnnClass                  = "volume.beta.kubernetes.io/storage-class"
	AnnDynamicallyProvisioned = "pv.kubernetes.io/provisioned-by"
	AnnBindCompleted          = "pv.kubernetes.io/bind-completed"
	AnnStorageProvisioner     = "volume.beta.kubernetes.io/storage-provisioner"

	// Kubernetes-defined finalizers
	FinalizerPVProtection = "kubernetes.io/pv-protection"

	AnnProtocol           = annPrefix + "/protocol"
	AnnSnapshotPolicy     = annPrefix + "/snapshotPolicy"
	AnnSnapshotReserve    = annPrefix + "/snapshotReserve"
	AnnSnapshotDir        = annPrefix + "/snapshotDirectory"
	AnnUnixPermissions    = annPrefix + "/unixPermissions"
	AnnExportPolicy       = annPrefix + "/exportPolicy"
	AnnBlockSize          = annPrefix + "/blockSize"
	AnnFileSystem         = annPrefix + "/fileSystem"
	AnnCloneFromPVC       = annPrefix + "/cloneFromPVC"
	AnnSplitOnClone       = annPrefix + "/splitOnClone"
	AnnNotManaged         = annPrefix + "/notManaged"
	AnnImportOriginalName = annPrefix + "/importOriginalName"
	AnnImportBackendUUID  = annPrefix + "/importBackendUUID"
	AnnMirrorRelationship = annPrefix + "/mirrorRelationship"
	AnnVolumeShareFromPVC = annPrefix + "/shareFromPVC"
	AnnVolumeShareToNS    = annPrefix + "/shareToNamespace"
)

Variables

This section is empty.

Functions

func MetaNameKeyFunc

func MetaNameKeyFunc(obj interface{}) ([]string, error)

MetaNameKeyFunc is a KeyFunc which knows how to make keys for API objects which implement meta.Interface. The key is the object's name.

func MetaUIDKeyFunc

func MetaUIDKeyFunc(obj interface{}) ([]string, error)

MetaUIDKeyFunc is a KeyFunc which knows how to make keys for API objects which implement meta.Interface. The key is the object's UID.

func TridentVolumeReferenceKeyFunc

func TridentVolumeReferenceKeyFunc(obj interface{}) ([]string, error)

TridentVolumeReferenceKeyFunc is a KeyFunc which knows how to make keys for TridentVolumeReference CRs. The key is of the format "<CR namespace>_<referenced PVC namespce>/<referenced PVC name>".

Types

type K8SHelperPlugin

type K8SHelperPlugin interface {
	frontend.Plugin
	ImportVolume(ctx context.Context, request *storage.ImportVolumeRequest) (*storage.VolumeExternal, error)
	UpgradeVolume(ctx context.Context, request *storage.UpgradeVolumeRequest) (*storage.VolumeExternal, error)
}

type Plugin

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

func NewPlugin

func NewPlugin(orchestrator core.Orchestrator, masterURL, kubeConfigPath string) (*Plugin, error)

NewPlugin instantiates this plugin when running outside a pod.

func (*Plugin) Activate

func (p *Plugin) Activate() error

Activate starts this Trident frontend.

func (*Plugin) Deactivate

func (p *Plugin) Deactivate() error

Deactivate stops this Trident frontend.

func (*Plugin) GetName

func (p *Plugin) GetName() string

GetName returns the name of this Trident frontend.

func (*Plugin) GetNode

func (p *Plugin) GetNode(ctx context.Context, nodeName string) (*v1.Node, error)

func (*Plugin) GetNodeTopologyLabels

func (p *Plugin) GetNodeTopologyLabels(ctx context.Context, nodeName string) (map[string]string, error)

func (*Plugin) GetSnapshotConfig

func (p *Plugin) GetSnapshotConfig(volumeName, snapshotName string) (*storage.SnapshotConfig, error)

GetSnapshotConfig accepts the attributes of a snapshot being requested by the CSI provisioner and returns a SnapshotConfig structure as needed by Trident to create a new snapshot.

func (*Plugin) GetVolumeConfig

func (p *Plugin) GetVolumeConfig(
	ctx context.Context, name string, _ int64, _ map[string]string, _ config.Protocol, _ []config.AccessMode,
	_ config.VolumeMode, fsType string, requisiteTopology, preferredTopology, _ []map[string]string,
) (*storage.VolumeConfig, error)

GetVolumeConfig accepts the attributes of a volume being requested by the CSI provisioner, combines those with PVC and storage class info retrieved from the K8S API server, and returns a VolumeConfig structure as needed by Trident to create a new volume.

func (*Plugin) ImportVolume

func (p *Plugin) ImportVolume(
	ctx context.Context, request *storage.ImportVolumeRequest,
) (*storage.VolumeExternal, error)

func (*Plugin) RecordNodeEvent

func (p *Plugin) RecordNodeEvent(ctx context.Context, name, eventType, reason, message string)

RecordNodeEvent accepts the name of a CSI volume (i.e. a PV name), finds the associated PVC, and posts and event message on the PVC object with the K8S API server.

func (*Plugin) RecordVolumeEvent

func (p *Plugin) RecordVolumeEvent(ctx context.Context, name, eventType, reason, message string)

RecordVolumeEvent accepts the name of a CSI volume (i.e. a PV name), finds the associated PVC, and posts and event message on the PVC object with the K8S API server.

func (*Plugin) SupportsFeature

func (p *Plugin) SupportsFeature(ctx context.Context, feature helpers.Feature) bool

SupportsFeature accepts a CSI feature and returns true if the feature exists and is supported.

func (*Plugin) UpgradeVolume

func (p *Plugin) UpgradeVolume(
	ctx context.Context, request *storage.UpgradeVolumeRequest,
) (*storage.VolumeExternal, error)

func (*Plugin) Version

func (p *Plugin) Version() string

Version returns the version of this Trident frontend (the detected K8S version).

Jump to

Keyboard shortcuts

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