Skip to content

Commit

Permalink
Fix panic when spec.replicas is nil (#798)
Browse files Browse the repository at this point in the history
  • Loading branch information
wei840222 authored Apr 7, 2022
1 parent 749c28a commit f2073ef
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/collector/reconcile/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func expectedDeployments(ctx context.Context, params Params, expected []appsv1.D
currentReplicas := existing.Status.Replicas
// if replicas (minReplicas from HPA perspective) is bigger than
// current status use it.
if *params.Instance.Spec.Replicas > currentReplicas {
if params.Instance.Spec.Replicas != nil && *params.Instance.Spec.Replicas > currentReplicas {
currentReplicas = *params.Instance.Spec.Replicas
}
updated.Spec.Replicas = &currentReplicas
Expand Down

0 comments on commit f2073ef

Please sign in to comment.