[CF-4208] Add --filter to on-prem Flink application list - #3428
[CF-4208] Add --filter to on-prem Flink application list#3428Paras Negi (paras-negi-flink) wants to merge 1 commit into
--filter to on-prem Flink application list#3428Conversation
|
🎉 All Contributor License Agreements have been signed. Ready to merge. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds application-list filtering support for Flink on-prem by wiring CLI flags into the CMF “filter” query parameter and updating the on-prem test server + integration fixtures to exercise name/status filtering behavior.
Changes:
- Add
--name(wildcard suffix supported) and--statusflags toflink application list, and build a CMFfilterquery from them. - Extend the CMF REST client
ListApplicationsto accept an optional filter and include it in requests. - Update the on-prem test server to emulate CMF-side filtering and add new integration test cases + golden outputs.
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/test-server/flink_onprem_handler.go | Emulates CMF filter behavior for on-prem application listing. |
| pkg/flink/cmf_rest_client.go | Adds filter support to the REST client listing call. |
| internal/flink/command_application_list.go | Introduces --name/--status flags and composes the CMF filter query. |
| internal/flink/command_application_list_test.go | Unit-tests the filter composition helper. |
| test/flink_onprem_test.go | Adds integration scenarios for list filtering. |
| test/fixtures/output/flink/application/*.golden | Golden outputs for the new filtering scenarios and updated help text. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| switch key { | ||
| case "name": | ||
| name, _ := app.Metadata["name"].(string) | ||
| if prefix, isWildcard := strings.CutSuffix(value, "*"); isWildcard { | ||
| return strings.HasPrefix(name, prefix) | ||
| } | ||
| return name == value | ||
| case "state": | ||
| if app.Status == nil { | ||
| return false | ||
| } | ||
| jobStatus, ok := (*app.Status)["jobStatus"].(map[string]interface{}) | ||
| if !ok { | ||
| return false | ||
| } | ||
| state, _ := jobStatus["state"].(string) | ||
| return strings.EqualFold(state, value) | ||
| default: | ||
| return true | ||
| } |
| for _, expr := range strings.Split(filter, ",") { | ||
| key, value, found := strings.Cut(expr, "=") | ||
| if !found { | ||
| continue | ||
| } |
Steven Gagniere (sgagniere)
left a comment
There was a problem hiding this comment.
Hi, I have a few comments:
|
|
||
| cmd.Flags().String("environment", "", "Name of the Flink environment.") | ||
| cmd.Flags().String("name", "", `Filter the Flink applications by name. Supports wildcards, for example "my-app*".`) | ||
| cmd.Flags().String("status", "", "Filter the Flink applications by status.") |
There was a problem hiding this comment.
I think we should name this state to match the filter key.
| // "state=" filter, per the cmf-sdk-go GetApplications filter documentation. Unknown values are | ||
| // still forwarded (the server returns no matches rather than erroring); this list only drives | ||
| // the advisory --status warning. | ||
| var allowedApplicationStatuses = []string{"RUNNING", "FINISHED", "FAILED", "CANCELED", "RECONCILING", "COMPLETED", "UNKNOWN"} |
There was a problem hiding this comment.
Just to confirm: are all of these statuses accepted filter arguments? The spec's description for filterParam implies that only RUNNING or FAILED are valid; so the description may be out of date for the spec.
f5c4f57 to
7a68092
Compare
7a68092 to
bbb15bf
Compare
bbb15bf to
a153efd
Compare
--name/--status filtering to on-prem application list--filter to on-prem Flink application list
a153efd to
9c11d37
Compare
Add a single `--filter` flag to `confluent flink application list` that takes a CMF filter expression, for example `name=my-app*,state=RUNNING` (comma- separated `key=value` terms; `name` supports a trailing `*` wildcard). This mirrors the generic filter shape the CLI code generator will produce for CMF resources instead of inventing per-field flags. `state=` values are upper-cased before the request so users need not match CMF's case-sensitive job-state enum (`state=running` behaves like `state=RUNNING`); every other term, including case-sensitive Kubernetes `name` values, is passed through verbatim. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
9c11d37 to
c83835e
Compare
|




Release Notes
New Features
--filterflag to the on-prem (Confluent Platform / CMF)confluent flink application listcommand, to filter large environments server-side instead of "list everything then grep".Checklist
Whatsection below whether this PR applies to Confluent Cloud, Confluent Platform, or both.Test & Reviewsection below.Blast Radiussection below.What
Confluent Platform (CMF on-prem) only — filtering half of CF-4208; Confluent Cloud
flinkcommands are untouched.flink application listhad no filtering, so at scale the only pattern was "list everything then grep" (CF-4202). This adds a single--filterflag that takes a CMF filter expression and applies it server-side:key=valueterms, e.g.--filter name=my-app*,state=RUNNING.namesupports a trailing*wildcard and its value is case-sensitive (Kubernetes resource names).statefilters by Flink job state; its value is case-insensitive (state=runningbehaves likestate=RUNNING).This mirrors the generic
filtershape the CLI code generator will produce for CMF resources, rather than inventing per-field flags — per review feedback on this PR.ListApplicationsgains afilterargument applied before pagination. The CLI upper-cases onlystate=values before sending (CMF matches the job-state enum case-sensitively); every other term is passed through verbatim, and there is no client-side validation — an unknown state is forwarded and simply matches nothing.Blast Radius
application list; with no--filterset, behavior is unchanged (nofilterparam). NoCmfClientInterface/mock change. Non-breaking, easy to revert.References
--page-sizeto on-prem Flink list commands #3424 (--page-size), now merged.Test & Review
TestNormalizeApplicationFilter:statefolded to upper case (value and key case-insensitive),nameand unknown keys passed through verbatim.--filter name=exact + wildcard,--filter state=in lower- and upper-case resolving to the same result (proves case-folding), unknown state → empty, combinedname=...,state=...; help golden regenerated.make lintclean.🤖 Generated with Claude Code