Documentation
¶
Overview ¶
Package plugin defines the plugin system for CtrlPlane.
Plugins are notified of lifecycle events (instance created, deploy started, health check failed, etc.) and can react to them — logging, metrics, tracing, auditing, etc.
Each lifecycle hook is a separate interface so plugins opt in only to the events they care about.
Index ¶
- type CertExpiring
- type CertProvisioned
- type DeployFailed
- type DeployRolledBack
- type DeployStarted
- type DeploySucceeded
- type DomainAdded
- type DomainRemoved
- type DomainVerified
- type Extension
- type HealthCheckFailed
- type HealthCheckPassed
- type HealthDegraded
- type HealthRecovered
- type InstanceCreated
- type InstanceDeleted
- type InstanceFailed
- type InstanceScaled
- type InstanceStarted
- type InstanceStopped
- type InstanceSuspended
- type InstanceUnsuspended
- type QuotaExceeded
- type Registry
- func (r *Registry) EmitCertExpiring(ctx context.Context, evt *event.Event)
- func (r *Registry) EmitCertProvisioned(ctx context.Context, evt *event.Event)
- func (r *Registry) EmitDeployFailed(ctx context.Context, evt *event.Event)
- func (r *Registry) EmitDeployRolledBack(ctx context.Context, evt *event.Event)
- func (r *Registry) EmitDeployStarted(ctx context.Context, evt *event.Event)
- func (r *Registry) EmitDeploySucceeded(ctx context.Context, evt *event.Event)
- func (r *Registry) EmitDomainAdded(ctx context.Context, evt *event.Event)
- func (r *Registry) EmitDomainRemoved(ctx context.Context, evt *event.Event)
- func (r *Registry) EmitDomainVerified(ctx context.Context, evt *event.Event)
- func (r *Registry) EmitHealthCheckFailed(ctx context.Context, evt *event.Event)
- func (r *Registry) EmitHealthCheckPassed(ctx context.Context, evt *event.Event)
- func (r *Registry) EmitHealthDegraded(ctx context.Context, evt *event.Event)
- func (r *Registry) EmitHealthRecovered(ctx context.Context, evt *event.Event)
- func (r *Registry) EmitInstanceCreated(ctx context.Context, evt *event.Event)
- func (r *Registry) EmitInstanceDeleted(ctx context.Context, evt *event.Event)
- func (r *Registry) EmitInstanceFailed(ctx context.Context, evt *event.Event)
- func (r *Registry) EmitInstanceScaled(ctx context.Context, evt *event.Event)
- func (r *Registry) EmitInstanceStarted(ctx context.Context, evt *event.Event)
- func (r *Registry) EmitInstanceStopped(ctx context.Context, evt *event.Event)
- func (r *Registry) EmitInstanceSuspended(ctx context.Context, evt *event.Event)
- func (r *Registry) EmitInstanceUnsuspended(ctx context.Context, evt *event.Event)
- func (r *Registry) EmitQuotaExceeded(ctx context.Context, evt *event.Event)
- func (r *Registry) EmitShutdown(ctx context.Context)
- func (r *Registry) EmitTemplateCreated(ctx context.Context, evt *event.Event)
- func (r *Registry) EmitTemplateDeleted(ctx context.Context, evt *event.Event)
- func (r *Registry) EmitTemplateUpdated(ctx context.Context, evt *event.Event)
- func (r *Registry) EmitTenantCreated(ctx context.Context, evt *event.Event)
- func (r *Registry) EmitTenantDeleted(ctx context.Context, evt *event.Event)
- func (r *Registry) EmitTenantSuspended(ctx context.Context, evt *event.Event)
- func (r *Registry) EmitWorkloadCreated(ctx context.Context, evt *event.Event)
- func (r *Registry) EmitWorkloadDeleted(ctx context.Context, evt *event.Event)
- func (r *Registry) EmitWorkloadDeployed(ctx context.Context, evt *event.Event)
- func (r *Registry) EmitWorkloadFailed(ctx context.Context, evt *event.Event)
- func (r *Registry) EmitWorkloadPaused(ctx context.Context, evt *event.Event)
- func (r *Registry) EmitWorkloadRestarted(ctx context.Context, evt *event.Event)
- func (r *Registry) EmitWorkloadResumed(ctx context.Context, evt *event.Event)
- func (r *Registry) EmitWorkloadScaled(ctx context.Context, evt *event.Event)
- func (r *Registry) EmitWorkloadUpdated(ctx context.Context, evt *event.Event)
- func (r *Registry) Extensions() []Extension
- func (r *Registry) HandleEvent(ctx context.Context, evt *event.Event) error
- func (r *Registry) Register(e Extension)
- type Shutdown
- type TemplateCreated
- type TemplateDeleted
- type TemplateUpdated
- type TenantCreated
- type TenantDeleted
- type TenantSuspended
- type WorkloadCreated
- type WorkloadDeleted
- type WorkloadDeployed
- type WorkloadFailed
- type WorkloadPaused
- type WorkloadRestarted
- type WorkloadResumed
- type WorkloadScaled
- type WorkloadUpdated
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CertExpiring ¶
CertExpiring is called when a TLS certificate is approaching expiry.
type CertProvisioned ¶
CertProvisioned is called when a TLS certificate is provisioned.
type DeployFailed ¶
DeployFailed is called when a deployment fails.
type DeployRolledBack ¶
DeployRolledBack is called when a deployment is rolled back.
type DeployStarted ¶
DeployStarted is called when a deployment begins.
type DeploySucceeded ¶
DeploySucceeded is called when a deployment completes successfully.
type DomainAdded ¶
DomainAdded is called when a domain is added to an instance.
type DomainRemoved ¶
DomainRemoved is called when a domain is removed.
type DomainVerified ¶
DomainVerified is called when a domain passes verification.
type Extension ¶
type Extension interface {
// Name returns a unique human-readable name for the plugin.
Name() string
}
Extension is the base interface all CtrlPlane plugins must implement.
type HealthCheckFailed ¶
type HealthCheckFailed interface {
OnHealthCheckFailed(ctx context.Context, evt *event.Event) error
}
HealthCheckFailed is called when a health check fails.
type HealthCheckPassed ¶
type HealthCheckPassed interface {
OnHealthCheckPassed(ctx context.Context, evt *event.Event) error
}
HealthCheckPassed is called when a health check passes.
type HealthDegraded ¶
HealthDegraded is called when an instance enters a degraded state.
type HealthRecovered ¶
HealthRecovered is called when an instance recovers from a degraded state.
type InstanceCreated ¶
InstanceCreated is called when an instance is provisioned.
type InstanceDeleted ¶
InstanceDeleted is called when an instance is deprovisioned and removed.
type InstanceFailed ¶
InstanceFailed is called when an instance enters a failed state.
type InstanceScaled ¶
InstanceScaled is called when instance resources are adjusted.
type InstanceStarted ¶
InstanceStarted is called when an instance transitions to running.
type InstanceStopped ¶
InstanceStopped is called when an instance is stopped.
type InstanceSuspended ¶
type InstanceSuspended interface {
OnInstanceSuspended(ctx context.Context, evt *event.Event) error
}
InstanceSuspended is called when an instance is suspended.
type InstanceUnsuspended ¶
type InstanceUnsuspended interface {
OnInstanceUnsuspended(ctx context.Context, evt *event.Event) error
}
InstanceUnsuspended is called when a suspended instance is restored.
type QuotaExceeded ¶
QuotaExceeded is called when a tenant exceeds their quota.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry holds registered plugins and dispatches lifecycle events to them. It type-caches plugins at registration time so emit calls iterate only over plugins that implement the relevant hook.
func NewRegistry ¶
NewRegistry creates a plugin registry with the given logger.
func (*Registry) EmitCertExpiring ¶
EmitCertExpiring notifies all plugins that implement CertExpiring.
func (*Registry) EmitCertProvisioned ¶
EmitCertProvisioned notifies all plugins that implement CertProvisioned.
func (*Registry) EmitDeployFailed ¶
EmitDeployFailed notifies all plugins that implement DeployFailed.
func (*Registry) EmitDeployRolledBack ¶
EmitDeployRolledBack notifies all plugins that implement DeployRolledBack.
func (*Registry) EmitDeployStarted ¶
EmitDeployStarted notifies all plugins that implement DeployStarted.
func (*Registry) EmitDeploySucceeded ¶
EmitDeploySucceeded notifies all plugins that implement DeploySucceeded.
func (*Registry) EmitDomainAdded ¶
EmitDomainAdded notifies all plugins that implement DomainAdded.
func (*Registry) EmitDomainRemoved ¶
EmitDomainRemoved notifies all plugins that implement DomainRemoved.
func (*Registry) EmitDomainVerified ¶
EmitDomainVerified notifies all plugins that implement DomainVerified.
func (*Registry) EmitHealthCheckFailed ¶
EmitHealthCheckFailed notifies all plugins that implement HealthCheckFailed.
func (*Registry) EmitHealthCheckPassed ¶
EmitHealthCheckPassed notifies all plugins that implement HealthCheckPassed.
func (*Registry) EmitHealthDegraded ¶
EmitHealthDegraded notifies all plugins that implement HealthDegraded.
func (*Registry) EmitHealthRecovered ¶
EmitHealthRecovered notifies all plugins that implement HealthRecovered.
func (*Registry) EmitInstanceCreated ¶
EmitInstanceCreated notifies all plugins that implement InstanceCreated.
func (*Registry) EmitInstanceDeleted ¶
EmitInstanceDeleted notifies all plugins that implement InstanceDeleted.
func (*Registry) EmitInstanceFailed ¶
EmitInstanceFailed notifies all plugins that implement InstanceFailed.
func (*Registry) EmitInstanceScaled ¶
EmitInstanceScaled notifies all plugins that implement InstanceScaled.
func (*Registry) EmitInstanceStarted ¶
EmitInstanceStarted notifies all plugins that implement InstanceStarted.
func (*Registry) EmitInstanceStopped ¶
EmitInstanceStopped notifies all plugins that implement InstanceStopped.
func (*Registry) EmitInstanceSuspended ¶
EmitInstanceSuspended notifies all plugins that implement InstanceSuspended.
func (*Registry) EmitInstanceUnsuspended ¶
EmitInstanceUnsuspended notifies all plugins that implement InstanceUnsuspended.
func (*Registry) EmitQuotaExceeded ¶
EmitQuotaExceeded notifies all plugins that implement QuotaExceeded.
func (*Registry) EmitShutdown ¶
EmitShutdown notifies all plugins that implement Shutdown.
func (*Registry) EmitTemplateCreated ¶ added in v1.5.1
EmitTemplateCreated notifies all plugins that implement TemplateCreated.
func (*Registry) EmitTemplateDeleted ¶ added in v1.5.1
EmitTemplateDeleted notifies all plugins that implement TemplateDeleted.
func (*Registry) EmitTemplateUpdated ¶ added in v1.5.1
EmitTemplateUpdated notifies all plugins that implement TemplateUpdated.
func (*Registry) EmitTenantCreated ¶
EmitTenantCreated notifies all plugins that implement TenantCreated.
func (*Registry) EmitTenantDeleted ¶
EmitTenantDeleted notifies all plugins that implement TenantDeleted.
func (*Registry) EmitTenantSuspended ¶
EmitTenantSuspended notifies all plugins that implement TenantSuspended.
func (*Registry) EmitWorkloadCreated ¶ added in v1.5.1
EmitWorkloadCreated notifies all plugins that implement WorkloadCreated.
func (*Registry) EmitWorkloadDeleted ¶ added in v1.5.1
EmitWorkloadDeleted notifies all plugins that implement WorkloadDeleted.
func (*Registry) EmitWorkloadDeployed ¶ added in v1.5.1
EmitWorkloadDeployed notifies all plugins that implement WorkloadDeployed.
func (*Registry) EmitWorkloadFailed ¶ added in v1.5.1
EmitWorkloadFailed notifies all plugins that implement WorkloadFailed.
func (*Registry) EmitWorkloadPaused ¶ added in v1.5.1
EmitWorkloadPaused notifies all plugins that implement WorkloadPaused.
func (*Registry) EmitWorkloadRestarted ¶ added in v1.5.1
EmitWorkloadRestarted notifies all plugins that implement WorkloadRestarted.
func (*Registry) EmitWorkloadResumed ¶ added in v1.5.1
EmitWorkloadResumed notifies all plugins that implement WorkloadResumed.
func (*Registry) EmitWorkloadScaled ¶ added in v1.5.1
EmitWorkloadScaled notifies all plugins that implement WorkloadScaled.
func (*Registry) EmitWorkloadUpdated ¶ added in v1.5.1
EmitWorkloadUpdated notifies all plugins that implement WorkloadUpdated.
func (*Registry) Extensions ¶
Extensions returns all registered plugins.
func (*Registry) HandleEvent ¶
HandleEvent is the event bus handler. It dispatches an event.Event to the appropriate plugin hook(s) based on the event type. This method is subscribed to the event bus to bridge events to plugins.
type TemplateCreated ¶ added in v1.5.1
TemplateCreated is called when a workload template is created.
type TemplateDeleted ¶ added in v1.5.1
TemplateDeleted is called when a workload template is deleted.
type TemplateUpdated ¶ added in v1.5.1
TemplateUpdated is called when a workload template is updated.
type TenantCreated ¶
TenantCreated is called when a new tenant is created.
type TenantDeleted ¶
TenantDeleted is called when a tenant is deleted.
type TenantSuspended ¶
TenantSuspended is called when a tenant is suspended.
type WorkloadCreated ¶ added in v1.5.1
WorkloadCreated is called when a workload is provisioned.
type WorkloadDeleted ¶ added in v1.5.1
WorkloadDeleted is called when a workload is torn down.
type WorkloadDeployed ¶ added in v1.5.1
WorkloadDeployed is called when a workload Deploy rollout starts.
type WorkloadFailed ¶ added in v1.5.1
WorkloadFailed is called when a workload enters StateFailed.
type WorkloadPaused ¶ added in v1.5.1
WorkloadPaused is called when a workload is scaled to zero with spec retained.
type WorkloadRestarted ¶ added in v1.5.1
type WorkloadRestarted interface {
OnWorkloadRestarted(ctx context.Context, evt *event.Event) error
}
WorkloadRestarted is called when an in-place restart sweeps every replica.
type WorkloadResumed ¶ added in v1.5.1
WorkloadResumed is called when a paused workload is restored.
type WorkloadScaled ¶ added in v1.5.1
WorkloadScaled is called when a workload's replica count changes.