Skip to content

Commit 5f537e1

Browse files
Brian Strauchmtodzo
andauthored
[CLI-1573] Fix provisioning time estimate for dedicated Kafka clusters (#1171)
* fix provision estimate for dedicated clusters and format * fix unit test * update err message * fix tests Co-authored-by: Miles Todzo <mtodzo@confluent.io>
1 parent c28660a commit 5f537e1

File tree

18 files changed

+249
-217
lines changed

18 files changed

+249
-217
lines changed

internal/cmd/kafka/command_cluster_create.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ func (c *clusterCommand) create(cmd *cobra.Command, args []string, prompt form.P
193193
}
194194

195195
if outputFormat == output.Human.String() {
196-
utils.ErrPrintln(cmd, errors.KafkaClusterTime)
196+
utils.ErrPrintln(cmd, getKafkaProvisionEstimate(sku))
197197
}
198198

199199
c.analyticsClient.SetSpecialProperty(analytics.ResourceIDPropertiesKey, cluster.Id)
@@ -332,3 +332,14 @@ func stringToSku(s string) (productv1.Sku, error) {
332332
}
333333
return sku, nil
334334
}
335+
336+
func getKafkaProvisionEstimate(sku productv1.Sku) string {
337+
fmtEstimate := "It may take up to %s for the Kafka cluster to be ready."
338+
339+
switch sku {
340+
case productv1.Sku_DEDICATED:
341+
return fmt.Sprintf(fmtEstimate, "1 hour") + " The organization admin will receive an email once the dedicated cluster is provisioned."
342+
default:
343+
return fmt.Sprintf(fmtEstimate, "5 minutes")
344+
}
345+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
package kafka
2+
3+
import (
4+
"testing"
5+
6+
productv1 "github.com/confluentinc/cc-structs/kafka/product/core/v1"
7+
"github.com/stretchr/testify/require"
8+
)
9+
10+
func TestGetKafkaProvisionEstimate_Basic(t *testing.T) {
11+
expected := "It may take up to 5 minutes for the Kafka cluster to be ready."
12+
require.Equal(t, expected, getKafkaProvisionEstimate(productv1.Sku_BASIC))
13+
}
14+
15+
func TestGetKafkaProvisionEstimate_Dedicated(t *testing.T) {
16+
expected := "It may take up to 1 hour for the Kafka cluster to be ready. The organization admin will receive an email once the dedicated cluster is provisioned."
17+
require.Equal(t, expected, getKafkaProvisionEstimate(productv1.Sku_DEDICATED))
18+
}

internal/cmd/kafka/command_cluster_describe.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,16 @@ var (
1818
basicDescribeFields = []string{"Id", "Name", "Type", "NetworkIngress", "NetworkEgress", "Storage", "ServiceProvider", "Availability", "Region", "Status", "Endpoint", "RestEndpoint"}
1919
basicDescribeFieldsWithApiEndpoint = []string{"Id", "Name", "Type", "NetworkIngress", "NetworkEgress", "Storage", "ServiceProvider", "Availability", "Region", "Status", "Endpoint", "ApiEndpoint", "RestEndpoint"}
2020
describeHumanRenames = map[string]string{
21-
"NetworkIngress": "Ingress",
22-
"NetworkEgress": "Egress",
23-
"ServiceProvider": "Provider",
24-
"EncryptionKeyId": "Encryption Key ID"}
21+
"ApiEndpoint": "API Endpoint",
22+
"ClusterSize": "Cluster Size",
23+
"EncryptionKeyId": "Encryption Key ID",
24+
"Id": "ID",
25+
"NetworkEgress": "Egress",
26+
"NetworkIngress": "Ingress",
27+
"PendingClusterSize": "Pending Cluster Size",
28+
"RestEndpoint": "REST Endpoint",
29+
"ServiceProvider": "Provider",
30+
}
2531
describeStructuredRenames = map[string]string{
2632
"Id": "id",
2733
"Name": "name",

internal/cmd/kafka/command_cluster_test.go

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -237,23 +237,23 @@ Identity:
237237
id-xyz
238238
239239
240-
Please confirm you've authorized the key for this identity: id-xyz (y/n): It may take up to 5 minutes for the Kafka cluster to be ready.
241-
+--------------+---------------+
242-
| Id | lkc-xyz |
243-
| Name | gcp-byok-test |
244-
| Type | DEDICATED |
245-
| Ingress | 0 |
246-
| Egress | 0 |
247-
| Storage | 0 |
248-
| Provider | gcp |
249-
| Availability | single-zone |
250-
| Region | us-central1 |
251-
| Status | PROVISIONING |
252-
| Endpoint | |
253-
| ApiEndpoint | |
254-
| RestEndpoint | |
255-
| ClusterSize | 0 |
256-
+--------------+---------------+
240+
Please confirm you've authorized the key for this identity: id-xyz (y/n): It may take up to 1 hour for the Kafka cluster to be ready. The organization admin will receive an email once the dedicated cluster is provisioned.
241+
+---------------+---------------+
242+
| ID | lkc-xyz |
243+
| Name | gcp-byok-test |
244+
| Type | DEDICATED |
245+
| Ingress | 0 |
246+
| Egress | 0 |
247+
| Storage | 0 |
248+
| Provider | gcp |
249+
| Availability | single-zone |
250+
| Region | us-central1 |
251+
| Status | PROVISIONING |
252+
| Endpoint | |
253+
| API Endpoint | |
254+
| REST Endpoint | |
255+
| Cluster Size | 0 |
256+
+---------------+---------------+
257257
`)
258258
req.True(cmp.Equal(got, want), cmp.Diff(got, want))
259259
req.Equal("abc", idMock.CreateExternalIdentityCalls()[0].AccountID)

internal/pkg/errors/warning_message.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ const (
55
APIKeyNotRetrievableMsg = "Save the API key and secret. The secret is not retrievable later."
66
APIKeyTime = "It may take a couple of minutes for the API key to be ready."
77

8-
// kafka commands
9-
KafkaClusterTime = "It may take up to 5 minutes for the Kafka cluster to be ready."
10-
118
// secret commands
129
SaveTheMasterKeyMsg = "Save the master key. It cannot be retrieved later."
1310

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
+--------------+---------------------------+
2-
| Id | lkc-describe |
3-
| Name | kafka-cluster |
4-
| Type | BASIC |
5-
| Ingress | 100 |
6-
| Egress | 100 |
7-
| Storage | 500 |
8-
| Provider | aws |
9-
| Availability | single-zone |
10-
| Region | us-west-2 |
11-
| Status | PROVISIONING |
12-
| Endpoint | SASL_SSL://kafka-endpoint |
13-
| RestEndpoint | http://kafka-rest-url |
14-
+--------------+---------------------------+
1+
+---------------+---------------------------+
2+
| ID | lkc-describe |
3+
| Name | kafka-cluster |
4+
| Type | BASIC |
5+
| Ingress | 100 |
6+
| Egress | 100 |
7+
| Storage | 500 |
8+
| Provider | aws |
9+
| Availability | single-zone |
10+
| Region | us-west-2 |
11+
| Status | PROVISIONING |
12+
| Endpoint | SASL_SSL://kafka-endpoint |
13+
| REST Endpoint | http://kafka-rest-url |
14+
+---------------+---------------------------+
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
It may take up to 5 minutes for the Kafka cluster to be ready.
2-
+--------------+---------------------------+
3-
| Id | lkc-def963 |
4-
| Name | my-new-cluster |
5-
| Type | BASIC |
6-
| Ingress | 100 |
7-
| Egress | 100 |
8-
| Storage | 5000 |
9-
| Provider | aws |
10-
| Availability | single-zone |
11-
| Region | us-east-1 |
12-
| Status | PROVISIONING |
13-
| Endpoint | SASL_SSL://kafka-endpoint |
14-
| ApiEndpoint | http://127.0.0.1:12345 |
15-
| RestEndpoint | |
16-
+--------------+---------------------------+
2+
+---------------+---------------------------+
3+
| ID | lkc-def963 |
4+
| Name | my-new-cluster |
5+
| Type | BASIC |
6+
| Ingress | 100 |
7+
| Egress | 100 |
8+
| Storage | 5000 |
9+
| Provider | aws |
10+
| Availability | single-zone |
11+
| Region | us-east-1 |
12+
| Status | PROVISIONING |
13+
| Endpoint | SASL_SSL://kafka-endpoint |
14+
| API Endpoint | http://127.0.0.1:12345 |
15+
| REST Endpoint | |
16+
+---------------+---------------------------+
Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
It may take up to 5 minutes for the Kafka cluster to be ready.
2-
+--------------+---------------------------+
3-
| Id | lkc-def963 |
4-
| Name | my-dedicated-cluster |
5-
| Type | DEDICATED |
6-
| Ingress | 50 |
7-
| Egress | 150 |
8-
| Storage | 30000 |
9-
| Provider | aws |
10-
| Availability | single-zone |
11-
| Region | us-east-1 |
12-
| Status | PROVISIONING |
13-
| Endpoint | SASL_SSL://kafka-endpoint |
14-
| ApiEndpoint | http://127.0.0.1:12345 |
15-
| RestEndpoint | |
16-
| ClusterSize | 1 |
17-
+--------------+---------------------------+
1+
It may take up to 1 hour for the Kafka cluster to be ready. The organization admin will receive an email once the dedicated cluster is provisioned.
2+
+---------------+---------------------------+
3+
| ID | lkc-def963 |
4+
| Name | my-dedicated-cluster |
5+
| Type | DEDICATED |
6+
| Ingress | 50 |
7+
| Egress | 150 |
8+
| Storage | 30000 |
9+
| Provider | aws |
10+
| Availability | single-zone |
11+
| Region | us-east-1 |
12+
| Status | PROVISIONING |
13+
| Endpoint | SASL_SSL://kafka-endpoint |
14+
| API Endpoint | http://127.0.0.1:12345 |
15+
| REST Endpoint | |
16+
| Cluster Size | 1 |
17+
+---------------+---------------------------+
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
+--------------+---------------------------+
2-
| Id | lkc-update |
3-
| Name | lkc-update-name |
4-
| Type | BASIC |
5-
| Ingress | 100 |
6-
| Egress | 100 |
7-
| Storage | 500 |
8-
| Provider | aws |
9-
| Availability | single-zone |
10-
| Region | us-west-2 |
11-
| Status | UP |
12-
| Endpoint | SASL_SSL://kafka-endpoint |
13-
| ApiEndpoint | http://kafka-api-url |
14-
| RestEndpoint | http://kafka-rest-url |
15-
+--------------+---------------------------+
1+
+---------------+---------------------------+
2+
| ID | lkc-update |
3+
| Name | lkc-update-name |
4+
| Type | BASIC |
5+
| Ingress | 100 |
6+
| Egress | 100 |
7+
| Storage | 500 |
8+
| Provider | aws |
9+
| Availability | single-zone |
10+
| Region | us-west-2 |
11+
| Status | UP |
12+
| Endpoint | SASL_SSL://kafka-endpoint |
13+
| API Endpoint | http://kafka-api-url |
14+
| REST Endpoint | http://kafka-rest-url |
15+
+---------------+---------------------------+
Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
+--------------------+-----------------------------+
2-
| Id | lkc-update-dedicated-expand |
3-
| Name | lkc-update-dedicated-name |
4-
| Type | DEDICATED |
5-
| Ingress | 100 |
6-
| Egress | 300 |
7-
| Storage | 60000 |
8-
| Provider | aws |
9-
| Availability | single-zone |
10-
| Region | us-west-2 |
11-
| Status | EXPANDING |
12-
| Endpoint | SASL_SSL://kafka-endpoint |
13-
| ApiEndpoint | http://kafka-api-url |
14-
| RestEndpoint | |
15-
| ClusterSize | 1 |
16-
| PendingClusterSize | 2 |
17-
+--------------------+-----------------------------+
1+
+----------------------+-----------------------------+
2+
| ID | lkc-update-dedicated-expand |
3+
| Name | lkc-update-dedicated-name |
4+
| Type | DEDICATED |
5+
| Ingress | 100 |
6+
| Egress | 300 |
7+
| Storage | 60000 |
8+
| Provider | aws |
9+
| Availability | single-zone |
10+
| Region | us-west-2 |
11+
| Status | EXPANDING |
12+
| Endpoint | SASL_SSL://kafka-endpoint |
13+
| API Endpoint | http://kafka-api-url |
14+
| REST Endpoint | |
15+
| Cluster Size | 1 |
16+
| Pending Cluster Size | 2 |
17+
+----------------------+-----------------------------+

0 commit comments

Comments
 (0)