controller

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2018 License: Apache-2.0 Imports: 45 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"
)
View Source
const (
	LonghornProvisionerName = "rancher.io/longhorn"
	LonghornStorageClass    = "longhorn"
	LonghornDriver          = "rancher.io/longhorn"
)
View Source
const (
	LabelRecurringJob = "RecurringJob"

	CronJobBackoffLimit = 3
)
View Source
const (
	CrashLogsTaillines = 100
)

Variables

View Source
var (
	EnginePollInterval = 5 * time.Second
	EnginePollTimeout  = 30 * time.Second
)
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 NewProvisioner

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

Types

type EngineController

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

func NewEngineController

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

func (*EngineController) CreatePodSpec

func (ec *EngineController) CreatePodSpec(obj interface{}) (*v1.Pod, error)

func (*EngineController) ReconcileEngineState

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

func (*EngineController) ResolveRefAndEnqueue

func (ec *EngineController) ResolveRefAndEnqueue(namespace string, ref *metav1.OwnerReference)

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_v1beta2.DaemonSetInformer,
	kubeClient clientset.Interface,
	namespace string, controllerID 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 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 pod it's going to operate with is using the SAME NAME from the engine/replica object

func NewInstanceHandler

func NewInstanceHandler(podInformer coreinformers.PodInformer, kubeClient clientset.Interface, namespace string, podCreator PodCreatorInterface, eventRecorder record.EventRecorder) *InstanceHandler

func (*InstanceHandler) DeleteInstanceForObject

func (h *InstanceHandler) DeleteInstanceForObject(obj runtime.Object) (err error)

func (*InstanceHandler) ReconcileInstanceState

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

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,
	kubeClient clientset.Interface,
	namespace, controllerID string) *NodeController

func (*NodeController) Run

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

type PodCreatorInterface

type PodCreatorInterface interface {
	CreatePodSpec(obj interface{}) (*v1.Pod, error)
}

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,
	podInformer coreinformers.PodInformer,
	jobInformer batchinformers.JobInformer,
	kubeClient clientset.Interface,
	namespace string, controllerID string) *ReplicaController

func (*ReplicaController) CreatePodSpec

func (rc *ReplicaController) CreatePodSpec(obj interface{}) (*v1.Pod, error)

func (*ReplicaController) ResolveRefAndEnqueue

func (rc *ReplicaController) ResolveRefAndEnqueue(namespace string, ref *metav1.OwnerReference)

func (*ReplicaController) Run

func (rc *ReplicaController) Run(workers int, 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 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 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