common

package
v3.0.0-beta.2+incompat... Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2017 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AnnProvisionedBy is the external provisioner annotation in PV object
	AnnProvisionedBy = "pv.kubernetes.io/provisioned-by"
	// NodeLabelKey is the label key that this provisioner uses for PV node affinity
	// hostname is not the best choice, but it's what pod and node affinity also use
	NodeLabelKey = apis.LabelHostname
	// VolumeTypeFile represents file type volumes
	VolumeTypeFile = "file"
	// VolumeTypeBlock represents block type volumes
	VolumeTypeBlock = "block"

	// DefaultHostDir is the default host dir to discover local volumes.
	DefaultHostDir = "/mnt/disks"
	// DefaultMountDir is the container mount point for the default host dir.
	DefaultMountDir = "/local-disks"

	// EventVolumeFailedDelete copied from k8s.io/kubernetes/pkg/controller/volume/events
	EventVolumeFailedDelete = "VolumeFailedDelete"
)

Variables

This section is empty.

Functions

func ConfigMapDataToVolumeConfig

func ConfigMapDataToVolumeConfig(data map[string]string) (map[string]MountConfig, error)

ConfigMapDataToVolumeConfig converts configmap data to volume config

func CreateLocalPVSpec

func CreateLocalPVSpec(config *LocalPVConfig) *v1.PersistentVolume

CreateLocalPVSpec returns a PV spec that can be used for PV creation

func GetDefaultVolumeConfig

func GetDefaultVolumeConfig() map[string]MountConfig

GetDefaultVolumeConfig returns the default volume configuration.

func GetVolumeConfigFromConfigMap

func GetVolumeConfigFromConfigMap(client *kubernetes.Clientset, namespace, name string) (map[string]MountConfig, error)

GetVolumeConfigFromConfigMap gets volume configuration from given configmap,

func VolumeConfigToConfigMapData

func VolumeConfigToConfigMapData(config map[string]MountConfig) (map[string]string, error)

VolumeConfigToConfigMapData converts volume config to configmap data.

Types

type LocalPVConfig

type LocalPVConfig struct {
	Name            string
	HostPath        string
	Capacity        int64
	StorageClass    string
	ProvisionerName string
	AffinityAnn     string
}

LocalPVConfig defines the parameters for creating a local PV

type MountConfig

type MountConfig struct {
	// The hostpath directory
	HostDir string `json:"hostDir"`
	// The mount point of the hostpath volume
	MountDir string `json:"mountDir"`
}

MountConfig stores a configuration for discoverying a specific storageclass

type RuntimeConfig

type RuntimeConfig struct {
	*UserConfig
	// Unique name of this provisioner
	Name string
	// K8s API client
	Client *kubernetes.Clientset
	// Cache to store PVs managed by this provisioner
	Cache *cache.VolumeCache
	// K8s API layer
	APIUtil util.APIUtil
	// Volume util layer
	VolUtil util.VolumeUtil
	// Recorder is used to record events in the API server
	Recorder record.EventRecorder
}

RuntimeConfig stores all the objects that the provisioner needs to run

type UserConfig

type UserConfig struct {
	// Node object for this node
	Node *v1.Node
	// key = storageclass, value = mount configuration for the storageclass
	DiscoveryMap map[string]MountConfig
}

UserConfig stores all the user-defined parameters to the provisioner

Jump to

Keyboard shortcuts

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