Documentation ¶
Index ¶
- Constants
- func NewAssumeCache(informer cache.SharedIndexInformer, description, indexName string, ...) *assumeCache
- type AssumeCache
- type ControllerParameters
- type FakeVolumeBinder
- func (b *FakeVolumeBinder) AssumePodVolumes(assumedPod *v1.Pod, nodeName string) (bool, bool, error)
- func (b *FakeVolumeBinder) BindPodVolumes(assumedPod *v1.Pod) error
- func (b *FakeVolumeBinder) FindPodVolumes(pod *v1.Pod, node *v1.Node) (unboundVolumesSatisfied, boundVolumesSatsified bool, err error)
- func (b *FakeVolumeBinder) GetBindingsCache() PodBindingCache
- type FakeVolumeBinderConfig
- type PVAssumeCache
- type PersistentVolumeController
- func (ctrl *PersistentVolumeController) GetCloudProvider() cloudprovider.Interface
- func (adc *PersistentVolumeController) GetConfigMapFunc() func(namespace, name string) (*v1.ConfigMap, error)
- func (adc *PersistentVolumeController) GetExec(pluginName string) mount.Exec
- func (ctrl *PersistentVolumeController) GetHostIP() (net.IP, error)
- func (ctrl *PersistentVolumeController) GetHostName() string
- func (ctrl *PersistentVolumeController) GetKubeClient() clientset.Interface
- func (ctrl *PersistentVolumeController) GetMounter(pluginName string) mount.Interface
- func (ctrl *PersistentVolumeController) GetNodeAllocatable() (v1.ResourceList, error)
- func (ctrl *PersistentVolumeController) GetNodeLabels() (map[string]string, error)
- func (ctrl *PersistentVolumeController) GetNodeName() types.NodeName
- func (ctrl *PersistentVolumeController) GetPluginDir(pluginName string) string
- func (ctrl *PersistentVolumeController) GetPodPluginDir(podUID types.UID, pluginName string) string
- func (ctrl *PersistentVolumeController) GetPodVolumeDeviceDir(ppodUID types.UID, pluginName string) string
- func (ctrl *PersistentVolumeController) GetPodVolumeDir(podUID types.UID, pluginName string, volumeName string) string
- func (adc *PersistentVolumeController) GetSecretFunc() func(namespace, name string) (*v1.Secret, error)
- func (ctrl *PersistentVolumeController) GetVolumeDevicePluginDir(pluginName string) string
- func (ctrl *PersistentVolumeController) GetWriter() io.Writer
- func (ctrl *PersistentVolumeController) NewWrapperMounter(volName string, spec vol.Spec, pod *v1.Pod, opts vol.VolumeOptions) (vol.Mounter, error)
- func (ctrl *PersistentVolumeController) NewWrapperUnmounter(volName string, spec vol.Spec, podUID types.UID) (vol.Unmounter, error)
- func (ctrl *PersistentVolumeController) Run(stopCh <-chan struct{})
- type PodBindingCache
- type SchedulerVolumeBinder
Constants ¶
const CloudVolumeCreatedForClaimNameTag = "kubernetes.io/created-for/pvc/name"
CloudVolumeCreatedForClaimNameTag is a name of a tag attached to a real volume in cloud (e.g. AWS EBS or GCE PD) with name of a persistent volume claim used to create this volume.
const CloudVolumeCreatedForClaimNamespaceTag = "kubernetes.io/created-for/pvc/namespace"
CloudVolumeCreatedForClaimNamespaceTag is a name of a tag attached to a real volume in cloud (e.g. AWS EBS or GCE PD) with namespace of a persistent volume claim used to create this volume.
const CloudVolumeCreatedForVolumeNameTag = "kubernetes.io/created-for/pv/name"
CloudVolumeCreatedForVolumeNameTag is a name of a tag attached to a real volume in cloud (e.g. AWS EBS or GCE PD) with name of appropriate Kubernetes persistent volume .
Variables ¶
This section is empty.
Functions ¶
func NewAssumeCache ¶ added in v1.9.1
func NewAssumeCache(informer cache.SharedIndexInformer, description, indexName string, indexFunc cache.IndexFunc) *assumeCache
Types ¶
type AssumeCache ¶ added in v1.9.1
type AssumeCache interface { // Assume updates the object in-memory only Assume(obj interface{}) error // Restore the informer cache's version of the object Restore(objName string) // Get the object by name Get(objName string) (interface{}, error) // List all the objects in the cache List(indexObj interface{}) []interface{} }
AssumeCache is a cache on top of the informer that allows for updating objects outside of informer events and also restoring the informer cache's version of the object. Objects are assumed to be Kubernetes API objects that implement meta.Interface
type ControllerParameters ¶ added in v1.5.1
type ControllerParameters struct { KubeClient clientset.Interface SyncPeriod time.Duration VolumePlugins []vol.VolumePlugin Cloud cloudprovider.Interface ClusterName string VolumeInformer coreinformers.PersistentVolumeInformer ClaimInformer coreinformers.PersistentVolumeClaimInformer ClassInformer storageinformers.StorageClassInformer PodInformer coreinformers.PodInformer EventRecorder record.EventRecorder EnableDynamicProvisioning bool }
ControllerParameters contains arguments for creation of a new PersistentVolume controller.
type FakeVolumeBinder ¶ added in v1.9.1
type FakeVolumeBinder struct { AssumeCalled bool BindCalled bool // contains filtered or unexported fields }
func NewFakeVolumeBinder ¶ added in v1.9.1
func NewFakeVolumeBinder(config *FakeVolumeBinderConfig) *FakeVolumeBinder
NewVolumeBinder sets up all the caches needed for the scheduler to make topology-aware volume binding decisions.
func (*FakeVolumeBinder) AssumePodVolumes ¶ added in v1.9.1
func (*FakeVolumeBinder) BindPodVolumes ¶ added in v1.9.1
func (b *FakeVolumeBinder) BindPodVolumes(assumedPod *v1.Pod) error
func (*FakeVolumeBinder) FindPodVolumes ¶ added in v1.9.1
func (*FakeVolumeBinder) GetBindingsCache ¶ added in v1.9.1
func (b *FakeVolumeBinder) GetBindingsCache() PodBindingCache
type FakeVolumeBinderConfig ¶ added in v1.9.1
type PVAssumeCache ¶ added in v1.9.1
type PVAssumeCache interface { AssumeCache GetPV(pvName string) (*v1.PersistentVolume, error) ListPVs(storageClassName string) []*v1.PersistentVolume }
PVAssumeCache is a AssumeCache for PersistentVolume objects
func NewPVAssumeCache ¶ added in v1.9.1
func NewPVAssumeCache(informer cache.SharedIndexInformer) PVAssumeCache
type PersistentVolumeController ¶
type PersistentVolumeController struct {
// contains filtered or unexported fields
}
PersistentVolumeController is a controller that synchronizes PersistentVolumeClaims and PersistentVolumes. It starts two cache.Controllers that watch PersistentVolume and PersistentVolumeClaim changes.
func NewController ¶ added in v1.5.1
func NewController(p ControllerParameters) (*PersistentVolumeController, error)
NewController creates a new PersistentVolume controller
func (*PersistentVolumeController) GetCloudProvider ¶
func (ctrl *PersistentVolumeController) GetCloudProvider() cloudprovider.Interface
func (*PersistentVolumeController) GetConfigMapFunc ¶ added in v1.7.0
func (adc *PersistentVolumeController) GetConfigMapFunc() func(namespace, name string) (*v1.ConfigMap, error)
func (*PersistentVolumeController) GetExec ¶ added in v1.8.0
func (adc *PersistentVolumeController) GetExec(pluginName string) mount.Exec
func (*PersistentVolumeController) GetHostIP ¶
func (ctrl *PersistentVolumeController) GetHostIP() (net.IP, error)
func (*PersistentVolumeController) GetHostName ¶
func (ctrl *PersistentVolumeController) GetHostName() string
func (*PersistentVolumeController) GetKubeClient ¶
func (ctrl *PersistentVolumeController) GetKubeClient() clientset.Interface
func (*PersistentVolumeController) GetMounter ¶
func (ctrl *PersistentVolumeController) GetMounter(pluginName string) mount.Interface
func (*PersistentVolumeController) GetNodeAllocatable ¶ added in v1.4.2
func (ctrl *PersistentVolumeController) GetNodeAllocatable() (v1.ResourceList, error)
func (*PersistentVolumeController) GetNodeLabels ¶ added in v1.7.0
func (ctrl *PersistentVolumeController) GetNodeLabels() (map[string]string, error)
func (*PersistentVolumeController) GetNodeName ¶ added in v1.9.1
func (ctrl *PersistentVolumeController) GetNodeName() types.NodeName
func (*PersistentVolumeController) GetPluginDir ¶
func (ctrl *PersistentVolumeController) GetPluginDir(pluginName string) string
func (*PersistentVolumeController) GetPodPluginDir ¶
func (ctrl *PersistentVolumeController) GetPodPluginDir(podUID types.UID, pluginName string) string
func (*PersistentVolumeController) GetPodVolumeDeviceDir ¶ added in v1.9.1
func (ctrl *PersistentVolumeController) GetPodVolumeDeviceDir(ppodUID types.UID, pluginName string) string
func (*PersistentVolumeController) GetPodVolumeDir ¶
func (*PersistentVolumeController) GetSecretFunc ¶ added in v1.6.0
func (adc *PersistentVolumeController) GetSecretFunc() func(namespace, name string) (*v1.Secret, error)
func (*PersistentVolumeController) GetVolumeDevicePluginDir ¶ added in v1.9.1
func (ctrl *PersistentVolumeController) GetVolumeDevicePluginDir(pluginName string) string
func (*PersistentVolumeController) GetWriter ¶
func (ctrl *PersistentVolumeController) GetWriter() io.Writer
func (*PersistentVolumeController) NewWrapperMounter ¶
func (*PersistentVolumeController) NewWrapperUnmounter ¶
func (*PersistentVolumeController) Run ¶
func (ctrl *PersistentVolumeController) Run(stopCh <-chan struct{})
Run starts all of this controller's control loops
type PodBindingCache ¶ added in v1.9.1
type PodBindingCache interface { // UpdateBindings will update the cache with the given bindings for the // pod and node. UpdateBindings(pod *v1.Pod, node string, bindings []*bindingInfo) // DeleteBindings will remove all cached bindings for the given pod. DeleteBindings(pod *v1.Pod) // GetBindings will return the cached bindings for the given pod and node. GetBindings(pod *v1.Pod, node string) []*bindingInfo }
podBindingCache stores PV binding decisions per pod per node. Pod entries are removed when the Pod is deleted or updated to no longer be schedulable.
func NewPodBindingCache ¶ added in v1.9.1
func NewPodBindingCache() PodBindingCache
type SchedulerVolumeBinder ¶ added in v1.9.1
type SchedulerVolumeBinder interface { // FindPodVolumes checks if all of a Pod's PVCs can be satisfied by the node. // // If a PVC is bound, it checks if the PV's NodeAffinity matches the Node. // Otherwise, it tries to find an available PV to bind to the PVC. // // It returns true if there are matching PVs that can satisfy all of the Pod's PVCs, and returns true // if bound volumes satisfy the PV NodeAffinity. // // This function is called by the volume binding scheduler predicate and can be called in parallel FindPodVolumes(pod *v1.Pod, node *v1.Node) (unboundVolumesSatisified, boundVolumesSatisfied bool, err error) // AssumePodVolumes will take the PV matches for unbound PVCs and update the PV cache assuming // that the PV is prebound to the PVC. // // It returns true if all volumes are fully bound, and returns true if any volume binding API operation needs // to be done afterwards. // // This function will modify assumedPod with the node name. // This function is called serially. AssumePodVolumes(assumedPod *v1.Pod, nodeName string) (allFullyBound bool, bindingRequired bool, err error) // BindPodVolumes will initiate the volume binding by making the API call to prebind the PV // to its matching PVC. // // This function can be called in parallel. BindPodVolumes(assumedPod *v1.Pod) error // GetBindingsCache returns the cache used (if any) to store volume binding decisions. GetBindingsCache() PodBindingCache }
SchedulerVolumeBinder is used by the scheduler to handle PVC/PV binding and dynamic provisioning. The binding decisions are integrated into the pod scheduling workflow so that the PV NodeAffinity is also considered along with the pod's other scheduling requirements.
This integrates into the existing default scheduler workflow as follows:
- The scheduler takes a Pod off the scheduler queue and processes it serially: a. Invokes all predicate functions, parallelized across nodes. FindPodVolumes() is invoked here. b. Invokes all priority functions. Future/TBD c. Selects the best node for the Pod. d. Cache the node selection for the Pod. (Assume phase) i. If PVC binding is required, cache in-memory only: * Updated PV objects for prebinding to the corresponding PVCs. * For the pod, which PVs need API updates. AssumePodVolumes() is invoked here. Then BindPodVolumes() is called asynchronously by the scheduler. After BindPodVolumes() is complete, the Pod is added back to the scheduler queue to be processed again until all PVCs are bound. ii. If PVC binding is not required, cache the Pod->Node binding in the scheduler's pod cache, and asynchronously bind the Pod to the Node. This is handled in the scheduler and not here.
- Once the assume operation is done, the scheduler processes the next Pod in the scheduler queue while the actual binding operation occurs in the background.
func NewVolumeBinder ¶ added in v1.9.1
func NewVolumeBinder( kubeClient clientset.Interface, pvcInformer coreinformers.PersistentVolumeClaimInformer, pvInformer coreinformers.PersistentVolumeInformer, storageClassInformer storageinformers.StorageClassInformer) SchedulerVolumeBinder
NewVolumeBinder sets up all the caches needed for the scheduler to make volume binding decisions.