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) 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) Extensions() []Extension
- func (r *Registry) HandleEvent(ctx context.Context, evt *event.Event) error
- func (r *Registry) Register(e Extension)
- type Shutdown
- type TenantCreated
- type TenantDeleted
- type TenantSuspended
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) 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) 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 TenantCreated ¶
TenantCreated is called when a new tenant is created.
type TenantDeleted ¶
TenantDeleted is called when a tenant is deleted.