Documentation
¶
Overview ¶
Package ops owns routing for the ops top-level command.
Index ¶
- func ComponentKeys() []string
- func GrafanaCredentialProbeArgs() []string
- func New(runtime *core.Runtime) *cobra.Command
- func NewWithManager(mgr *Manager) *cobra.Command
- type GrafanaCheckResult
- type GrafanaState
- type Manager
- func (m *Manager) CheckGrafanaCredentials() (GrafanaCheckResult, error)
- func (m *Manager) PortForwardTarget(target string, localPort int, address string) error
- func (m *Manager) ResetGrafanaAdminPassword(confirmed bool) error
- func (m *Manager) Restart(component string, restartAll bool) error
- func (m *Manager) ShowEvents() error
- func (m *Manager) ShowGrafanaCheck() error
- func (m *Manager) ShowStatus() error
- func (m *Manager) ViewLogs(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 GrafanaCredentialProbeArgs ¶
func GrafanaCredentialProbeArgs() []string
GrafanaCredentialProbeArgs returns the kubectl arguments for the read-only in-pod credential probe. Its output is parsed with ParseGrafanaProbe and contains only HTTP status codes, never credential values. cluster doctor shares this probe so both report drift identically.
func NewWithManager ¶
NewWithManager returns the ops 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 Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager operates the bundled platform stack via kubectl.
func DefaultManager ¶
DefaultManager returns a Manager using the shared runtime clients.
func NewManager ¶
func NewManager(kubectl *core.KubectlClient, logger *zap.Logger) *Manager
NewManager creates a Manager with explicit dependencies.
func (*Manager) CheckGrafanaCredentials ¶
func (m *Manager) 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 (*Manager) PortForwardTarget ¶
PortForwardTarget runs kubectl port-forward for a known service target.
func (*Manager) ResetGrafanaAdminPassword ¶
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 (*Manager) ShowEvents ¶
ShowEvents lists events from each platform-owned namespace.
func (*Manager) ShowGrafanaCheck ¶
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 (*Manager) ShowStatus ¶
ShowStatus prints a status table for platform workloads.