ops

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package ops owns routing for the ops top-level command.

Index

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 New

func New(runtime *core.Runtime) *cobra.Command

New returns the ops command.

func NewWithManager

func NewWithManager(mgr *Manager) *cobra.Command

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

func DefaultManager(runtime *core.Runtime) *Manager

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

func (m *Manager) PortForwardTarget(target string, localPort int, address string) error

PortForwardTarget runs kubectl port-forward for a known service target.

func (*Manager) ResetGrafanaAdminPassword

func (m *Manager) 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 (*Manager) Restart

func (m *Manager) Restart(component string, restartAll bool) error

Restart restarts one component or all platform workloads.

func (*Manager) ShowEvents

func (m *Manager) ShowEvents() error

ShowEvents lists events from each platform-owned namespace.

func (*Manager) ShowGrafanaCheck

func (m *Manager) 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 (*Manager) ShowStatus

func (m *Manager) ShowStatus() error

ShowStatus prints a status table for platform workloads.

func (*Manager) ViewLogs

func (m *Manager) ViewLogs(component string, follow, previous bool, tail int, since string) error

ViewLogs streams logs for a platform component.

Jump to

Keyboard shortcuts

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