{"modulePath":"github.com/kmodules/external-storage","version":"v5.2.0+incompatible","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package controller\n\n## Constants\n\n```go\nconst (\n\t// DefaultResyncPeriod is used when option function ResyncPeriod is omitted\n\tDefaultResyncPeriod = 15 * time.Minute\n\t// DefaultThreadiness is used when option function Threadiness is omitted\n\tDefaultThreadiness = 4\n\t// DefaultExponentialBackOffOnError is used when option function ExponentialBackOffOnError is omitted\n\tDefaultExponentialBackOffOnError = true\n\t// DefaultCreateProvisionedPVRetryCount is used when option function CreateProvisionedPVRetryCount is omitted\n\tDefaultCreateProvisionedPVRetryCount = 5\n\t// DefaultCreateProvisionedPVInterval is used when option function CreateProvisionedPVInterval is omitted\n\tDefaultCreateProvisionedPVInterval = 10 * time.Second\n\t// DefaultFailedProvisionThreshold is used when option function FailedProvisionThreshold is omitted\n\tDefaultFailedProvisionThreshold = 15\n\t// DefaultFailedDeleteThreshold is used when option function FailedDeleteThreshold is omitted\n\tDefaultFailedDeleteThreshold = 15\n\t// DefaultLeaderElection is used when option function LeaderElection is omitted\n\tDefaultLeaderElection = true\n\t// DefaultLeaseDuration is used when option function LeaseDuration is omitted\n\tDefaultLeaseDuration = 15 * time.Second\n\t// DefaultRenewDeadline is used when option function RenewDeadline is omitted\n\tDefaultRenewDeadline = 10 * time.Second\n\t// DefaultRetryPeriod is used when option function RetryPeriod is omitted\n\tDefaultRetryPeriod = 2 * time.Second\n\t// DefaultMetricsPort is used when option function MetricsPort is omitted\n\tDefaultMetricsPort = 0\n\t// DefaultMetricsAddress is used when option function MetricsAddress is omitted\n\tDefaultMetricsAddress = \"0.0.0.0\"\n\t// DefaultMetricsPath is used when option function MetricsPath is omitted\n\tDefaultMetricsPath = \"/metrics\"\n)\n```\n\n## Functions\n\n```go\nfunc ClaimsInformer(informer cache.SharedInformer) func(*ProvisionController) error\n```\nClaimsInformer sets the informer to use for accessing PersistentVolumeClaims. Defaults to using a internal informer.\n\n```go\nfunc ClassesInformer(informer cache.SharedInformer) func(*ProvisionController) error\n```\nClassesInformer sets the informer to use for accessing StorageClasses. The informer must use the versioned resource appropriate for the Kubernetes cluster version (that is, v1.StorageClass for \u003e= 1.6, and v1beta1.StorageClass for \\\u003c 1.6). Defaults to using a internal informer.\n\n```go\nfunc CreateProvisionedPVInterval(createProvisionedPVInterval time.Duration) func(*ProvisionController) error\n```\nCreateProvisionedPVInterval is the interval between retries when we create a PV object for a provisioned volume. Defaults to 10 seconds.\n\n```go\nfunc CreateProvisionedPVRetryCount(createProvisionedPVRetryCount int) func(*ProvisionController) error\n```\nCreateProvisionedPVRetryCount is the number of retries when we create a PV object for a provisioned volume. Defaults to 5.\n\n```go\nfunc ExponentialBackOffOnError(exponentialBackOffOnError bool) func(*ProvisionController) error\n```\nExponentialBackOffOnError determines whether to exponentially back off from failures of Provision and Delete. Defaults to true.\n\n```go\nfunc FailedDeleteThreshold(failedDeleteThreshold int) func(*ProvisionController) error\n```\nFailedDeleteThreshold is the threshold for max number of retries on failures of Delete. Defaults to 15.\n\n```go\nfunc FailedProvisionThreshold(failedProvisionThreshold int) func(*ProvisionController) error\n```\nFailedProvisionThreshold is the threshold for max number of retries on failures of Provision. Defaults to 15.\n\n```go\nfunc LeaderElection(leaderElection bool) func(*ProvisionController) error\n```\nLeaderElection determines whether to enable leader election or not. Defaults to true.\n\n```go\nfunc LeaderElectionNamespace(leaderElectionNamespace string) func(*ProvisionController) error\n```\nLeaderElectionNamespace is the kubernetes namespace in which to create the leader election object. Defaults to the same namespace in which the the controller runs.\n\n```go\nfunc LeaseDuration(leaseDuration time.Duration) func(*ProvisionController) error\n```\nLeaseDuration 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.\n\n```go\nfunc MetricsAddress(metricsAddress string) func(*ProvisionController) error\n```\nMetricsAddress sets the ip address that metrics serve serves on.\n\n```go\nfunc MetricsPath(metricsPath string) func(*ProvisionController) error\n```\nMetricsPath sets the endpoint path of metrics server.\n\n```go\nfunc MetricsPort(metricsPort int32) func(*ProvisionController) error\n```\nMetricsPort sets the port that metrics server serves on. Default: 0, set to non-zero to enable.\n\n```go\nfunc RenewDeadline(renewDeadline time.Duration) func(*ProvisionController) error\n```\nRenewDeadline is the duration that the acting master will retry refreshing leadership before giving up. Defaults to 10 seconds.\n\n```go\nfunc ResyncPeriod(resyncPeriod time.Duration) func(*ProvisionController) error\n```\nResyncPeriod is how often the controller relists PVCs, PVs, \u0026 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 minutes.\n\n```go\nfunc RetryPeriod(retryPeriod time.Duration) func(*ProvisionController) error\n```\nRetryPeriod is the duration the LeaderElector clients should wait between tries of actions. Defaults to 2 seconds.\n\n```go\nfunc Threadiness(threadiness int) func(*ProvisionController) error\n```\nThreadiness is the number of claim and volume workers each to launch. Defaults to 4.\n\n```go\nfunc VolumesInformer(informer cache.SharedInformer) func(*ProvisionController) error\n```\nVolumesInformer sets the informer to use for accessing PersistentVolumes. Defaults to using a internal informer.\n\n## Types\n\n```go\ntype BlockProvisioner interface {\n\tProvisioner\n\t// SupportsBlock returns whether provisioner supports block volume.\n\tSupportsBlock() bool\n}\n```\nBlockProvisioner is an optional interface implemented by provisioners to determine whether it supports block volume.\n\n```go\ntype IgnoredError struct {\n\tReason string\n}\n```\nIgnoredError 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.\n\n```go\nfunc (e *IgnoredError) Error() string\n```\n\n```go\ntype ProvisionController struct {\n\t// contains filtered or unexported fields\n}\n```\nProvisionController is a controller that provisions PersistentVolumes for PersistentVolumeClaims.\n\n```go\nfunc NewProvisionController(\n\tclient kubernetes.Interface,\n\tprovisionerName string,\n\tprovisioner Provisioner,\n\tkubeVersion string,\n\toptions ...func(*ProvisionController) error,\n) *ProvisionController\n```\nNewProvisionController creates a new provision controller using the given configuration parameters and with private (non-shared) informers.\n\n```go\nfunc (ctrl *ProvisionController) HasRun() bool\n```\nHasRun returns whether the controller has Run\n\n```go\nfunc (ctrl *ProvisionController) Run(_ \u003c-chan struct{})\n```\nRun starts all of this controller's control loops\n\n```go\ntype Provisioner interface {\n\t// Provision creates a volume i.e. the storage asset and returns a PV object\n\t// for the volume\n\tProvision(VolumeOptions) (*v1.PersistentVolume, error)\n\t// Delete removes the storage asset that was created by Provision backing the\n\t// given PV. Does not delete the PV object itself.\n\t//\n\t// May return IgnoredError to indicate that the call has been ignored and no\n\t// action taken.\n\tDelete(*v1.PersistentVolume) error\n}\n```\nProvisioner 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.\n\n```go\ntype Qualifier interface {\n\t// ShouldProvision returns whether provisioning for the claim should\n\t// be attempted.\n\tShouldProvision(*v1.PersistentVolumeClaim) bool\n}\n```\nQualifier is an optional interface implemented by provisioners to determine whether a claim should be provisioned as early as possible (e.g. prior to leader election).\n\n```go\ntype VolumeOptions struct {\n\t// Reclamation policy for a persistent volume\n\tPersistentVolumeReclaimPolicy v1.PersistentVolumeReclaimPolicy\n\t// PV.Name of the appropriate PersistentVolume. Used to generate cloud\n\t// volume name.\n\tPVName string\n\n\t// PV mount options. Not validated - mount of the PVs will simply fail if one is invalid.\n\tMountOptions []string\n\n\t// PVC is reference to the claim that lead to provisioning of a new PV.\n\t// Provisioners *must* create a PV that would be matched by this PVC,\n\t// i.e. with required capacity, accessMode, labels matching PVC.Selector and\n\t// so on.\n\tPVC *v1.PersistentVolumeClaim\n\t// Volume provisioning parameters from StorageClass\n\tParameters map[string]string\n\n\t// Node selected by the scheduler for the volume.\n\tSelectedNode *v1.Node\n\t// Topology constraint parameter from StorageClass\n\tAllowedTopologies []v1.TopologySelectorTerm\n}\n```\nVolumeOptions contains option information about a volume [https://github.com/kubernetes/kubernetes/blob/release-1.4/pkg/volume/plugins.go](https://github.com/kubernetes/kubernetes/blob/release-1.4/pkg/volume/plugins.go)\n\n","path":"github.com/kmodules/external-storage/lib/controller","name":"controller","synopsis":"","isRedistributable":true}
