Files
k8sgpt/pkg/analyzer
Anas Khan 58ab921e91 fix: guard against nil spec.replicas in deployment analyzer (#1683)
The Deployment analyzer dereferenced *deployment.Spec.Replicas without a
nil check. Spec.Replicas is a *int32 and, although the API server usually
defaults it to 1, a Deployment object whose replicas field is explicitly
unset (nil) panics the analyze run with a nil pointer dereference.

Guard the comparison with a nil check, mirroring the sibling StatefulSet
analyzer which already checks Spec.Replicas != nil before dereferencing.
Add a regression test that analyzes a Deployment with nil Spec.Replicas
and asserts Analyze does not panic.

Signed-off-by: Anas Khan <83116240+anxkhn@users.noreply.github.com>
Co-authored-by: Alex Jones <1235925+AlexsJones@users.noreply.github.com>
2026-07-14 08:08:49 +00:00
..
2025-04-15 13:43:38 +01:00
2024-07-18 14:31:41 +01:00
2024-02-07 11:30:45 +00:00
2024-07-18 14:31:41 +01:00
2024-07-18 14:31:41 +01:00
2024-07-18 14:31:41 +01:00
2025-06-20 13:27:49 +01:00
2024-07-18 14:31:41 +01:00
2024-07-18 14:31:41 +01:00
2024-07-18 14:31:41 +01:00
2024-07-18 14:31:41 +01:00
2024-07-18 14:31:41 +01:00
2024-07-18 14:31:41 +01:00
2025-04-15 13:43:38 +01:00
2025-04-15 13:43:38 +01:00
2024-11-12 12:04:01 +00:00
2025-04-15 13:43:38 +01:00
2025-04-15 13:43:38 +01:00
2025-04-15 13:43:38 +01:00
2024-09-17 08:39:39 +01:00