feat: export HorizontalPodAutoscaler
Relates to issue #34
Changes
This merge request adds HorizontalPodAutoscaler (HPA) export functionality to the kubeSOS.sh script, enabling GitLab support engineers to collect critical autoscaling configuration data for diagnostics.
Implementation Details
Added two kubectl commands to the get_resources() function to collect HPA data:
-
Line 236:
kubectl get horizontalpodautoscalers "${namespace[@]}" > "$archive_dir"/get_horizontalpodautoscalers &- Lists all HPA objects with basic information (name, reference, targets, min/max pods, replicas, age)
-
Line 237:
kubectl describe horizontalpodautoscalers "${namespace[@]}" > "$archive_dir"/describe_horizontalpodautoscalers &- Provides detailed HPA configuration including scaling policies, conditions, and events
Key Features
- Commands follow the same pattern as other Kubernetes resources already collected by kubeSOS
- Both commands execute in the background (using
&) for parallel execution, consistent with the script's performance optimization strategy - Commands use the
"${namespace[@]}"variable to target the correct namespace (defaults to 'gitlab' namespace) - Output files are saved to
$archive_dir/get_horizontalpodautoscalersand$archive_dir/describe_horizontalpodautoscalers
Result
When kubeSOS runs, it will now automatically export HorizontalPodAutoscaler objects from the GitLab namespace, providing GitLab support engineers with critical autoscaling configuration data to help diagnose scaling and performance issues.