CF-3930 : Return structured savepoint schema from create -o json/yaml to match describe/list#3396
Conversation
… to match describe/list
|
🎉 All Contributor License Agreements have been signed. Ready to merge. |
There was a problem hiding this comment.
Pull request overview
Aligns CMF (on-prem) Flink savepoint create commands’ serialized (-o json|yaml) output with the structured resource schema used by related commands, improving schema consistency for automation.
Changes:
- Updated
flink savepoint createandflink detached-savepoint createto print human/table output only for--output human, and otherwise serialize the structuredLocalSavepointshape. - Added integration test cases for
savepoint createanddetached-savepoint createwith--output json|yaml. - Added new golden fixtures for the new serialized outputs.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
internal/flink/command_savepoint_create.go |
Branches output by format; uses structured LocalSavepoint for serialized output. |
internal/flink/command_detached_savepoint_create.go |
Branches output by format; uses structured LocalSavepoint for serialized output. |
test/flink_onprem_test.go |
Adds --output json/--output yaml integration cases for both create commands. |
test/fixtures/output/flink/savepoint/create-savepoint-json.golden |
New expected JSON output for savepoint create. |
test/fixtures/output/flink/savepoint/create-savepoint-yaml.golden |
New expected YAML output for savepoint create. |
test/fixtures/output/flink/detached-savepoint/create-savepoint-json.golden |
New expected JSON output for detached-savepoint create. |
test/fixtures/output/flink/detached-savepoint/create-savepoint-yaml.golden |
New expected YAML output for detached-savepoint create. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| localSavepoint := convertSdkSavepointToLocalSavepoint(savepointCreated) | ||
| return output.SerializedOutput(cmd, localSavepoint) |
There was a problem hiding this comment.
Can you please check if the nil check can be handled elegantly using the SDK in some way.
| func (s *CLITestSuite) TestFlinkSavepointCreate() { | ||
| tests := []CLITest{ | ||
| {args: "flink savepoint create savepoint1 --environment default --application application1", fixture: "flink/savepoint/create-savepoint.golden"}, | ||
| {args: "flink savepoint create savepoint1 --environment default --application application1 --output json", fixture: "flink/savepoint/create-savepoint-json.golden"}, | ||
| {args: "flink savepoint create savepoint1 --environment default --application application1 --output yaml", fixture: "flink/savepoint/create-savepoint-yaml.golden"}, | ||
| {args: "flink savepoint create --environment default --application application2", fixture: "flink/savepoint/create-savepoint-no-name.golden"}, | ||
| {args: "flink savepoint create savepointS --environment default --statement test-stmt", fixture: "flink/savepoint/create-savepoint-statement.golden"}, | ||
| {args: "flink savepoint create savepointS --environment default --statement test-stmt --path abc/def --format NATIVE --backoff-limit 10", fixture: "flink/savepoint/create-savepoint-statement-values.golden"}, |
There was a problem hiding this comment.
Can you check if making additional --output yaml makes sense here?
Manual CLI validationLocal CMF ( Before — released
|
…ized create tests
|
| Kind: sdkSavepoint.Kind, | ||
| Metadata: LocalSavepointMetadata{ | ||
| Name: *sdkSavepoint.Metadata.Name, | ||
| Name: sdkSavepoint.Metadata.GetName(), |
There was a problem hiding this comment.
Why not:
CreationTimestamp: sdkSavepoint.Metadata.GetCreationTimestamp() for the line below and similar fields?
The idea is try to be consistent across the table everywhere.
| Kind: sdkSavepoint.Kind, | ||
| Metadata: LocalSavepointMetadata{ | ||
| Name: *sdkSavepoint.Metadata.Name, | ||
| Name: sdkSavepoint.Metadata.GetName(), |
There was a problem hiding this comment.
Please check the above comment and see if we can apply the same idea here.
| localSavepoint := convertSdkSavepointToLocalSavepoint(savepointCreated) | ||
| return output.SerializedOutput(cmd, localSavepoint) |
There was a problem hiding this comment.
Can you please check if the nil check can be handled elegantly using the SDK in some way.
| {args: "flink savepoint create --environment default --application application2", fixture: "flink/savepoint/create-savepoint-no-name.golden"}, | ||
| {args: "flink savepoint create --environment default --application application2 --output json", fixture: "flink/savepoint/create-savepoint-no-name-json.golden"}, | ||
| {args: "flink savepoint create savepointS --environment default --statement test-stmt", fixture: "flink/savepoint/create-savepoint-statement.golden"}, | ||
| {args: "flink savepoint create savepointS --environment default --statement test-stmt --output json", fixture: "flink/savepoint/create-savepoint-statement-json.golden"}, |
There was a problem hiding this comment.
Is the optional savepoint name savepointS a typo?
| func (s *CLITestSuite) TestFlinkSavepointCreate() { | ||
| tests := []CLITest{ | ||
| {args: "flink savepoint create savepoint1 --environment default --application application1", fixture: "flink/savepoint/create-savepoint.golden"}, | ||
| {args: "flink savepoint create savepoint1 --environment default --application application1 --output json", fixture: "flink/savepoint/create-savepoint-json.golden"}, | ||
| {args: "flink savepoint create savepoint1 --environment default --application application1 --output yaml", fixture: "flink/savepoint/create-savepoint-yaml.golden"}, | ||
| {args: "flink savepoint create --environment default --application application2", fixture: "flink/savepoint/create-savepoint-no-name.golden"}, | ||
| {args: "flink savepoint create savepointS --environment default --statement test-stmt", fixture: "flink/savepoint/create-savepoint-statement.golden"}, | ||
| {args: "flink savepoint create savepointS --environment default --statement test-stmt --path abc/def --format NATIVE --backoff-limit 10", fixture: "flink/savepoint/create-savepoint-statement-values.golden"}, |
There was a problem hiding this comment.
Can you check if making additional --output yaml makes sense here?
|
Do we want to update the detach operation as well? |




Release Notes
Breaking Changes
New Features
Bug Fixes
confluent flink savepoint createanddetached-savepoint createnow return the same structured JSON/YAML schema (apiVersion/kind/metadata/spec/status) asdescribe/list, instead of a flat snake_case shape.Checklist
Whatsection below whether this PR applies to Confluent Cloud, Confluent Platform, or both.Test & Reviewsection below.Blast Radiussection below.What
Confluent Platform (CP Flink / CMF on-prem).
savepoint/detached-savepoint createalways rendered the flat snake_case struct and ignored-o, whiledescribe/listemit the structuredapiVersion/kind/metadata/spec/statusshape -- same resource, two schemas.createnow branches on output format likedescribe/list, reusing the existingconvertSdk*ToLocalSavepointconverters. Human/table output is unchanged.Blast Radius
-o json/-o yamloutput of the twocreatecommands changes from flat snake_case to the structured shape; scripts readingbackoff_limit/creation_timestamp/formatmust switch tospec.backoffLimit/metadata.creationTimestamp/spec.formatType.References
Test & Review
Environment: local CMF
cmf-app 2.4-SNAPSHOT(HTTP,--cmf.k8s.enabled=false); CLI built from this branch vs releasedconfluent v4.54.0.Manual CLI validation: attached in the comment below.