controller

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2019 License: Apache-2.0 Imports: 62 Imported by: 2

Documentation

Index

Constants

View Source
const (
	EngineFrontendBlockDev = "tgt-blockdev"
	EngineFrontendISCSI    = "tgt-iscsi"
)
View Source
const (
	EventReasonCreate         = "Create"
	EventReasonFailedCreating = "FailedCreating"
	EventReasonDelete         = "Delete"
	EventReasonFailedDeleting = "FailedDeleting"
	EventReasonStart          = "Start"
	EventReasonFailedStarting = "FailedStarting"
	EventReasonStop           = "Stop"
	EventReasonFailedStopping = "FailedStopping"

	EventReasonRebuilded        = "Rebuilded"
	EventReasonRebuilding       = "Rebuilding"
	EventReasonFailedRebuilding = "FailedRebuilding"

	EventReasonAttached = "Attached"
	EventReasonDetached = "Detached"
	EventReasonHealthy  = "Healthy"
	EventReasonFaulted  = "Faulted"
	EventReasonDegraded = "Degraded"
	EventReasonOrphaned = "Orphaned"

	EventReasonRebooted = "Rebooted"
)
View Source
const (
	MaxPollCount = 60
	MinPollCount = 1
	PollInterval = 500 * time.Millisecond
)
View Source
const (
	LonghornProvisionerName = "rancher.io/longhorn"
	LonghornStorageClass    = "longhorn"
	LonghornDriver          = "rancher.io/longhorn"
)
View Source
const (
	CRDEngineName          = "engines.longhorn.rancher.io"
	CRDReplicaName         = "replicas.longhorn.rancher.io"
	CRDVolumeName          = "volumes.longhorn.rancher.io"
	CRDEngineImageName     = "engineimages.longhorn.rancher.io"
	CRDNodeName            = "nodes.longhorn.rancher.io"
	CRDInstanceManagerName = "instancemanagers.longhorn.rancher.io"
)
View Source
const (
	LabelRecurringJob = "RecurringJob"

	CronJobBackoffLimit = 3
)
View Source
const (
	LonghornCSIDriver = "io.rancher.longhorn"
)
View Source
const (
	VersionTagLatest = "latest"
)

Variables

View Source
var (
	EnginePollInterval = 5 * time.Second
	EnginePollTimeout  = 30 * time.Second
)
View Source
var (
	RetryInterval = 100 * time.Millisecond
	RetryCounts   = 20
)
View Source
var (
	ExpiredEngineImageTimeout = 60 * time.Minute
)
View Source
var (
	Workers = 5
)

Functions

func GetClientForEngine

func GetClientForEngine(e *longhorn.Engine, engines engineapi.EngineClientCollection, image string) (client engineapi.EngineClient, err error)

func GetGuaranteedResourceRequirement added in v0.5.0

func GetGuaranteedResourceRequirement(ds *datastore.DataStore) (*corev1.ResourceRequirements, error)

func NewProvisioner

func NewProvisioner(apiClient *longhornclient.RancherClient) pvController.Provisioner

Types

type BackupStoreMonitor added in v0.5.0

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

func (*BackupStoreMonitor) Start added in v0.5.0

func (bm *BackupStoreMonitor) Start()

func (*BackupStoreMonitor) Stop added in v0.5.0

func (bm *BackupStoreMonitor) Stop()

type CheckUpgradeRequest added in v0.3.2

type CheckUpgradeRequest struct {
	LonghornVersion   string `json:"longhornVersion"`
	KubernetesVersion string `json:"kubernetesVersion"`
}

type CheckUpgradeResponse added in v0.3.2

type CheckUpgradeResponse struct {
	Versions []Version `json:"versions"`
}

type EngineController

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

func NewEngineController

func NewEngineController(
	ds *datastore.DataStore,
	scheme *runtime.Scheme,
	engineInformer lhinformers.EngineInformer,
	instanceManagerInformer lhinformers.InstanceManagerInformer,
	kubeClient clientset.Interface,
	engines engineapi.EngineClientCollection,
	namespace string, controllerID string) *EngineController

func (*EngineController) CreateInstance added in v0.6.0

func (ec *EngineController) CreateInstance(obj interface{}) (*types.InstanceProcess, error)

func (*EngineController) DeleteInstance added in v0.6.0

func (ec *EngineController) DeleteInstance(obj interface{}) error

func (*EngineController) GetInstance added in v0.6.0

func (ec *EngineController) GetInstance(obj interface{}) (*types.InstanceProcess, error)

func (*EngineController) LogInstance added in v0.6.0

func (ec *EngineController) LogInstance(obj interface{}) (*imapi.LogStream, error)

func (*EngineController) ReconcileEngineState

func (ec *EngineController) ReconcileEngineState(e *longhorn.Engine) error

func (*EngineController) Run

func (ec *EngineController) Run(workers int, stopCh <-chan struct{})

func (*EngineController) Upgrade

func (ec *EngineController) Upgrade(e *longhorn.Engine) (err error)

type EngineImageController

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

func NewEngineImageController

func NewEngineImageController(
	ds *datastore.DataStore,
	scheme *runtime.Scheme,
	engineImageInformer lhinformers.EngineImageInformer,
	volumeInformer lhinformers.VolumeInformer,
	dsInformer appsinformers.DaemonSetInformer,
	nodeInformer lhinformers.NodeInformer,
	imInformer lhinformers.InstanceManagerInformer,
	kubeClient clientset.Interface,
	namespace string, controllerID, serviceAccount string) *EngineImageController

func (*EngineImageController) ResolveRefAndEnqueue

func (ic *EngineImageController) ResolveRefAndEnqueue(namespace string, ref *metav1.OwnerReference)

func (*EngineImageController) Run

func (ic *EngineImageController) Run(workers int, stopCh <-chan struct{})

type EngineManagerNotifier added in v0.6.0

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

func NewEngineManagerNotifier added in v0.6.0

func NewEngineManagerNotifier(stream *api.EngineStream) *EngineManagerNotifier

func (*EngineManagerNotifier) Close added in v0.6.0

func (notifier *EngineManagerNotifier) Close()

func (*EngineManagerNotifier) Recv added in v0.6.0

func (notifier *EngineManagerNotifier) Recv() (struct{}, error)

type EngineManagerUpdater added in v0.6.0

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

func NewEngineManagerUpdater added in v0.6.0

func NewEngineManagerUpdater(im *longhorn.InstanceManager) *EngineManagerUpdater

func (*EngineManagerUpdater) GetNotifier added in v0.6.0

func (updater *EngineManagerUpdater) GetNotifier() (InstanceManagerNotifier, error)

func (*EngineManagerUpdater) Poll added in v0.6.0

func (updater *EngineManagerUpdater) Poll() (map[string]types.InstanceProcess, error)

type EngineMonitor

type EngineMonitor struct {
	Name string
	// contains filtered or unexported fields
}

func (*EngineMonitor) Run

func (m *EngineMonitor) Run()

type GetDiskInfoHandler

type GetDiskInfoHandler func(string) (*util.DiskInfo, error)

type InstanceHandler

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

InstanceHandler can handle the state transition of correlated instance and engine/replica object. It assumed the instance it's going to operate with is using the SAME NAME from the engine/replica object

func NewInstanceHandler

func NewInstanceHandler(ds *datastore.DataStore, instanceManagerHandler InstanceManagerHandler, eventRecorder record.EventRecorder) *InstanceHandler

func (*InstanceHandler) ReconcileInstanceState

func (h *InstanceHandler) ReconcileInstanceState(obj interface{}, spec *types.InstanceSpec, status *types.InstanceStatus) (err error)

type InstanceManagerController added in v0.6.0

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

func NewInstanceManagerController added in v0.6.0

func NewInstanceManagerController(
	ds *datastore.DataStore,
	scheme *runtime.Scheme,
	imInformer lhinformers.InstanceManagerInformer,
	pInformer coreinformers.PodInformer,
	kubeClient clientset.Interface,
	namespace, controllerID, serviceAccount string) *InstanceManagerController

func (*InstanceManagerController) Run added in v0.6.0

func (imc *InstanceManagerController) Run(workers int, stopCh <-chan struct{})

type InstanceManagerHandler added in v0.6.0

type InstanceManagerHandler interface {
	GetInstance(obj interface{}) (*types.InstanceProcess, error)
	CreateInstance(obj interface{}) (*types.InstanceProcess, error)
	DeleteInstance(obj interface{}) error
	LogInstance(obj interface{}) (*imapi.LogStream, error)
}

type InstanceManagerMonitor added in v0.6.0

type InstanceManagerMonitor struct {
	Name string
	// contains filtered or unexported fields
}

func (*InstanceManagerMonitor) Run added in v0.6.0

func (m *InstanceManagerMonitor) Run()

type InstanceManagerNotifier added in v0.6.0

type InstanceManagerNotifier interface {
	Recv() (struct{}, error)
	Close()
}

type InstanceManagerUpdater added in v0.6.0

type InstanceManagerUpdater interface {
	GetNotifier() (InstanceManagerNotifier, error)
	Poll() (map[string]types.InstanceProcess, error)
}

type KubernetesController added in v0.5.0

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

func NewKubernetesController added in v0.5.0

func NewKubernetesController(
	ds *datastore.DataStore,
	scheme *runtime.Scheme,
	volumeInformer lhinformers.VolumeInformer,
	persistentVolumeInformer coreinformers.PersistentVolumeInformer,
	persistentVolumeClaimInformer coreinformers.PersistentVolumeClaimInformer,
	podInformer coreinformers.PodInformer,
	volumeAttachmentInformer v1beta1.VolumeAttachmentInformer,
	kubeClient clientset.Interface) *KubernetesController

func (*KubernetesController) Run added in v0.5.0

func (kc *KubernetesController) Run(workers int, stopCh <-chan struct{})

type NodeController

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

func NewNodeController

func NewNodeController(
	ds *datastore.DataStore,
	scheme *runtime.Scheme,
	nodeInformer lhinformers.NodeInformer,
	settingInformer lhinformers.SettingInformer,
	podInformer coreinformers.PodInformer,
	replicaInformer lhinformers.ReplicaInformer,
	kubeNodeInformer coreinformers.NodeInformer,
	kubeClient clientset.Interface,
	namespace, controllerID string) *NodeController

func (*NodeController) Run

func (nc *NodeController) Run(workers int, stopCh <-chan struct{})

type Provisioner

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

func (*Provisioner) Delete

func (p *Provisioner) Delete(pv *v1.PersistentVolume) error

func (*Provisioner) Provision

type ReplicaController

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

func NewReplicaController

func NewReplicaController(
	ds *datastore.DataStore,
	scheme *runtime.Scheme,
	replicaInformer lhinformers.ReplicaInformer,
	instanceManagerInformer lhinformers.InstanceManagerInformer,
	kubeClient clientset.Interface,
	namespace string, controllerID string) *ReplicaController

func (*ReplicaController) CreateInstance added in v0.6.0

func (rc *ReplicaController) CreateInstance(obj interface{}) (*types.InstanceProcess, error)

func (*ReplicaController) DeleteInstance added in v0.6.0

func (rc *ReplicaController) DeleteInstance(obj interface{}) error

func (*ReplicaController) GetInstance added in v0.6.0

func (rc *ReplicaController) GetInstance(obj interface{}) (*types.InstanceProcess, error)

func (*ReplicaController) LogInstance added in v0.6.0

func (rc *ReplicaController) LogInstance(obj interface{}) (*imapi.LogStream, error)

func (*ReplicaController) Run

func (rc *ReplicaController) Run(workers int, stopCh <-chan struct{})

type ReplicaManagerNotifier added in v0.6.0

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

func NewReplicaManagerNotifier added in v0.6.0

func NewReplicaManagerNotifier(stream *api.ProcessStream) *ReplicaManagerNotifier

func (*ReplicaManagerNotifier) Close added in v0.6.0

func (notifier *ReplicaManagerNotifier) Close()

func (*ReplicaManagerNotifier) Recv added in v0.6.0

func (notifier *ReplicaManagerNotifier) Recv() (struct{}, error)

type ReplicaManagerUpdater added in v0.6.0

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

func NewReplicaManagerUpdater added in v0.6.0

func NewReplicaManagerUpdater(im *longhorn.InstanceManager) *ReplicaManagerUpdater

func (*ReplicaManagerUpdater) GetNotifier added in v0.6.0

func (updater *ReplicaManagerUpdater) GetNotifier() (InstanceManagerNotifier, error)

func (*ReplicaManagerUpdater) Poll added in v0.6.0

func (updater *ReplicaManagerUpdater) Poll() (map[string]types.InstanceProcess, error)

type SettingController added in v0.3.2

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

func NewSettingController added in v0.3.2

func NewSettingController(
	ds *datastore.DataStore,
	scheme *runtime.Scheme,
	settingInformer lhinformers.SettingInformer,
	kubeClient clientset.Interface, version string) *SettingController

func (*SettingController) CheckLatestLonghornVersion added in v0.3.2

func (sc *SettingController) CheckLatestLonghornVersion() (string, error)

func (*SettingController) Run added in v0.3.2

func (sc *SettingController) Run(stopCh <-chan struct{})

type SimpleResourceEventHandler

type SimpleResourceEventHandler struct{ ChangeFunc func() }

func (SimpleResourceEventHandler) OnAdd

func (s SimpleResourceEventHandler) OnAdd(obj interface{})

func (SimpleResourceEventHandler) OnDelete

func (s SimpleResourceEventHandler) OnDelete(obj interface{})

func (SimpleResourceEventHandler) OnUpdate

func (s SimpleResourceEventHandler) OnUpdate(oldObj, newObj interface{})

type UninstallController added in v0.3.2

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

func NewUninstallController added in v0.3.2

func NewUninstallController(
	namespace string,
	force bool,
	ds *datastore.DataStore,
	stopCh chan struct{},
	extensionsClient apiextension.Interface,
	volumeInformer lhinformers.VolumeInformer,
	engineInformer lhinformers.EngineInformer,
	replicaInformer lhinformers.ReplicaInformer,
	engineImageInformer lhinformers.EngineImageInformer,
	nodeInformer lhinformers.NodeInformer,
	imInformer lhinformers.InstanceManagerInformer,
	daemonSetInformer appsv1.DaemonSetInformer,
) *UninstallController

func (*UninstallController) Run added in v0.3.2

func (c *UninstallController) Run() error

type Version added in v0.3.2

type Version struct {
	Name        string // must be in semantic versioning
	ReleaseDate string
	Tags        []string
}

type VolumeController

type VolumeController struct {
	ManagerImage   string
	ServiceAccount string
	// contains filtered or unexported fields
}

func NewVolumeController

func NewVolumeController(
	ds *datastore.DataStore,
	scheme *runtime.Scheme,
	volumeInformer lhinformers.VolumeInformer,
	engineInformer lhinformers.EngineInformer,
	replicaInformer lhinformers.ReplicaInformer,
	kubeClient clientset.Interface,
	namespace, controllerID, serviceAccount string,
	managerImage string) *VolumeController

func (*VolumeController) ReconcileEngineReplicaState

func (vc *VolumeController) ReconcileEngineReplicaState(v *longhorn.Volume, e *longhorn.Engine, rs map[string]*longhorn.Replica) (err error)

ReconcileEngineReplicaState will get the current main engine e.Status.ReplicaModeMap, then update v and rs accordingly. We will only update the replica status and won't start rebuilding if MigrationNodeID was set. The logic in replenishReplicas() prevents that.

func (*VolumeController) ReconcileVolumeState

func (vc *VolumeController) ReconcileVolumeState(v *longhorn.Volume, e *longhorn.Engine, rs map[string]*longhorn.Replica) (err error)

ReconcileVolumeState handles the attaching and detaching of volume

func (*VolumeController) ResolveRefAndEnqueue

func (vc *VolumeController) ResolveRefAndEnqueue(namespace string, ref *metav1.OwnerReference)

func (*VolumeController) Run

func (vc *VolumeController) Run(workers int, stopCh <-chan struct{})

type Watcher

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

func (*Watcher) Close

func (w *Watcher) Close()

func (*Watcher) Events

func (w *Watcher) Events() <-chan struct{}

type WebsocketController

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

func NewWebsocketController

func NewWebsocketController(
	volumeInformer lhinformers.VolumeInformer,
	engineInformer lhinformers.EngineInformer,
	replicaInformer lhinformers.ReplicaInformer,
	settingInformer lhinformers.SettingInformer,
	engineImageInformer lhinformers.EngineImageInformer,
	nodeInformer lhinformers.NodeInformer,
) *WebsocketController

func StartControllers

func StartControllers(stopCh chan struct{}, controllerID, serviceAccount, managerImage, kubeconfigPath, version string) (*datastore.DataStore, *WebsocketController, error)

func (*WebsocketController) Close

func (wc *WebsocketController) Close()

func (*WebsocketController) NewWatcher

func (wc *WebsocketController) NewWatcher(resources ...string) *Watcher

func (*WebsocketController) Run

func (wc *WebsocketController) Run(stopCh <-chan struct{})

Jump to

Keyboard shortcuts

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