controller

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2018 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultResyncPeriod is used when option function ResyncPeriod is omitted
	DefaultResyncPeriod = 15 * time.Second
	// DefaultExponentialBackOffOnError is used when option function ExponentialBackOffOnError is omitted
	DefaultExponentialBackOffOnError = true
	// DefaultCreateProvisionedPVRetryCount is used when option function CreateProvisionedPVRetryCount is omitted
	DefaultCreateProvisionedPVRetryCount = 5
	// DefaultCreateProvisionedPVInterval is used when option function CreateProvisionedPVInterval is omitted
	DefaultCreateProvisionedPVInterval = 10 * time.Second
	// DefaultFailedProvisionThreshold is used when option function FailedProvisionThreshold is omitted
	DefaultFailedProvisionThreshold = 15
	// DefaultFailedDeleteThreshold is used when option function FailedDeleteThreshold is omitted
	DefaultFailedDeleteThreshold = 15
	// DefaultLeaseDuration is used when option function LeaseDuration is omitted
	DefaultLeaseDuration = 15 * time.Second
	// DefaultRenewDeadline is used when option function RenewDeadline is omitted
	DefaultRenewDeadline = 10 * time.Second
	// DefaultRetryPeriod is used when option function RetryPeriod is omitted
	DefaultRetryPeriod = 2 * time.Second
	// DefaultTermLimit is used when option function TermLimit is omitted
	DefaultTermLimit = 30 * time.Second
)

Variables

This section is empty.

Functions

func CreateProvisionedPVInterval

func CreateProvisionedPVInterval(createProvisionedPVInterval time.Duration) func(*ProvisionController) error

CreateProvisionedPVInterval is the interval between retries when we create a PV object for a provisioned volume. Defaults to 10 seconds.

func CreateProvisionedPVRetryCount

func CreateProvisionedPVRetryCount(createProvisionedPVRetryCount int) func(*ProvisionController) error

CreateProvisionedPVRetryCount is the number of retries when we create a PV object for a provisioned volume. Defaults to 5.

func ExponentialBackOffOnError

func ExponentialBackOffOnError(exponentialBackOffOnError bool) func(*ProvisionController) error

ExponentialBackOffOnError determines whether to exponentially back off from failures of Provision and Delete. Defaults to true.

func FailedDeleteThreshold

func FailedDeleteThreshold(failedDeleteThreshold int) func(*ProvisionController) error

FailedDeleteThreshold is the threshold for max number of retries on failures of Delete. Defaults to 15.

func FailedProvisionThreshold

func FailedProvisionThreshold(failedProvisionThreshold int) func(*ProvisionController) error

FailedProvisionThreshold is the threshold for max number of retries on failures of Provision. Defaults to 15.

func LeaseDuration

func LeaseDuration(leaseDuration time.Duration) func(*ProvisionController) error

LeaseDuration is the duration that non-leader candidates will wait to force acquire leadership. This is measured against time of last observed ack. Defaults to 15 seconds.

func RenewDeadline

func RenewDeadline(renewDeadline time.Duration) func(*ProvisionController) error

RenewDeadline is the duration that the acting master will retry refreshing leadership before giving up. Defaults to 10 seconds.

func ResyncPeriod

func ResyncPeriod(resyncPeriod time.Duration) func(*ProvisionController) error

ResyncPeriod is how often the controller relists PVCs, PVs, & storage classes. OnUpdate will be called even if nothing has changed, meaning failed operations may be retried on a PVC/PV every resyncPeriod regardless of whether it changed. Defaults to 15 seconds.

func RetryPeriod

func RetryPeriod(retryPeriod time.Duration) func(*ProvisionController) error

RetryPeriod is the duration the LeaderElector clients should wait between tries of actions. Defaults to 2 seconds.

func TermLimit

func TermLimit(termLimit time.Duration) func(*ProvisionController) error

TermLimit is the maximum duration that a leader may remain the leader to complete the task before it must give up its leadership. 0 for forever or indefinite. Defaults to 30 seconds.

Types

type IgnoredError

type IgnoredError struct {
	Reason string
}

IgnoredError is the value for Delete to return to indicate that the call has been ignored and no action taken. In case multiple provisioners are serving the same storage class, provisioners may ignore PVs they are not responsible for (e.g. ones they didn't create). The controller will act accordingly, i.e. it won't emit a misleading VolumeFailedDelete event.

func (*IgnoredError) Error

func (e *IgnoredError) Error() string

type ProvisionController

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

ProvisionController is a controller that provisions PersistentVolumes for PersistentVolumeClaims.

func NewProvisionController

func NewProvisionController(
	client kubernetes.Interface,
	provisionerName string,
	provisioner Provisioner,
	kubeVersion string,
	options ...func(*ProvisionController) error,
) *ProvisionController

NewProvisionController creates a new provision controller

func (*ProvisionController) HasRun

func (ctrl *ProvisionController) HasRun() bool

HasRun returns whether the controller has Run

func (*ProvisionController) Run

func (ctrl *ProvisionController) Run(stopCh <-chan struct{})

Run starts all of this controller's control loops

func (*ProvisionController) SetFailedDeleteThreshold

func (ctrl *ProvisionController) SetFailedDeleteThreshold(threshold int)

SetFailedDeleteThreshold sets the value of failedDeleteThreshold

func (*ProvisionController) SetFailedProvisionThreshold

func (ctrl *ProvisionController) SetFailedProvisionThreshold(threshold int)

SetFailedProvisionThreshold sets the value of failedProvisionThreshold

type Provisioner

type Provisioner interface {
	// Provision creates a volume i.e. the storage asset and returns a PV object
	// for the volume
	Provision(VolumeOptions) (*v1.PersistentVolume, error)
	// Delete removes the storage asset that was created by Provision backing the
	// given PV. Does not delete the PV object itself.
	//
	// May return IgnoredError to indicate that the call has been ignored and no
	// action taken.
	Delete(*v1.PersistentVolume) error
}

Provisioner is an interface that creates templates for PersistentVolumes and can create the volume as a new resource in the infrastructure provider. It can also remove the volume it created from the underlying storage provider.

type VolumeOptions

type VolumeOptions struct {
	// Reclamation policy for a persistent volume
	PersistentVolumeReclaimPolicy v1.PersistentVolumeReclaimPolicy
	// PV.Name of the appropriate PersistentVolume. Used to generate cloud
	// volume name.
	PVName string
	// PVC is reference to the claim that lead to provisioning of a new PV.
	// Provisioners *must* create a PV that would be matched by this PVC,
	// i.e. with required capacity, accessMode, labels matching PVC.Selector and
	// so on.
	PVC *v1.PersistentVolumeClaim
	// Volume provisioning parameters from StorageClass
	Parameters map[string]string
}

VolumeOptions contains option information about a volume https://github.com/kubernetes/kubernetes/blob/release-1.4/pkg/volume/plugins.go

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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