Help us shape the future of Go! Take the 2026 Go Developer Survey

workloadcoverage

package
v0.16.0 Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package workloadcoverage reports on PDB and HPA coverage of replicated workloads. Deployments and StatefulSets running with replicas>1 but no matching PodDisruptionBudget will lose all pods during voluntary disruptions; the same workloads without an HPA cannot react to load. Both are common gaps that only become visible during incidents.

Index

Constants

View Source
const Name = "workload-coverage"

Name is the registry key for this scanner.

Variables

This section is empty.

Functions

func NewScanner

func NewScanner() scanner.Scanner

NewScanner returns a scanner that flags replicated workloads missing PDB or HPA coverage. It is read-only and tolerant: a failure listing one resource type does not abort the others; the result is marked StateDegraded with a reason naming any list that failed.

Types

type Coverage

type Coverage struct {
	// Kind is "Deployment" or "StatefulSet".
	Kind string `json:"kind"`
	// Namespace is the workload's namespace.
	Namespace string `json:"namespace"`
	// Name is the workload's name.
	Name string `json:"name"`
	// Replicas is the spec replica count.
	Replicas int32 `json:"replicas"`
	// HasPDB is true when a PodDisruptionBudget selects this workload's pods.
	HasPDB bool `json:"has_pdb"`
	// HasHPA is true when a HorizontalPodAutoscaler targets this workload.
	HasHPA bool `json:"has_hpa"`
}

Coverage describes a replicated workload's PDB and HPA presence.

type Data

type Data struct {
	// TotalReplicated is the count of Deployments/StatefulSets with replicas>1.
	TotalReplicated int `json:"total_replicated"`
	// MissingPDB is the count of replicated workloads without a matching PDB. It is zero
	// when the PDB read failed, and State is Degraded then.
	MissingPDB int `json:"missing_pdb"`
	// MissingHPA is the count of replicated workloads without an HPA target. It is zero
	// when the HPA read failed, and State is Degraded then.
	MissingHPA int `json:"missing_hpa"`
	// Gaps lists workloads with at least one missing element, sorted by namespace then name
	// and capped at 100.
	Gaps []Coverage `json:"gaps"`
}

Data holds workload coverage results for one cluster.

Jump to

Keyboard shortcuts

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