verify

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: Apache-2.0 Imports: 19 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// DefaultAPITimeout is how long checkKubernetes waits for the API to become reachable.
	DefaultAPITimeout = 10 * time.Second
	// APIPollInterval is the waitForAPI ticker interval.
	APIPollInterval = 1 * time.Second

	// DefaultDeploymentReplicas is the expected replica count when Spec.Replicas is nil.
	DefaultDeploymentReplicas int32 = 1

	// Check display names (stable report identifiers, not Kubernetes object names).
	CheckNameScope           = "scope"
	CheckNameAPI             = "api"
	CheckNameNodes           = "nodes"
	CheckNameNamespace       = "namespace"
	CheckNameNamespaces      = "namespaces"
	CheckNameCalicoNode      = "calico-node"
	CheckNameHealth          = "health"
	CheckNamePeer            = "peer"
	CheckNameClient          = "client"
	CheckNameProvisioned     = "provisioned"
	CheckNameInboundPeering  = "inbound-peering"
	CheckNameServiceStatus   = "service-status"
	CheckNameRemoteNamespace = "remote-namespace"
	CheckNameHelmWorkloads   = "helm-workloads"
	CheckNameHelmNamespace   = "helm-namespace"
	CheckNameCRDs            = "crds"
	CheckNameOperatorDeploy  = "operator-deployment"
	CheckNameAlloy           = "alloy"
	CheckNameExporter        = "exporter"
	CheckNameVNCNamespace    = "vnc-namespace"
	CheckNameVNCGateway      = "vnc-gateway"
	CheckNameMimirSecret     = "mimir-secret"
)

Verify package defaults for timeouts and check names.

View Source
const (
	SectionKubernetes = "kubernetes"
	SectionCalico     = "calico"
	SectionLiqo       = "liqo"
	SectionPeering    = "peering"
	SectionOffloading = "offloading"
	SectionAgent      = "agent"
	SectionOperator   = "operator"
)

Section identifiers used in reports and --section filtering.

Variables

AllSections is the ordered list of verify subsections.

Functions

func FormatText

func FormatText(w io.Writer, report *Report) error

FormatText writes a human-readable report to w.

func SummaryLine

func SummaryLine(report *Report) string

SummaryLine returns a one-line summary suitable for logs.

func ValidateOnlySections

func ValidateOnlySections(sections []string) error

ValidateOnlySections returns an error if OnlySections contains unknown names.

Types

type AgentStatus

type AgentStatus struct {
	Provisioned         bool
	InboundPeeringState string
	InboundPeeringError string
	ServiceStatus       string
	Name                string
}

AgentStatus is the platform API view of an agent used by the agent section.

type AgentStatusFetcher

type AgentStatusFetcher interface {
	FetchAgentStatus(ctx context.Context, agentID string) (*AgentStatus, error)
}

AgentStatusFetcher loads agent status from the platform API.

type Check

type Check struct {
	Section string `json:"section"`
	Name    string `json:"name"`
	Status  Status `json:"status"`
	Message string `json:"message"`
}

Check is one named assertion inside a section.

type Options

type Options struct {
	AgentID        string
	KubeconfigPath string

	// OnlySections, when non-empty, restricts execution to these section names.
	OnlySections []string

	// ExpectOffloading requires NamespaceOffloading for OffloadNamespaces.
	ExpectOffloading  bool
	OffloadNamespaces []string

	// ExpectOperator requires hypervisor operator chart workloads and CRDs.
	ExpectOperator      bool
	HypervisorDriver    string
	OperatorNamespace   string // Helm install namespace (default: proxmox-system or virtfusion-system)
	OperatorRelease     string
	VNCGatewayNamespace string

	// ExpectOperatorRemoteNS requires the remote namespace reflected after inbound peering.
	ExpectOperatorRemoteNS bool
	OperatorRemoteNS       string

	// ExpectAgentAPI polls the platform API for provisioned / inbound peering status.
	ExpectAgentAPI bool
}

Options controls which verify subsections run and what they expect. Built from `nr cluster register` flags so skipped phases are not required.

func OptionsFromRegister

func OptionsFromRegister(scope RegisterScope) Options

OptionsFromRegister builds verify Options matching what register installed.

type RegisterScope

type RegisterScope struct {
	AgentID             string
	DisableOffloading   bool
	SkipOperatorInstall bool
	HypervisorDriver    string
	OperatorNamespace   string // optional extra namespace to offload (not the Helm namespace)
	VNCGatewayNamespace string
	OffloadNamespaces   []string
}

RegisterScope captures the register-flag subset that affects verify.

type Report

type Report struct {
	AgentID  string          `json:"agent_id,omitempty"`
	Sections []SectionResult `json:"sections"`
}

Report is the full provider-cluster verification result.

func (*Report) FailedCount

func (r *Report) FailedCount() int

FailedCount returns how many checks have StatusFail.

func (*Report) FlatChecks

func (r *Report) FlatChecks() []Check

FlatChecks returns all checks in report order.

func (*Report) Passed

func (r *Report) Passed() bool

Passed reports whether no check failed (warn/skip are OK).

type SectionResult

type SectionResult struct {
	Name   string  `json:"name"`
	Checks []Check `json:"checks"`
}

SectionResult groups checks under a subsection name.

type Status

type Status string

Status is the outcome of a single check.

const (
	StatusPass Status = "pass"
	StatusFail Status = "fail"
	StatusWarn Status = "warn"
	StatusSkip Status = "skip"
)

type Verifier

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

Verifier runs provider-cluster health subsections.

func New

func New(opts Options, client *k8s.Client, agent AgentStatusFetcher) *Verifier

New creates a Verifier. client may be nil; kubernetes section will fail until set.

func (*Verifier) Run

func (v *Verifier) Run(ctx context.Context) (*Report, error)

Run executes enabled subsections and returns a Report.

Jump to

Keyboard shortcuts

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