Multi k8s kubernetes cluster commands#3319
Conversation
Implement `confluent flink kubernetes-cluster` commands for managing
Kubernetes clusters registered with Confluent Manager for Apache Flink
(CMF) on-prem. Also upgrades cmf-sdk-go from v0.0.5 to v0.0.6.
Commands added:
- `flink kubernetes-cluster list` List all registered clusters
- `flink kubernetes-cluster describe <name>` Describe a cluster
- `flink kubernetes-cluster update <name> --lifecycle-state <state>`
Update lifecycle state (ACTIVE or DECOMMISSIONED)
SDK upgrade (v0.0.5 → v0.0.6):
- Picks up the new KubernetesClusters API and generated mocks
- Fixes PostEnvironment.Name (*string): use SetName()/GetName()
- Works around ComputePool.Status type regression in v0.0.6 caused by
additionalProperties: true in the spec generating an incorrect
*map[string]map[string]interface{} type; adds computePoolPhase()
helper to preserve Phase output in tests until fixed upstream
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
🎉 All Contributor License Agreements have been signed. Ready to merge. |
There was a problem hiding this comment.
Pull request overview
Adds CMF (on-prem Flink) support for managing registered Kubernetes clusters via new CLI commands, alongside an SDK bump and related compatibility updates.
Changes:
- Introduces
flink kubernetes-clustercommand group withlist,describe, andupdatesubcommands. - Upgrades
github.com/confluentinc/cmf-sdk-gotov0.0.6and updates environment/create+update call sites to use SDK getters/setters. - Adapts compute pool phase handling to the SDK’s updated
ComputePool.Statusshape and updates the on-prem test server accordingly.
Reviewed changes
Copilot reviewed 27 out of 28 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
internal/flink/command.go |
Registers the new kubernetes-cluster command group under flink. |
internal/flink/command_kubernetes_cluster.go |
Adds command group + output model + SDK→local conversion helper. |
internal/flink/command_kubernetes_cluster_list.go |
Implements listing Kubernetes clusters from CMF with human/serialized output. |
internal/flink/command_kubernetes_cluster_describe.go |
Implements describing a single Kubernetes cluster. |
internal/flink/command_kubernetes_cluster_update.go |
Implements updating cluster lifecycle state. |
pkg/flink/cmf_rest_client.go |
Adds CMF REST client methods for Kubernetes cluster list/describe/update; updates env name getter usage. |
internal/flink/local_types.go |
Adds local serialized types for Kubernetes cluster output. |
internal/flink/command_environment_create.go |
Switches to PostEnvironment.SetName() for SDK v0.0.6. |
internal/flink/command_environment_update.go |
Switches to PostEnvironment.SetName() for SDK v0.0.6. |
internal/flink/command_compute_pool.go |
Adds computePoolPhase() workaround for SDK status type change. |
internal/flink/command_compute_pool_list_onprem.go |
Uses computePoolPhase() for phase rendering. |
internal/flink/command_compute_pool_describe_onprem.go |
Uses computePoolPhase() for phase rendering. |
internal/flink/command_compute_pool_create_onprem.go |
Uses computePoolPhase() for phase rendering. |
test/test-server/flink_onprem_handler.go |
Adjusts test server compute pool status JSON to match new SDK status shape; uses env getters. |
pkg/flink/test/mock/*.go |
Regenerates several gomock mocks (notably changing gomock import path). |
go.mod / go.sum |
Bumps cmf-sdk-go to v0.0.6 and adds github.com/golang/mock. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| github.com/go-jose/go-jose/v3 v3.0.5 | ||
| github.com/gobuffalo/flect v1.0.2 | ||
| github.com/gogo/protobuf v1.3.2 | ||
| github.com/golang/mock v1.6.0 |
There was a problem hiding this comment.
The repo already depends on go.uber.org/mock (and many tests import go.uber.org/mock/gomock), but this PR adds github.com/golang/mock and regenerates several mocks against that package. Mixing these two gomock packages will break compilation because the Controller/Call types are not interchangeable. Please standardize on one gomock implementation (either switch all tests + remaining mocks to github.com/golang/mock/gomock, or revert these regenerated mocks and the new dependency back to go.uber.org/mock/gomock) and regenerate consistently.
| github.com/golang/mock v1.6.0 |
There was a problem hiding this comment.
Addressed in fd472f5 — reverted the regenerated mocks in pkg/flink/test/mock/ back to their main branch versions (they use go.uber.org/mock/gomock) and dropped github.com/golang/mock from direct requires. The regeneration was unintentional and didn't reflect any interface changes.
|
|
||
| types "github.com/confluentinc/cli/v4/pkg/flink/types" | ||
| gomock "go.uber.org/mock/gomock" | ||
| gomock "github.com/golang/mock/gomock" |
There was a problem hiding this comment.
This generated mock now imports github.com/golang/mock/gomock, but other mocks/tests in the repo still use go.uber.org/mock/gomock. As a result, callers that create a *go.uber.org/mock/gomock.Controller cannot pass it into mocks generated against github.com/golang/mock/gomock (type mismatch). Please regenerate all mocks and update all tests to use a single gomock package consistently.
| gomock "github.com/golang/mock/gomock" | |
| gomock "go.uber.org/mock/gomock" |
There was a problem hiding this comment.
Addressed in fd472f5 — this file (and the other 11 regenerated mocks in pkg/flink/test/mock/) has been reverted to its main branch version, which uses go.uber.org/mock/gomock.
| cmd.AddCommand(c.newDetachedSavepointCommand()) | ||
| cmd.AddCommand(c.newEnvironmentCommand()) | ||
| cmd.AddCommand(c.newKubernetesClusterCommand()) | ||
| cmd.AddCommand(c.newSavepointCommand()) |
There was a problem hiding this comment.
The PR description's release notes and checklist are still placeholders/unchecked, but this PR adds a new user-facing CLI command group (flink kubernetes-cluster). Please update the PR description to include real release notes entries and complete the checklist (or remove irrelevant sections) so reviewers can assess breaking changes, customer impact, and verification steps.
There was a problem hiding this comment.
PR description was updated on the PR view side — release notes now include the new flink kubernetes-cluster subcommands, the --kubernetes-cluster-name flag on environment create, and the environment output additions. The What/Blast Radius/Test & Review sections are filled in.
- Add integration tests for kubernetes-cluster list, describe, update commands with human, JSON, and YAML output formats - Add test server handlers for kubernetes-clusters endpoints - Add --kubernetes-cluster-name flag to environment create command - Show kubernetes cluster name in environment list and describe output - Update environment golden files for new cluster name field Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Address PR review feedback: - Restore pkg/flink/test/mock/*.go to their main branch state. These were unintentionally regenerated with github.com/golang/mock, which broke compilation because the rest of the repo uses go.uber.org/mock - Remove github.com/golang/mock from direct dependencies (still indirect via a transitive dependency) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…cluster-commands # Conflicts: # go.mod # go.sum # internal/flink/command_compute_pool.go # internal/flink/command_compute_pool_create_onprem.go # internal/flink/command_compute_pool_describe_onprem.go # internal/flink/command_compute_pool_list_onprem.go # internal/flink/command_environment_create.go # internal/flink/command_environment_update.go # pkg/flink/cmf_rest_client.go # test/flink_onprem_test.go # test/test-server/flink_onprem_handler.go # test/test-server/flink_onprem_router.go
Release Notes
Breaking Changes
New Features
Bug Fixes
Checklist
I have successfully built and used a custom CLI binary, without linter issues from this PR.
I have clearly specified in the
Whatsection 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 & Reviewsection 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 Radiussection 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
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:
What
Confluent Platform only.
Adds CLI support for the multi-Kubernetes cluster feature in Confluent Manager for Apache Flink (CMF):
for SDK type changes (PostEnvironment.Name becoming *string, ComputePool.Status type regression).
Blast Radius
Low. New kubernetes-cluster commands are on-prem-only behind RequireCloudLogout. The --kubernetes-cluster-name flag on environment create is optional and defaults to the
existing single-cluster behavior when omitted. SDK compatibility changes to existing environment and compute pool commands are minimal accessor changes that preserve
the same runtime behavior. All existing tests pass.
References
Test & Review