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 ¶
const Name = "workload-coverage"
Name is the registry key for this scanner.
Variables ¶
This section is empty.
Functions ¶
func NewScanner ¶
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.
MissingPDB int `json:"missing_pdb"`
// MissingHPA is the count of replicated workloads without an HPA target.
MissingHPA int `json:"missing_hpa"`
// Gaps lists workloads with at least one missing element, sorted by name.
Gaps []Coverage `json:"gaps"`
}
Data holds workload coverage results for one cluster.