Skip to content

CF-1870 : Manage SQL Catalog databases through CLI#3287

Open
Paras Negi (paras-negi-flink) wants to merge 15 commits intomainfrom
CF-1870
Open

CF-1870 : Manage SQL Catalog databases through CLI#3287
Paras Negi (paras-negi-flink) wants to merge 15 commits intomainfrom
CF-1870

Conversation

@paras-negi-flink
Copy link
Copy Markdown

@paras-negi-flink Paras Negi (paras-negi-flink) commented Mar 22, 2026

Release Notes

Breaking Changes

  • None.

New Features

  • Added confluent flink catalog database create|list|describe|update|delete commands to manage Kafka databases (Kafka cluster connections) inside a Flink SQL catalog on Confluent Platform.

Bug Fixes

  • None.

Checklist

  • I have successfully built and used a custom CLI binary, without linter issues from this PR.
  • I have clearly specified in the What section below whether this PR applies to Confluent Cloud, Confluent Platform, or both.
  • I have verified this PR in Confluent Cloud pre-prod or production environment, if applicable.
  • I have verified this PR in Confluent Platform on-premises environment, if applicable.
  • I have attached manual CLI verification results or screenshots in the Test & Review section below.
  • I have added appropriate CLI integration or unit tests for any new or updated commands and functionality.
  • I confirm that this PR introduces no breaking changes or backward compatibility issues.
  • I have indicated the potential customer impact if something goes wrong in the Blast Radius section below.
  • I have put checkmarks below confirming that the feature associated with this PR is enabled in:
    • Confluent Cloud prod
    • Confluent Cloud stag
    • Confluent Platform
    • Check this box if the feature is enabled for certain organizations only

What

This PR implements CF-1870 — Manage SQL Catalog databases for the Confluent CLI, targeting Confluent Platform / CP Flink (CMF on-prem):

  • Adds a new command group under confluent flink catalog:
    • confluent flink catalog database create <resourceFilePath> --catalog <catName>
    • confluent flink catalog database list --catalog <catName>
    • confluent flink catalog database describe <dbName> --catalog <catName>
    • confluent flink catalog database update <resourceFilePath> --catalog <catName>
    • confluent flink catalog database delete <dbName> --catalog <catName>
  • Wires these commands to the existing CMF KafkaDatabase REST APIs:
    • POST/GET/PUT/DELETE /cmf/api/v1/catalogs/kafka/{catName}/databases[/ {dbName}].
  • Introduces a CmfRestClient wrapper for KafkaDatabase operations and corresponding local types/output formatting, following existing patterns used for catalogs and compute pools.

Blast Radius

  • Scope is limited to new Flink catalog database commands; existing CLI behavior (including other confluent flink and confluent kafka commands) is unchanged.
  • If something goes wrong:
    • Impact is confined to users managing Kafka databases via the new commands:
      • Database creation/update/delete may fail or surface CMF errors.
      • Listing/describe may not show correct state for databases.
    • No changes are made to Flyway migrations or catalog persistence; CMF remains the source of truth.
  • There are no breaking changes to existing commands, flags, or APIs. Removing or reverting this feature is straightforward (command group + client wrapper).

References

Test & Review

Environment

  • Repo: confluentinc/cli
  • Branch: CF-1870
  • CMF: 2.3-SNAPSHOT (image: confluentinc/cp-cmf:c505ee8b) - Kubernetes: local cluster with CMF deployed (cmf-service exposed via kubectl port-forward svc/cmf-service 8080:80 -n e2e)

Manual CLI validation

Attached in the comment below

@confluent-cla-assistant
Copy link
Copy Markdown

❌ Error getting contributor login(s).
Please ensure the email address associated with this commit is added to your Github account.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Confluent Platform (CMF/on-prem) CLI support for managing Flink SQL catalog databases, along with integration test coverage and fixtures.

Changes:

  • Introduces confluent flink catalog database command group with create and list subcommands.
  • Extends CMF REST client with CreateDatabase and ListDatabases.
  • Updates on-prem test server routes/handlers and adds integration tests + golden/input fixtures for the new commands.

Reviewed changes

Copilot reviewed 22 out of 22 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
internal/flink/command_catalog.go Registers the new database subcommand under flink catalog.
internal/flink/command_catalog_database.go Adds the database command group and SDK→local conversion for serialized output.
internal/flink/command_catalog_database_create.go Implements flink catalog database create from a JSON/YAML resource file.
internal/flink/command_catalog_database_list.go Implements flink catalog database list with human + serialized output.
internal/flink/local_types.go Adds local (serialized) types for KafkaDatabase output.
pkg/flink/cmf_rest_client.go Adds CMF client methods to create/list Kafka databases (paginated).
test/test-server/flink_onprem_router.go Adds the CMF test-server route for catalog databases.
test/test-server/flink_onprem_handler.go Adds test-server handler + helpers for listing/creating databases.
test/flink_onprem_test.go Adds integration tests for on-prem database create/list.
test/fixtures/input/flink/catalog/database/create-successful.json Input fixture for successful database creation.
test/fixtures/input/flink/catalog/database/create-invalid-failure.json Input fixture for validation failure on create.
test/fixtures/output/flink/catalog/help-onprem.golden Updates catalog help output to include database.
test/fixtures/output/flink/catalog/database/help-onprem.golden Adds help fixture for flink catalog database.
test/fixtures/output/flink/catalog/database/create-help-onprem.golden Adds help fixture for flink catalog database create.
test/fixtures/output/flink/catalog/database/list-help-onprem.golden Adds help fixture for flink catalog database list.
test/fixtures/output/flink/catalog/database/create-success.golden Human output golden for create success.
test/fixtures/output/flink/catalog/database/create-success-json.golden JSON output golden for create success.
test/fixtures/output/flink/catalog/database/create-success-yaml.golden YAML output golden for create success.
test/fixtures/output/flink/catalog/database/create-invalid-failure.golden Error output golden for create failure.
test/fixtures/output/flink/catalog/database/list-success.golden Human output golden for list success.
test/fixtures/output/flink/catalog/database/list-success-json.golden JSON output golden for list success.
test/fixtures/output/flink/catalog/database/list-success-yaml.golden YAML output golden for list success.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 42 out of 42 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 42 out of 42 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@paras-negi-flink
Copy link
Copy Markdown
Author

Here are the E2E validations done for the new Flink catalog database commands in this PR, with concrete commands and outputs.

  1. Create database (human output)
parasnegi@C6V9RN9V2Y confluent_darwin_arm64_v8.0 % ./confluent --url http://localhost:8080 flink catalog database create my-database.json --catalog kcat 
+---------------+--------------------------+
| Creation Time | 2026-04-03T02:51:11.634Z |
| Name          | my-database              |
| Catalog       | kcat                     |
+---------------+--------------------------+
  1. Create database (JSON output)
parasnegi@C6V9RN9V2Y confluent_darwin_arm64_v8.0 % ./confluent --url http://localhost:8080 flink catalog database create my-database.json --catalog kcat --output json
{
  "apiVersion": "cmf.confluent.io/v1",
  "kind": "KafkaDatabase",
  "metadata": {
    "name": "my-database",
    "creationTimestamp": "2026-04-03T02:53:18.202Z",
    "updateTimestamp": "2026-04-03T02:53:18.202Z",
    "uid": "e01b7728-e578-4630-80fe-7c01e8b4e478",
    "labels": {
      "env": "dev",
      "team": "flink"
    },
    "annotations": {}
  },
  "spec": {
    "kafkaCluster": {
      "connectionConfig": {
        "bootstrap.servers": "localhost:9093"
      }
    }
  }
}
  1. List databases
parasnegi@C6V9RN9V2Y confluent_darwin_arm64_v8.0 % ./confluent --url http://localhost:8080 flink catalog database list --catalog kcat          
       Creation Time       |     Name      | Catalog  
---------------------------+---------------+----------
  2026-03-25T14:08:11.397Z | free-kafka    | kcat     
  2026-03-26T06:16:54.494Z | test-database | kcat     
  2026-04-03T02:53:18.202Z | my-database   | kcat
  1. Describe database
parasnegi@C6V9RN9V2Y confluent_darwin_arm64_v8.0 % ./confluent --url http://localhost:8080 flink catalog database describe my-database --catalog kcat
+---------------+--------------------------+
| Creation Time | 2026-04-03T02:53:18.202Z |
| Name          | my-database              |
| Catalog       | kcat                     |
+---------------+--------------------------+
  1. Describe database (YAML)
parasnegi@C6V9RN9V2Y confluent_darwin_arm64_v8.0 % ./confluent --url http://localhost:8080 flink catalog database describe my-database --catalog kcat --output yaml 
apiVersion: cmf.confluent.io/v1
kind: KafkaDatabase
metadata:
    name: my-database
    creationTimestamp: "2026-04-03T02:53:18.202Z"
    updateTimestamp: "2026-04-03T02:53:18.202Z"
    uid: e01b7728-e578-4630-80fe-7c01e8b4e478
    labels:
        env: dev
        team: flink
    annotations: {}
spec:
    kafkaCluster:
        connectionConfig:
            bootstrap.servers: localhost:9093
  1. Delete Database
parasnegi@C6V9RN9V2Y confluent_darwin_arm64_v8.0 % ./confluent --url http://localhost:8080 flink catalog database delete my-database --catalog kcat                  
Are you sure you want to delete Flink database "my-database"? (y/n): y
Deleted Flink database "my-database".
parasnegi@C6V9RN9V2Y confluent_darwin_arm64_v8.0 % ./confluent --url http://localhost:8080 flink catalog database list --catalog kcat                
       Creation Time       |     Name      | Catalog  
---------------------------+---------------+----------
  2026-03-25T14:08:11.397Z | free-kafka    | kcat     
  2026-03-26T06:16:54.494Z | test-database | kcat   

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 46 out of 46 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@sonarqube-confluent
Copy link
Copy Markdown

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.

2 participants