README
¶
Volume Sync Controller
The Sync Volume controller is responsible for sending volumes to persistent layer by polling StorageOS API periodically.
Volume Sync Control Loop
The Volume sync controller periodically polls the StorageOS control plane API
to retrieve a list of volumes. The poll interval defaults to 5s
and is
tunable via the -api-poll-interval
flag.
All K8s volumes will be considered. Controller persists existing volumes and delete orpahn ones.
Prometheus Metrics
The following metrics are collected:
storageos_api_request_duration_seconds
A histogram of request latencies, partitioned by HTTP request method.storageos_api_requests_total
A counter for requests from the api client, partitioned by HTTP request method and response code.storageos_sync_volume_duration_seconds
Distribution of the length of time taken to sync all volumes.storageos_save_volume_duration_seconds
Distribution of the length of time taken to save a volume.storageos_delete_volume_duration_seconds
Distribution of the length of time taken to delete a volume.
Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterMetrics ¶
func RegisterMetrics()
RegisterMetrics ensures that the package metrics are registered.
Types ¶
type LatencyMetric ¶
LatencyMetric observes latency.
var ( // SyncDuration is the latency metric that measures the duration of the // volume sync. SyncDuration LatencyMetric = &latencyAdapter{m: syncLatencyHistogram} // SaveDuration is the latency metric that measures the duration of the // volume save. SaveDuration LatencyMetric = &latencyAdapter{m: saveLatencyHistogram} // DeleteDuration is the latency metric that measures the duration of the // volume delete. DeleteDuration LatencyMetric = &latencyAdapter{m: saveLatencyHistogram} )
type Reconciler ¶
Reconciler is syncing StorageOS volumes into K8s datastore, by polling it periodically.
func NewReconciler ¶
func NewReconciler( k8s client.Client, api Lister, apiReset chan<- struct{}, apiPollInterval time.Duration, recorder record.EventRecorder) *Reconciler
NewReconciler returns a new volume syncer.
func (*Reconciler) SetupWithManager ¶
func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager registers with the controller manager.
Since this is an external controller, we don't need to register the controller, just add it as a Runnable so that the manager can control startup and shutdown.
func (*Reconciler) Start ¶
func (r *Reconciler) Start(ctx context.Context) error
Start runs the main reconcile loop until the context is cancelled or there is a fatal error. It implements the controller-runtime Runnable interface so that it can be controlled by controller manager.
The reconcile loop spins up a separated routines for polling the API server and sync volumes into K8s datastore.