Skip to content

Conversation

pazhang-25
Copy link
Contributor

@pazhang-25 pazhang-25 commented Sep 16, 2025

Functional test / demo:


Confirm that topic is an available command under topicctl delete [command]

~/dev/src/github.com/segmentio/topicctl SEGDP-2963/addTopicDelete ❯ go run cmd/topicctl/main.go delete                                                                   12:43:16 PM
Deletes instances of a particular type.

Usage:
  topicctl delete [command]

Available Commands:
  acls        Delete ACLs. Requires providing flags to target ACLs for deletion.
  topic       Delete a topic

Flags:
  -b, --broker-addr string                Broker address
      --cluster-config string             Cluster config
      --conn-timeout duration             Kafka connection timeout (default 10s)
      --dry-run                           Do a dry-run
      --expand-env                        Expand environment in cluster config
  -h, --help                              help for delete
      --sasl-mechanism string             SASL mechanism if using SASL (choices: AWS-MSK-IAM, PLAIN, SCRAM-SHA-256, or SCRAM-SHA-512)
      --sasl-password string              SASL password if using SASL; will override value set in cluster config
      --sasl-secrets-manager-arn string   Secrets Manager ARN to use for credentials if using SASL; will override value set in cluster config
      --sasl-username string              SASL username if using SASL; will override value set in cluster config
      --tls-ca-cert string                Path to client CA cert PEM file if using TLS
      --tls-cert string                   Path to client cert PEM file if using TLS
      --tls-enabled                       Use TLS for communication with brokers
      --tls-key string                    Path to client private key PEM file if using TLS
      --tls-server-name string            Server name to use for TLS cert verification
      --tls-skip-verify                   Skip hostname verification when using TLS
  -z, --zk-addr string                    ZooKeeper address
      --zk-prefix string                  Prefix for cluster-related nodes in zk

Global Flags:
      --debug        enable debug logging
      --no-spinner   disable all UI spinners

Use "topicctl delete [command] --help" for more information about a command.

List all topics running locally:

~/dev/src/github.com/segmentio/topicctl SEGDP-2963/addTopicDelete ❯ go run cmd/topicctl/main.go get topics --cluster-config examples/local-cluster/cluster.yaml          12:46:04 PM
[2025-09-17 12:51:17]  INFO Topics:
-----------------------+------------+-------------+-----------+------------
          NAME         | PARTITIONS | REPLICATION | RETENTION |   RACKS
                       |            |             |   MINS    | (MIN,MAX)
-----------------------+------------+-------------+-----------+------------
  topic-default        | 3          | 2           | 100       | (1,1)
  topic-in-rack3       | 9          | 2           | 100       | (1,1)
  topic-static         | 10         | 2           | 290       | (1,2)
  topic-static-in-rack | 9          | 2           | 100       | (1,1)
-----------------------+------------+-------------+-----------+------------

Delete topic-default

~/dev/src/github.com/segmentio/topicctl SEGDP-2963/addTopicDelete ❯ go run cmd/topicctl/main.go delete topic topic-default --cluster-config examples/local-cluster/cluster.yaml
[2025-09-17 12:52:26]  INFO Checking if topic topic-default exists...
[2025-09-17 12:52:26]  INFO Topic topic-default exists in the cluster!
Delete topic "topic-default" (yes/no) yes
[2025-09-17 12:52:29]  INFO Topic topic-default successfully deleted

Confirm that topic-default has been deleted

~/dev/src/github.com/segmentio/topicctl SEGDP-2963/addTopicDelete ❯ go run cmd/topicctl/main.go get topics --cluster-config examples/local-cluster/cluster.yaml          12:52:29 PM
[2025-09-17 12:53:11]  INFO Topics:
-----------------------+------------+-------------+-----------+------------
          NAME         | PARTITIONS | REPLICATION | RETENTION |   RACKS
                       |            |             |   MINS    | (MIN,MAX)
-----------------------+------------+-------------+-----------+------------
  topic-in-rack3       | 9          | 2           | 100       | (1,1)
  topic-static         | 10         | 2           | 290       | (1,2)
  topic-static-in-rack | 9          | 2           | 100       | (1,1)
-----------------------+------------+-------------+-----------+------------

@pazhang-25 pazhang-25 marked this pull request as ready for review September 17, 2025 19:20
@pazhang-25 pazhang-25 requested a review from a team as a code owner September 17, 2025 19:20
@pazhang-25 pazhang-25 mentioned this pull request Sep 17, 2025
petedannemann
petedannemann previously approved these changes Sep 17, 2025
@pazhang-25 pazhang-25 merged commit 695a1d6 into master Sep 18, 2025
8 checks passed
@pazhang-25 pazhang-25 deleted the SEGDP-2963/addTopicDelete branch September 18, 2025 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants