Skip to content

Commit a0612ac

Browse files
committed
address comment
Signed-off-by: kkk777-7 <kota.kimura0725@gmail.com>
1 parent 522f861 commit a0612ac

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

internal/gatewayapi/backendtrafficpolicy.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1688,6 +1688,9 @@ func buildBandwidthLimit(bandwidth *egv1a1.BandwidthLimitSpec) (*ir.BandwidthLim
16881688
if !ok {
16891689
return nil, fmt.Errorf("request limit value must be convertible to an int64")
16901690
}
1691+
if bytes < 0 {
1692+
return nil, fmt.Errorf("request limit value must be positive")
1693+
}
16911694
kibps, err := bandwidthToKibps(uint64(bytes), bandwidth.Request.Limit.Unit)
16921695
if err != nil {
16931696
return nil, fmt.Errorf("request: %w", err)
@@ -1701,6 +1704,9 @@ func buildBandwidthLimit(bandwidth *egv1a1.BandwidthLimitSpec) (*ir.BandwidthLim
17011704
if !ok {
17021705
return nil, fmt.Errorf("response limit value must be convertible to an int64")
17031706
}
1707+
if bytes < 0 {
1708+
return nil, fmt.Errorf("response limit value must be positive")
1709+
}
17041710
kibps, err := bandwidthToKibps(uint64(bytes), bandwidth.Response.Limit.Unit)
17051711
if err != nil {
17061712
return nil, fmt.Errorf("response: %w", err)

0 commit comments

Comments
 (0)