CF-1872 : Add CRUD cli commands for Secrets#3305
CF-1872 : Add CRUD cli commands for Secrets#3305Paras Negi (paras-negi-flink) wants to merge 2 commits intomainfrom
Conversation
|
🎉 All Contributor License Agreements have been signed. Ready to merge. |
There was a problem hiding this comment.
Pull request overview
Adds Confluent Platform (on-prem) support in the Flink CLI for managing CMF “Secret” resources, including REST client support and integration-test coverage via the test server + golden fixtures.
Changes:
- Introduces
confluent flink secretwith CRUD subcommands (create/describe/list/update/delete) and output formatting. - Extends the CMF REST client and the on-prem test server router/handlers to support the
/cmf/api/v1/secretsendpoints. - Adds integration tests plus JSON/YAML input fixtures and golden outputs for the new commands.
Reviewed changes
Copilot reviewed 40 out of 40 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
internal/flink/command.go |
Registers the new flink secret command under Flink (on-prem). |
internal/flink/command_secret*.go |
Implements secret command group + CRUD subcommands, file parsing, and output shaping. |
internal/flink/local_types.go |
Adds local serializable types for secrets for JSON/YAML output. |
pkg/flink/cmf_rest_client.go |
Adds CreateSecret/DescribeSecret/ListSecrets/UpdateSecret/DeleteSecret CMF client methods. |
pkg/resource/resource.go |
Adds resource.FlinkSecret label used by deletion prompts/messages. |
test/test-server/flink_onprem_router.go |
Wires new secrets routes into the on-prem test server router. |
test/test-server/flink_onprem_handler.go |
Implements test-server handlers for secrets CRUD and list pagination behavior. |
test/flink_onprem_test.go |
Adds integration tests for flink secret commands (including YAML input variants). |
test/fixtures/input/flink/secret/* |
Adds JSON/YAML resource-file inputs for create/update success and failure cases. |
test/fixtures/output/flink/secret/* |
Adds golden outputs for command results and flink secret --help (on-prem). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| cmd.AddCommand(c.newSecretCreateCommand()) | ||
| cmd.AddCommand(c.newSecretDeleteCommand()) | ||
| cmd.AddCommand(c.newSecretDescribeCommand()) | ||
| cmd.AddCommand(c.newSecretListCommand()) | ||
| cmd.AddCommand(c.newSecretUpdateCommand()) |
There was a problem hiding this comment.
The repo’s recursive help tests generate help fixtures for every available command/subcommand. Since flink secret introduces new leaf subcommands (create/delete/describe/list/update), you’ll also need to add the corresponding *-help-onprem.golden fixtures under test/fixtures/output/flink/secret/ (e.g., create-help-onprem.golden, delete-help-onprem.golden, etc.), otherwise TestHelp will fail on on-prem runs.
|
parasnegi@C6V9RN9V2Y confluent_darwin_arm64_v8.0 % ./confluent flink secret create secret-create.json --url http://localhost:8080
+---------------+--------------------------+
| Creation Time | 2026-04-04T14:57:28.546Z |
| Name | test-secret |
**+---------------+--------------------------+**
parasnegi@C6V9RN9V2Y confluent_darwin_arm64_v8.0 % ./confluent flink secret describe test-secret --url http://localhost:8080 --output json
{
"apiVersion": "cmf.confluent.io/v1",
"kind": "Secret",
"metadata": {
"name": "test-secret",
"creationTimestamp": "2026-04-04T14:57:28.546Z",
"updateTimestamp": "2026-04-04T14:57:28.546Z",
"uid": "91f30abc-11d6-45a6-b70f-ca0562c2a3b2",
"labels": {},
"annotations": {}
},
"spec": {},
"status": {
"version": "0",
"environments": []
}
}
parasnegi@C6V9RN9V2Y confluent_darwin_arm64_v8.0 % ./confluent flink secret describe test-secret --url http://localhost:8080 --output yaml
apiVersion: cmf.confluent.io/v1
kind: Secret
metadata:
name: test-secret
creationTimestamp: "2026-04-04T14:57:28.546Z"
updateTimestamp: "2026-04-04T14:57:28.546Z"
uid: 91f30abc-11d6-45a6-b70f-ca0562c2a3b2
labels: {}
annotations: {}
spec: {}
status:
version: "0"
environments: []
parasnegi@C6V9RN9V2Y confluent_darwin_arm64_v8.0 % ./confluent flink secret list --url http://localhost:8080
Creation Time | Name
---------------------------+-------------------
2026-03-25T14:08:11.506Z | sec-kafka-secret
2026-04-04T14:57:28.546Z | test-secret
parasnegi@C6V9RN9V2Y confluent_darwin_arm64_v8.0 % ./confluent flink secret delete test-secret --url http://localhost:8080
Are you sure you want to delete Flink secret "test-secret"? (y/n): y
Deleted Flink secret "test-secret".
parasnegi@C6V9RN9V2Y confluent_darwin_arm64_v8.0 % ./confluent flink secret list --url http://localhost:8080
Creation Time | Name
---------------------------+-------------------
2026-03-25T14:08:11.506Z | sec-kafka-secret |




Release Notes
Breaking Changes
New Features
confluent flink secrets create|list|describe|update|deletecommands to manage CMF Secrets (sensitive credentials used by Flink SQL catalogs) on Confluent Platform.Bug Fixes
Checklist
Whatsection below whether this PR applies to Confluent Cloud, Confluent Platform, or both.Test & Reviewsection below.Blast Radiussection below.What
This PR implements CF-1872 — Manage CMF Secrets for the Confluent CLI, targeting Confluent Platform / CP Flink (CMF on-prem):
Adds a new command group under
confluent flink:confluent flink secret create <resourceFilePath>confluent flink secret listconfluent flink secret describe <secretName>confluent flink secret update <resourceFilePath>confluent flink secret delete <secretName>Secrets store sensitive credentials (e.g., Kafka and Schema Registry passwords) used by Flink SQL catalogs. They are referenced by catalog databases and environment secret mappings to inject credentials at statement execution time. Secret data is masked in responses for security.
Wires these commands to the existing CMF Secret REST APIs:
POST/GET/PUT/DELETE /cmf/api/v1/secrets[/{secretName}].Introduces a CmfRestClient wrapper for Secret operations and corresponding local types/output formatting, following existing patterns used for catalogs, compute pools, and catalog databases.
Blast Radius
References
Test & Review
Environment
confluentinc/cliCF-18722.3-SNAPSHOT(image:confluentinc/cp-cmf:c505ee8b) - Kubernetes: local cluster with CMF deployed (cmf-serviceexposed viakubectl port-forward svc/cmf-service 8080:80 -n e2e)Manual CLI validation
Attached in the comment below