Skip to content

Commit

Permalink
fix fallback logic for HPAv2 to v2beta2
Browse files Browse the repository at this point in the history
Signed-off-by: Sanskar Jaiswal <[email protected]>
  • Loading branch information
Sanskar Jaiswal committed Jul 29, 2022
1 parent 7cf843d commit 844411c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/canary/hpa_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ func (hr *HPAReconciler) reconcilePrimaryHpa(cd *flaggerv1.Canary, init bool) er
var betaHpa *hpav2beta2.HorizontalPodAutoscaler
hpa, err := hr.kubeClient.AutoscalingV2().HorizontalPodAutoscalers(cd.Namespace).Get(context.TODO(), cd.Spec.AutoscalerRef.Name, metav1.GetOptions{})
if err != nil {
hr.logger.Debugf("v2 HorizontalPodAutoscaler %s.%s get query error: %w; falling back to v2beta2",
hpa = nil
hr.logger.Debugf("v2 HorizontalPodAutoscaler %s.%s get query error: %s; falling back to v2beta2",
cd.Namespace, cd.Spec.AutoscalerRef.Name, err)
var betaErr error
betaHpa, betaErr = hr.kubeClient.AutoscalingV2beta2().HorizontalPodAutoscalers(cd.Namespace).Get(context.TODO(), cd.Spec.AutoscalerRef.Name, metav1.GetOptions{})
Expand Down

0 comments on commit 844411c

Please sign in to comment.