Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions pkg/gateway/model_build_rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"errors"
"fmt"
"strconv"
"math"

apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/types"
Expand Down Expand Up @@ -42,22 +43,24 @@
// First pass: build all rules and add them to priority queue
for i, rule := range t.route.Spec().Rules() {
// Default priority is index + 1
priority := int64(i + 1)

Check failure on line 46 in pkg/gateway/model_build_rule.go

View workflow job for this annotation

GitHub Actions / golangci-lint

ineffectual assignment to priority (ineffassign)

// Check for priority annotation in format: application-networking.k8s.aws/rule-{index}-priority
if priorityStr, ok := t.route.K8sObject().GetAnnotations()[fmt.Sprintf("application-networking.k8s.aws/rule-%d-priority", i)]; ok {
if p, err := strconv.ParseInt(priorityStr, 10, 64); err == nil {
priority = p
t.log.Debugf(ctx, "Using priority %d from annotation for rule %d", priority, i)
if p < math.MinInt32 || p > math.MaxInt32 {
t.log.Warnf(ctx, "Priority value out of int32 range in annotation for rule %d: %s", i, priorityStr)
} else {
priority = p
t.log.Debugf(ctx, "Using priority %d from annotation for rule %d", priority, i)
priorityQueue.Push(&utils.Item{
Value: rule,
Priority: int32(priority),
})
}
} else {
t.log.Warnf(ctx, "Invalid priority value in annotation for rule %d: %s", i, priorityStr)
}

priorityQueue.Push(&utils.Item{
Value: rule,
Priority: int32(priority),
})

} else {
rulesWithoutPriority = append(rulesWithoutPriority, rule)
}
Expand Down
Loading