Skip to content

Commit

Permalink
Include annotation value in error log message
Browse files Browse the repository at this point in the history
Context
-------

It is helpful to have the annotation value in the error message so you
don't need to check ingress by ingress what happened, as most likely
the problem is that the value provided is not a number

Change-Id: I3c810a114a2ad600aaf5a80c8f17c71ea2964727
  • Loading branch information
zonzamas committed Oct 3, 2024
1 parent 067ad92 commit 66a60ca
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/controllers/ingress_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func (r *IngressReconciler) calculateIngressWeight(ingress netv1.Ingress) (uint,
backendPercentage = float64(backendPercentage) / float64(100)
userDesiredWeight, err := strconv.ParseFloat(ingress.Annotations[r.annotationKey("traffic-weight")], 64)
if err != nil {
return 0, fmt.Errorf("Cannot parse annotation %v", r.annotationKey("traffic-weight"))
return 0, fmt.Errorf("Cannot parse annotation %v with value '%v'", r.annotationKey("traffic-weight"), ingress.Annotations[r.annotationKey("traffic-weight")])
}
if userDesiredWeight < 0 {
return 0, fmt.Errorf("Cannot handle negative traffic weights")
Expand Down

0 comments on commit 66a60ca

Please sign in to comment.