Skip to content

Bump cmf-sdk-go v0.0.5 to v0.0.6 and fix breaking changes#3320

Open
Paras Negi (paras-negi-flink) wants to merge 4 commits intomainfrom
fix/cmf-sdk-v0.0.6-compat
Open

Bump cmf-sdk-go v0.0.5 to v0.0.6 and fix breaking changes#3320
Paras Negi (paras-negi-flink) wants to merge 4 commits intomainfrom
fix/cmf-sdk-v0.0.6-compat

Conversation

@paras-negi-flink
Copy link
Copy Markdown

@paras-negi-flink Paras Negi (paras-negi-flink) commented Apr 14, 2026

ComputePool.Status changed from *ComputePoolStatus to *map[string]map[string]interface{} and PostEnvironment.Name changed from string to *string. The SDK's Execute() conveniently re-buffers the response body before returning. We add a fallback in ListComputePools, DescribeComputePool, and CreateComputePool: when the SDK returns an error but the HTTP status is 2xx, we re-read the buffered body and parse it ourselves using json.RawMessage to intercept the status field. We extract the phase and encode it into the nested map format that the downstream extractComputePoolPhase expects.

Release Notes

Breaking Changes

  • None

New Features

  • None

Bug Fixes

  • Fixed on-prem Flink environment and compute pool commands to work with cmf-sdk-go v0.0.6 SDK type changes.

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

Blast Radius

Scope is limited to on-prem Flink compute pool and environment commands; Confluent Cloud commands (which use ccloud-sdk-go-v2, not cmf-sdk-go) are completely unaffected.

References

Tests

 /Users/parasnegi/cli/dist/confluent_darwin_arm64_v8.0/confluent flink compute-pool
  describe pool --url http://localhost:8080 --environment test
  +---------------+--------------------------+                                           
  | Creation Time | 2026-03-25T14:08:09.371Z |
  | Name          | pool                     |                                           
  | Type          | DEDICATED                |       
  | Phase         | DEDICATED                |
  +---------------+--------------------------+
                                                                                         
  ---
  /Users/parasnegi/cli/dist/confluent_darwin_arm64_v8.0/confluent flink compute-pool     
  describe pool --url http://localhost:8080 --environment test -o json
                                                                                         
  {
    "apiVersion": "cmf.confluent.io/v1",                                                 
    "kind": "ComputePool",                           
    "metadata": {
      "creationTimestamp": "2026-03-25T14:08:09.371Z",
      "uid": "7cbd1475-53b4-4b71-ba8d-af3e4d7ee6d7",  
      "labels": {},                                                                      
      "annotations": {}
    },                                                                                   
    "spec": {                                        
      "type": "DEDICATED",
      "clusterSpec": {                                                                   
        "flinkConfiguration": {
          "execution.checkpointing.interval": "2000",                                    
          "taskmanager.numberOfTaskSlots": "4"       
        },                                    
        "flinkVersion": "v1_19",
        "image": "519856050701.dkr.ecr.us-west-2.amazonaws.com/docker/dev/confluentinc/cp
  -flink-sql:0.0119-SNAPSHOT",                                                           
        "jobManager": {                                                                  
          "resource": {                                                                  
            "cpu": 0.5,                                                                  
            "memory": "1024m"                        
          }                  
        }, 
        "podTemplate": {
          "spec": {     
            "imagePullSecrets": [
              {                  
                "name": "confluent-registry"
              }                                                                          
            ]  
          }                                                                              
        },                                           
        "taskManager": {
          "resource": { 
            "cpu": 0.5,
            "memory": "1024m"
          }                  
        }  
      }  
    },
    "status": {                                                                          
      "phase": "DEDICATED"
    }                                                                                    
  } 

ComputePool.Status changed from *ComputePoolStatus to
*map[string]map[string]interface{} and PostEnvironment.Name changed
from string to *string. This updates all call sites to use SDK
getters/setters, adds extractComputePoolPhase() helper for the
generic status map, adds empty-name guards to environment create/update,
and updates test handler and golden files accordingly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 14, 2026 15:51
@confluent-cla-assistant
Copy link
Copy Markdown

🎉 All Contributor License Agreements have been signed. Ready to merge.
Please push an empty commit if you would like to re-run the checks to verify CLA status for all contributors.

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

Updates the CLI to accommodate breaking changes introduced in cmf-sdk-go v0.0.6, specifically around PostEnvironment.Name becoming a pointer and ComputePool.Status becoming a generic nested map. This keeps on-prem Flink environment and compute-pool commands working and aligns test fixtures with the updated API shapes.

Changes:

  • Bump github.com/confluentinc/cmf-sdk-go from v0.0.5 to v0.0.6 (go.mod/go.sum).
  • Update environment create/update to use SDK getters/setters and add empty-name validation in the CMF REST client.
  • Add extractComputePoolPhase() to read compute pool phase from the new generic status map, and update on-prem compute-pool commands + test server + golden fixtures accordingly.

Reviewed changes

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

Show a summary per file
File Description
pkg/flink/cmf_rest_client.go Uses PostEnvironment.GetName() and validates non-empty environment names for create/update.
internal/flink/command_environment_create.go Uses postEnvironment.SetName() to match pointer-based SDK field.
internal/flink/command_environment_update.go Uses postEnvironment.SetName() to match pointer-based SDK field.
internal/flink/command_compute_pool.go Adds extractComputePoolPhase() and updates compute-pool serialization to use it.
internal/flink/command_compute_pool_list_onprem.go Uses extractComputePoolPhase() for list output.
internal/flink/command_compute_pool_describe_onprem.go Uses extractComputePoolPhase() for describe output.
internal/flink/command_compute_pool_create_onprem.go Uses extractComputePoolPhase() for create output.
test/test-server/flink_onprem_handler.go Updates compute-pool and environment handlers to emit/consume new SDK shapes.
test/fixtures/output/flink/compute-pool/list-json.golden Updates expected JSON (clusterSpec now {} instead of null).
test/fixtures/output/flink/compute-pool/describe-success-json.golden Updates expected JSON (clusterSpec now {} instead of null).
go.mod Bumps cmf-sdk-go dependency version.
go.sum Updates checksums for cmf-sdk-go v0.0.6.

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

Comment thread internal/flink/command_compute_pool.go Outdated
The JSON marshal/unmarshal fallback path can never succeed given the SDK
type map[string]map[string]interface{} — marshaling always produces
nested objects which cannot unmarshal into map[string]string. Remove the
unreachable code and stderr warnings to keep the function side-effect free.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
SDK v0.0.6 types ComputePool.Status as *map[string]map[string]interface{}
but the API returns a flat object like {"phase":"RUNNING"}, causing the
SDK's Execute() to fail on valid 200 responses. Add fallback helpers that
re-parse the buffered response body when this occurs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@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