Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion pkg/i2gw/providers/ingressnginx/canary.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func calculateBackendRefWeight(paths []ingressPath) ([]gatewayv1.HTTPBackendRef,
errors = append(errors, err)
continue
}
if path.extra != nil && path.extra.canary != nil && path.extra.canary.weight != 0 {
if path.extra != nil && path.extra.canary != nil && path.extra.canary.enable == true {
weight := int32(path.extra.canary.weight)
backendRef.Weight = &weight
totalWeightSet += weight
Expand Down
3 changes: 3 additions & 0 deletions pkg/i2gw/providers/ingressnginx/canary_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func Test_ingressRuleGroup_calculateBackendRefWeight(t *testing.T) {
},
},
extra: &extra{canary: &canaryAnnotations{
enable: true,
weight: 101,
}},
},
Expand Down Expand Up @@ -82,6 +83,7 @@ func Test_ingressRuleGroup_calculateBackendRefWeight(t *testing.T) {
},
},
extra: &extra{canary: &canaryAnnotations{
enable: true,
weight: 30,
}},
},
Expand Down Expand Up @@ -116,6 +118,7 @@ func Test_ingressRuleGroup_calculateBackendRefWeight(t *testing.T) {
},
},
extra: &extra{canary: &canaryAnnotations{
enable: true,
weight: 50,
weightTotal: 200,
}},
Expand Down