Skip to content
Merged
Show file tree
Hide file tree
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
9 changes: 7 additions & 2 deletions internal/kafka/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,13 @@ func getCmkClusterIngressAndEgressMbps(currentMaxEcku int32, limits *kafkausagel
ingress, egress := limits.GetIngress(), limits.GetEgress()

// Scale limits by cluster's max eCKU when limits are set per eCKU
if limits.GetMaxEcku() != nil && currentMaxEcku > 0 {
return ingress * currentMaxEcku, egress * currentMaxEcku
if limits.GetMaxEcku() != nil {
if currentMaxEcku > 0 {
return ingress * currentMaxEcku, egress * currentMaxEcku
} else if limits.GetMaxEcku().Value > 0 {
// Use default max ecku when currentMaxEcku is not set
return ingress * limits.GetMaxEcku().Value, egress * limits.GetMaxEcku().Value
}
}

return ingress, egress
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
+----------------------+----------------------------+
| Current | true |
| ID | lkc-with-default-v2-limits |
| Name | kafka-cluster |
| Type | BASIC |
| Ingress Limit (MB/s) | 250 |
| Egress Limit (MB/s) | 750 |
| Storage | 5000 GB |
| Cloud | aws |
| Region | us-west-2 |
| Availability | single-zone |
| Status | UP |
| Endpoint | SASL_SSL://kafka-endpoint |
| REST Endpoint | http://127.0.0.1:1025 |
| Topic Count | 2 |
+----------------------+----------------------------+
1 change: 1 addition & 0 deletions test/kafka_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ func (s *CLITestSuite) TestKafka() {

{args: "kafka cluster describe lkc-describe-with-ecku-limits", fixture: "kafka/cluster/describe-basic-with-ecku-limits.golden"},
{args: "kafka cluster describe lkc-with-usage-limits-error", fixture: "kafka/cluster/describe-with-usage-limits-error.golden"},
{args: "kafka cluster describe lkc-with-default-v2-limits", fixture: "kafka/cluster/describe-basic-with-default-v2-limits.golden"},

{args: "kafka acl list --cluster lkc-acls", fixture: "kafka/acl/list-cloud.golden"},
{args: "kafka acl list --cluster lkc-acls --all", fixture: "kafka/acl/list-cloud-all.golden"},
Expand Down
2 changes: 1 addition & 1 deletion test/test-server/kafka_usage_limits_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func handleUsageLimits(t *testing.T) http.HandlerFunc {
// Check for lkc_id query parameter to determine which limits to return
lkcId := r.URL.Query().Get("lkc_id")
switch lkcId {
case "lkc-with-ecku-limits", "lkc-describe-with-ecku-limits":
case "lkc-with-ecku-limits", "lkc-describe-with-ecku-limits", "lkc-with-default-v2-limits":
handleGetUsageLimitsEckuLimits(t)(w, r)
case "lkc-with-usage-limits-error":
handleGetUsageLimitsWithError(t)(w, r)
Expand Down