Commit ef6a2ba4 authored by Edmund Ochieng's avatar Edmund Ochieng

Merge branch 'autoscale_bug' into 'master'

handle nil HPA pointer exception

See merge request !19
parents dcbdece5 a7a96db3
Pipeline #189770628 passed with stages
in 10 minutes and 48 seconds
......@@ -652,6 +652,11 @@ func (r *GitLabReconciler) reconcileHPA(ctx context.Context, deployment *appsv1.
err := r.Get(ctx, types.NamespacedName{Name: deployment.Name, Namespace: cr.Namespace}, found)
if err != nil {
if errors.IsNotFound(err) {
// return nil if hpa is nil
if hpa == nil {
return nil
}
if err := controllerutil.SetControllerReference(cr, hpa, r.Scheme); err != nil {
return err
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment