KSQL-14849: add 'confluent ksql cluster update --csu N' command#3368
Draft
Vedarth Sharma (VedarthConfluent) wants to merge 1 commit into
Draft
KSQL-14849: add 'confluent ksql cluster update --csu N' command#3368Vedarth Sharma (VedarthConfluent) wants to merge 1 commit into
Vedarth Sharma (VedarthConfluent) wants to merge 1 commit into
Conversation
Adds the `confluent ksql cluster update <id> --csu <N>` command for
self-serve CSU alteration of ksqlDB clusters. The command targets the
new public-API PATCH /ksqldbcm/v2/clusters/{id} endpoint being added by
cc-control-plane-ksql PR #313 (KSQL-14845) and gated server-side by the
ksql.self_serve_csu_alteration.enable LD flag.
Behavior:
- Validates --csu client-side against {4, 8, 12, 16, 20, 24, 28}. The
server's validCSUSizes map remains authoritative; the client check
exists to fail fast with a clearer error.
- CSU > 28 returns a customer-safe support-ticket message rather than
the generic "not a valid CSU size" error.
- Pre-checks the current CSU via DescribeKsqlCluster: a no-op resize
(same CSU) is rejected client-side with "already at N CSUs; no
change requested" instead of relying on the server's 400 no-op. A
shrink is also rejected client-side, mirroring the server contract.
- Prints a clear "rolling restart will be performed asynchronously,
cluster keeps serving queries" notice before the PATCH.
Files:
- internal/ksql/command_cluster_update.go: cobra command + validation
- internal/ksql/command_cluster_update_test.go: validation unit tests
- internal/ksql/command_cluster.go: wires new subcommand under cluster
- pkg/ccloudv2/ksql.go: UpdateKsqlCluster shim
SDK dependency (the actual wire call is gated):
The ccloud-sdk-go-v2/ksql/v2 SDK at v0.2.0 does not yet expose
ClustersKsqldbcmV2Api.UpdateKsqldbcmV2Cluster — that method will be
generated once cc-api PR #2507 (KSQL-14844) merges and the SDK is
regenerated. Until then, UpdateKsqlCluster returns a clear,
customer-safe error explaining the feature is pending. The unblock
procedure (one-line SDK call, doc comment in the file) is documented
inline. All other command logic (flag parsing, validation, pre-check,
no-op detection, output formatting) is fully wired and unit-tested today.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot started reviewing on behalf of
Vedarth Sharma (VedarthConfluent)
May 26, 2026 15:06
View session
There was a problem hiding this comment.
Pull request overview
Adds a new confluent ksql cluster update <id> --csu <N> command intended to trigger self-serve ksqlDB cluster resizes via a forthcoming PATCH /ksqldbcm/v2/clusters/{id} control-plane endpoint.
Changes:
- Adds a new
ksql cluster updatecobra subcommand with--csuvalidation, pre-check via Describe, and a rolling-restart notice. - Wires the new
updatesubcommand into the existingksql clustercommand group (cloud-login branch). - Introduces a
Client.UpdateKsqlClustershim inpkg/ccloudv2(currently returns a placeholder error until the SDK supports the endpoint), plus unit tests for CSU validation helpers.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
pkg/ccloudv2/ksql.go |
Adds UpdateKsqlCluster shim for future PATCH support (currently returns placeholder error). |
internal/ksql/command_cluster.go |
Registers the new update subcommand under ksql cluster for cloud-login. |
internal/ksql/command_cluster_update.go |
Implements the ksql cluster update command, CSU validation, pre-check logic, and user messaging. |
internal/ksql/command_cluster_update_test.go |
Adds tests for CSU validation and CSU list formatting helpers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| cmd.AddCommand(c.newDeleteCommand()) | ||
| cmd.AddCommand(c.newDescribeCommand()) | ||
| cmd.AddCommand(c.newListCommand()) | ||
| cmd.AddCommand(c.newUpdateCommand()) |
Comment on lines
+101
to
+110
| output.ErrPrintf(c.Config.EnableColor, | ||
| "Resizing ksqlDB cluster %q from %d to %d CSUs. A rolling restart will be "+ | ||
| "performed asynchronously; the cluster will continue serving queries during the resize.\n", | ||
| clusterId, currentCsu, csu) | ||
|
|
||
| cluster, err := c.V2Client.UpdateKsqlCluster(clusterId, environmentId, csu) | ||
| if err != nil { | ||
| return err | ||
| } | ||
|
|
Comment on lines
+55
to
+63
| func buildUpdateLongDescription() string { | ||
| return fmt.Sprintf( | ||
| `Update an existing ksqlDB cluster. Currently only the CSU count may be | ||
| modified, and only to larger sizes (shrink is not supported). | ||
|
|
||
| Valid CSU values are %s. Larger sizes require a support ticket. | ||
| The cluster will undergo a rolling restart to apply the new size; the | ||
| command returns once the resize has been accepted by the control plane.`, | ||
| formatCsuList(validCsuSizes)) |
Comment on lines
+120
to
+123
| func validateCsuForUpdate(csu int32) error { | ||
| if csu > 28 { | ||
| return fmt.Errorf("%d CSUs: %s", csu, csuSupportTicketMessage) | ||
| } |
Comment on lines
+99
to
+101
| "ksqlDB cluster update is not yet available in this CLI build; " + | ||
| "this command is pending a ccloud-sdk-go-v2/ksql regeneration " + | ||
| "after cc-api PR #2507 (KSQL-14844) merges. Track KSQL-14849 for status.") |
|
🎉 All Contributor License Agreements have been signed. Ready to merge. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the `confluent ksql cluster update --csu ` command for self-serve CSU alteration of ksqlDB clusters. Targets the new PATCH `/ksqldbcm/v2/clusters/{id}` endpoint being added in cc-control-plane-ksql PR #313 (KSQL-14845) and gated server-side by the `ksql.self_serve_csu_alteration.enable` LD flag.
What's in the change
Validation behavior
Rolling restart behavior
On a real resize the PATCH returns 202 Accepted immediately; the control plane then performs a rolling restart of the StatefulSet asynchronously (via `expandKsqlCluster` → `syncSpecToPhysicalCluster`). The CLI surfaces this with a pre-flight notice:
```
Resizing ksqlDB cluster "lksqlc-12345" from 4 to 8 CSUs. A rolling restart will be performed
asynchronously; the cluster will continue serving queries during the resize.
```
SDK dependency — actual wire call is gated
The `ccloud-sdk-go-v2/ksql/v2` SDK at `v0.2.0` (current dep in go.mod) does not yet expose `ClustersKsqldbcmV2Api.UpdateKsqldbcmV2Cluster`. That SDK method is generated from the cc-api OpenAPI spec, which is being updated by cc-api PR #2507 (KSQL-14844). Until that lands and the SDK is regenerated:
Unblock procedure is documented as a code-block inside `Client.UpdateKsqlCluster`'s doc comment — it's a one-line replacement of the shim body with the real SDK call once the SDK is regenerated.
Test plan
Why draft
Cannot meaningfully run end-to-end against any environment until the SDK is regenerated. Marking ready for review once `ccloud-sdk-go-v2/ksql` ships a release with `UpdateKsqldbcmV2Cluster`.
🤖 Generated with Claude Code