services

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2026 License: MIT Imports: 40 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeartbeatInterval = 1 * time.Minute
	PingTimeout       = 10 * time.Second
)
View Source
const ReconcileInterval = 1 * time.Minute

ReconcileInterval is the default self-heal cadence. Override with the ELCHI_RECONCILE_INTERVAL env var (any Go duration, e.g. "30s", "2m"); a value <= 0 disables the reconcile loop entirely.

Variables

This section is empty.

Functions

func ApplyDeploymentUpdates

func ApplyDeploymentUpdates(ctx context.Context, deployReq *client.RequestDeploy, checkResult *DeploymentCheckResult, logger *logger.Logger, runner *cmdrunner.CommandsRunner) error

ApplyDeploymentUpdates applies only the changed components

func PersistFilebeatDesired added in v1.6.1

func PersistFilebeatDesired(req *client.RequestFilebeat) error

PersistFilebeatDesired records the filebeat config the control plane just applied.

func PersistRsyslogDesired added in v1.6.1

func PersistRsyslogDesired(req *client.RequestRsyslog) error

PersistRsyslogDesired records the rsyslog config the control plane just applied.

Types

type CloudDetector

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

CloudDetector handles cloud provider detection

func NewCloudDetector

func NewCloudDetector() *CloudDetector

NewCloudDetector creates a new cloud detector

func (*CloudDetector) DetectProvider

func (cd *CloudDetector) DetectProvider(ctx context.Context) string

DetectProvider tries to detect the cloud provider

func (*CloudDetector) GetMetadata

func (cd *CloudDetector) GetMetadata(ctx context.Context, cloudName, detectedProvider string) map[string]string

GetMetadata returns metadata based on cloud name and detected provider

type CloudDetectorConfig

type CloudDetectorConfig struct {
	DetectionTimeout time.Duration // Timeout for detection requests
	MetadataTimeout  time.Duration // Timeout for metadata requests
	OverallTimeout   time.Duration // Overall HTTP client timeout
}

CloudDetectorConfig holds timeout configurations

type DeployState

type DeployState struct {
	CreatedFiles      []string
	ServiceEnabled    bool // Service has been enabled in systemd
	ServiceStarted    bool // Service has been started
	ServiceName       string
	DummyIfaceName    string
	DummyIfaceCreated bool // Interface was actually created (not just attempted)
	SystemdReloaded   bool // daemon-reload was performed
}

type DeploymentCheckResult

type DeploymentCheckResult struct {
	Exists              bool
	NeedsUpdate         bool
	BootstrapChanged    bool
	InterfaceChanged    bool
	ServiceChanged      bool
	ServiceNeedsRestart bool
	// BinaryMissing is set when the versioned envoy binary the unit points at is
	// absent. A restart would then fail with a generic systemd error; callers use
	// this to emit a precise, actionable error (re-push the binary) instead.
	BinaryMissing bool
}

DeploymentCheckResult contains information about what needs to be updated

func CheckExistingDeployment

func CheckExistingDeployment(ctx context.Context, deployReq *client.RequestDeploy, logger *logger.Logger, runner *cmdrunner.CommandsRunner) (*DeploymentCheckResult, error)

CheckExistingDeployment checks if a deployment exists and if it needs updates

type HeartbeatService

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

HeartbeatService manages periodic ping requests to the controller

func NewHeartbeatService

func NewHeartbeatService(baseLogger *logger.Logger, cfg *config.Config) *HeartbeatService

NewHeartbeatService creates a new heartbeat service

func (*HeartbeatService) Initialize

func (h *HeartbeatService) Initialize(clientID string) error

Initialize creates dedicated gRPC connection and sets client ID

func (*HeartbeatService) SendPing

func (h *HeartbeatService) SendPing() (*client.PingResponse, error)

SendPing sends a single ping request (can be used by other components)

func (*HeartbeatService) SetReregisterCallback

func (h *HeartbeatService) SetReregisterCallback(cb ReregisterCallback)

SetReregisterCallback sets the callback to be called when controller responds with "client not registered"

func (*HeartbeatService) Start

func (h *HeartbeatService) Start() error

Start begins the heartbeat service

func (*HeartbeatService) Stop

func (h *HeartbeatService) Stop()

Stop gracefully stops the heartbeat service

type Reconciler added in v1.6.1

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

Reconciler periodically repairs manually-deleted or drifted rsyslog/filebeat config by re-asserting the last-known-desired config the control plane delivered.

It reconciles ONLY toward a state the control plane actually delivered: if no config was ever pushed, it does nothing — it never invents config — so it cannot fight the control plane. The repair reuses the normal UpdateConfig path (atomic, validated write + service restart), and every repair is logged.

func NewReconciler added in v1.6.1

func NewReconciler(baseLogger *logger.Logger) *Reconciler

NewReconciler builds a reconciler with its own command runner.

func (*Reconciler) Start added in v1.6.1

func (r *Reconciler) Start(ctx context.Context)

Start runs the reconcile loop until ctx is cancelled.

type ReregisterCallback

type ReregisterCallback func()

ReregisterCallback is called when controller responds with "client not registered"

type Services

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

func NewServices

func NewServices() *Services

func (*Services) ApplyCommunityList

func (s *Services) ApplyCommunityList(cmd *client.Command, bgpReq *client.RequestBgp, manager bgp.BGPManagerInterface) *client.CommandResponse

func (*Services) ApplyPrefixList

func (s *Services) ApplyPrefixList(cmd *client.Command, bgpReq *client.RequestBgp, manager bgp.BGPManagerInterface) *client.CommandResponse

func (*Services) ApplyRouteMap

func (s *Services) ApplyRouteMap(cmd *client.Command, bgpReq *client.RequestBgp, manager bgp.BGPManagerInterface) *client.CommandResponse

func (*Services) ClearBgpRoutes

func (s *Services) ClearBgpRoutes(cmd *client.Command, bgpReq *client.RequestBgp, manager bgp.BGPManagerInterface) *client.CommandResponse

ClearBgpRoutes clears BGP routes based on clear parameters

func (*Services) ClientStats

func (s *Services) ClientStats(_ context.Context, cmd *proto.Command) *proto.CommandResponse

func (*Services) DeployService

func (s *Services) DeployService(ctx context.Context, cmd *client.Command) *client.CommandResponse

func (*Services) EnvoyVersionService

func (s *Services) EnvoyVersionService(ctx context.Context, cmd *client.Command) *client.CommandResponse

EnvoyVersionService handles envoy version management commands

func (*Services) FilebeatService

func (s *Services) FilebeatService(ctx context.Context, cmd *client.Command) *client.CommandResponse

func (*Services) FilebeatServiceAction

func (s *Services) FilebeatServiceAction(ctx context.Context, cmd *client.Command, action string) *client.CommandResponse

func (*Services) FilebeatServiceLogs

func (s *Services) FilebeatServiceLogs(cmd *client.Command) *client.CommandResponse

func (*Services) FrrService

func (s *Services) FrrService(_ context.Context, cmd *client.Command) *client.CommandResponse

Handle FRR protocol requests

func (*Services) GeneralLog

func (s *Services) GeneralLog(_ context.Context, cmd *client.Command) *client.CommandResponse

func (*Services) GetBgpConfig

func (s *Services) GetBgpConfig(cmd *client.Command, manager bgp.BGPManagerInterface) *client.CommandResponse

func (*Services) GetBgpNeighbor

func (s *Services) GetBgpNeighbor(cmd *client.Command, bgpReq *client.RequestBgp, manager bgp.BGPManagerInterface) *client.CommandResponse

func (*Services) GetBgpPolicyConfig

func (s *Services) GetBgpPolicyConfig(cmd *client.Command, _ *client.RequestBgp, manager bgp.BGPManagerInterface) *client.CommandResponse

func (*Services) GetBgpSummary

func (s *Services) GetBgpSummary(cmd *client.Command, manager bgp.BGPManagerInterface) *client.CommandResponse

func (*Services) GetFilebeatConfig

func (s *Services) GetFilebeatConfig(ctx context.Context, cmd *client.Command) *client.CommandResponse

func (*Services) GetFilebeatStatus

func (s *Services) GetFilebeatStatus(ctx context.Context, cmd *client.Command) *client.CommandResponse

func (*Services) GetRsyslogConfig

func (s *Services) GetRsyslogConfig(ctx context.Context, cmd *client.Command) *client.CommandResponse

func (*Services) GetRsyslogStatus

func (s *Services) GetRsyslogStatus(ctx context.Context, cmd *client.Command) *client.CommandResponse

func (*Services) HandleBgpNeighbor

func (s *Services) HandleBgpNeighbor(cmd *client.Command, bgpReq *client.RequestBgp, manager bgp.BGPManagerInterface) *client.CommandResponse

func (*Services) ListBgpNeighbors

func (s *Services) ListBgpNeighbors(cmd *client.Command, _ *client.RequestBgp, manager bgp.BGPManagerInterface) *client.CommandResponse

func (*Services) NetworkService

func (s *Services) NetworkService(_ context.Context, cmd *client.Command) *client.CommandResponse

func (*Services) ProxyEnvoyAdmin

func (s *Services) ProxyEnvoyAdmin(ctx context.Context, cmd *client.Command) *client.CommandResponse

func (*Services) RemoveBgpNeighbor

func (s *Services) RemoveBgpNeighbor(cmd *client.Command, bgpReq *client.RequestBgp, manager bgp.BGPManagerInterface) *client.CommandResponse

func (*Services) RemoveCommunityList

func (s *Services) RemoveCommunityList(cmd *client.Command, bgpReq *client.RequestBgp, manager bgp.BGPManagerInterface) *client.CommandResponse

func (*Services) RemovePrefixList

func (s *Services) RemovePrefixList(cmd *client.Command, bgpReq *client.RequestBgp, manager bgp.BGPManagerInterface) *client.CommandResponse

func (*Services) RemoveRouteMap

func (s *Services) RemoveRouteMap(cmd *client.Command, bgpReq *client.RequestBgp, manager bgp.BGPManagerInterface) *client.CommandResponse

func (*Services) RsyslogService

func (s *Services) RsyslogService(ctx context.Context, cmd *client.Command) *client.CommandResponse

func (*Services) RsyslogServiceAction

func (s *Services) RsyslogServiceAction(ctx context.Context, cmd *client.Command, action string) *client.CommandResponse

func (*Services) RsyslogServiceLogs

func (s *Services) RsyslogServiceLogs(cmd *client.Command) *client.CommandResponse

func (*Services) SetBgpConfig

func (s *Services) SetBgpConfig(cmd *client.Command, bgpReq *client.RequestBgp, bgpManager bgp.BGPManagerInterface) *client.CommandResponse

func (*Services) SetGRPCClient

func (s *Services) SetGRPCClient(client *elchigrpc.Client)

SetGRPCClient sets the gRPC client for services that need it

func (*Services) ShieldService added in v1.2.0

func (s *Services) ShieldService(ctx context.Context, cmd *client.Command) *client.CommandResponse

ShieldService handles SHIELD commands: deliver shield's watched config bundle, read what's on disk, or report shield's service status. elchi-shield self-watches its config dir and hot-reloads, so UPDATE only writes files — it never restarts shield.

func (*Services) ShowBgpRoutes

func (s *Services) ShowBgpRoutes(cmd *client.Command, manager bgp.BGPManagerInterface) *client.CommandResponse

func (*Services) SystemdService

func (s *Services) SystemdService(ctx context.Context, cmd *client.Command) *client.CommandResponse

func (*Services) SystemdServiceAction

func (s *Services) SystemdServiceAction(ctx context.Context, cmd *client.Command) *client.CommandResponse

func (*Services) SystemdServiceLogs

func (s *Services) SystemdServiceLogs(cmd *client.Command) *client.CommandResponse

func (*Services) UndeployService

func (s *Services) UndeployService(ctx context.Context, cmd *client.Command) *client.CommandResponse

func (*Services) UpdateBootstrapService

func (s *Services) UpdateBootstrapService(ctx context.Context, cmd *client.Command) *client.CommandResponse

func (*Services) UpdateFilebeatConfig

func (s *Services) UpdateFilebeatConfig(ctx context.Context, cmd *client.Command) *client.CommandResponse

func (*Services) UpdateRsyslogConfig

func (s *Services) UpdateRsyslogConfig(ctx context.Context, cmd *client.Command) *client.CommandResponse

func (*Services) UpgradeListenerService

func (s *Services) UpgradeListenerService(ctx context.Context, cmd *client.Command) *client.CommandResponse

func (*Services) WafVersionService

func (s *Services) WafVersionService(ctx context.Context, cmd *client.Command) *client.CommandResponse

WafVersionService handles WAF version management commands

Jump to

Keyboard shortcuts

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