configpublisher

package
v0.1.0-alpha.12 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ComponentName is the unique identifier for this component.
	ComponentName = "config-publisher"

	// EventBufferSize is the buffer size for the event subscription channel.
	// Large buffer (200) to handle burst traffic during startup.
	// ConfigPublisher makes synchronous k8s API calls, so it processes events slowly
	// compared to the rate at which all-replica components publish them.
	EventBufferSize = 200
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Component

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

Component is the event adapter for the config publisher. It wraps the pure Publisher component and coordinates it with the event bus.

This component caches information from multiple events (ConfigValidatedEvent, TemplateRenderedEvent) and publishes runtime config resources only after successful HAProxy validation (ValidationCompletedEvent).

Rendered configs are cached by correlation ID to ensure we match the correct TemplateRenderedEvent with its corresponding ValidationCompletedEvent, even when events from multiple reconciliation cycles are interleaved.

The component uses async workers for K8S API operations to prevent blocking the event loop. This ensures new events are processed promptly even when K8S API calls are slow.

func New

func New(
	publisher *configpublisher.Publisher,
	eventBus *busevents.EventBus,
	logger *slog.Logger,
) *Component

New creates a new config publisher component.

func (*Component) Name

func (c *Component) Name() string

Name returns the unique identifier for this component. Implements the lifecycle.Component interface.

func (*Component) Start

func (c *Component) Start(ctx context.Context) error

Start begins the config publisher's event loop.

This method blocks until the context is cancelled or an error occurs. It subscribes to events when called (after leadership is acquired).

Parameters:

  • ctx: Context for cancellation and lifecycle management

Returns:

  • nil when context is cancelled (graceful shutdown)
  • Error only in exceptional circumstances

func (*Component) SubscriptionReady

func (c *Component) SubscriptionReady() <-chan struct{}

SubscriptionReady returns a channel that is closed when the component has completed its event subscription. This implements lifecycle.SubscriptionReadySignaler.

Jump to

Keyboard shortcuts

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