Documentation
¶
Overview ¶
Package sentinel owns routing for the sentinel top-level command.
Index ¶
- func ComponentKeys() []string
- func New(runtime *core.Runtime) *cobra.Command
- func NewWithManager(mgr *SentinelManager) *cobra.Command
- type GrafanaCheckResult
- type GrafanaState
- type SentinelManager
- func (m *SentinelManager) CheckGrafanaCredentials() (GrafanaCheckResult, error)
- func (m *SentinelManager) PortForwardSentinelTarget(target string, localPort int, address string) error
- func (m *SentinelManager) ResetGrafanaAdminPassword(confirmed bool) error
- func (m *SentinelManager) RestartSentinel(component string, restartAll bool) error
- func (m *SentinelManager) ShowGrafanaCheck() error
- func (m *SentinelManager) ShowSentinelEvents() error
- func (m *SentinelManager) ShowSentinelStatus() error
- func (m *SentinelManager) ViewSentinelLogs(component string, follow, previous bool, tail int, since string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComponentKeys ¶
func ComponentKeys() []string
ComponentKeys returns sorted valid component names for cobra completion.
func NewWithManager ¶
func NewWithManager(mgr *SentinelManager) *cobra.Command
NewWithManager returns the sentinel command using the provided manager.
Types ¶
type GrafanaCheckResult ¶
type GrafanaCheckResult struct {
State GrafanaState
HealthCode string
AuthCode string
}
GrafanaCheckResult is the parsed probe output.
func ParseGrafanaProbe ¶
func ParseGrafanaProbe(output string) GrafanaCheckResult
ParseGrafanaProbe parses the "health=<code> auth=<code>" probe output.
type GrafanaState ¶
type GrafanaState string
GrafanaState classifies the result of the Grafana credential probe.
const ( // GrafanaAuthOK means the configured admin credentials authenticate. GrafanaAuthOK GrafanaState = "ok" // GrafanaCredentialDrift means Grafana is healthy but rejects the configured // credentials (persisted account differs from the Secret). GrafanaCredentialDrift GrafanaState = "drift" // GrafanaUnhealthy means Grafana did not answer its health endpoint. GrafanaUnhealthy GrafanaState = "unhealthy" // GrafanaUnknown means Grafana answered with an unexpected status. GrafanaUnknown GrafanaState = "unknown" )
type SentinelManager ¶
type SentinelManager struct {
// contains filtered or unexported fields
}
SentinelManager operates the bundled platform stack via kubectl.
func DefaultSentinelManager ¶
func DefaultSentinelManager(runtime *core.Runtime) *SentinelManager
DefaultSentinelManager returns a SentinelManager using the shared runtime clients.
func NewSentinelManager ¶
func NewSentinelManager(kubectl *core.KubectlClient, logger *zap.Logger) *SentinelManager
NewSentinelManager creates a SentinelManager with explicit dependencies.
func (*SentinelManager) CheckGrafanaCredentials ¶
func (m *SentinelManager) CheckGrafanaCredentials() (GrafanaCheckResult, error)
CheckGrafanaCredentials probes Grafana read-only and reports whether the persisted admin account accepts the configured credentials. It never resets or modifies an account.
func (*SentinelManager) PortForwardSentinelTarget ¶
func (m *SentinelManager) PortForwardSentinelTarget(target string, localPort int, address string) error
PortForwardSentinelTarget runs kubectl port-forward for a known service target.
func (*SentinelManager) ResetGrafanaAdminPassword ¶
func (m *SentinelManager) ResetGrafanaAdminPassword(confirmed bool) error
ResetGrafanaAdminPassword restores the persisted Grafana admin password to the configured value after a database backup. It is deliberate: it requires confirmation, refuses unless drift is detected, and verifies the result.
func (*SentinelManager) RestartSentinel ¶
func (m *SentinelManager) RestartSentinel(component string, restartAll bool) error
RestartSentinel restarts one component or all sentinel workloads.
func (*SentinelManager) ShowGrafanaCheck ¶
func (m *SentinelManager) ShowGrafanaCheck() error
ShowGrafanaCheck prints the credential check and returns an error when the persisted credentials are not usable, so scripts can gate on the exit code.
func (*SentinelManager) ShowSentinelEvents ¶
func (m *SentinelManager) ShowSentinelEvents() error
ShowSentinelEvents lists events from each platform-owned namespace.
func (*SentinelManager) ShowSentinelStatus ¶
func (m *SentinelManager) ShowSentinelStatus() error
ShowSentinelStatus prints a status table for sentinel workloads.
func (*SentinelManager) ViewSentinelLogs ¶
func (m *SentinelManager) ViewSentinelLogs(component string, follow, previous bool, tail int, since string) error
ViewSentinelLogs streams logs for a sentinel component.