Skip to content

Backport of member cli: add -filter expression to flags into release/1.14.x#18274

Merged
huikang merged 2 commits into
release/1.14.xfrom
backport/gh-18152-members-filter-dc/eminently-ample-ladybird
Jul 25, 2023
Merged

Backport of member cli: add -filter expression to flags into release/1.14.x#18274
huikang merged 2 commits into
release/1.14.xfrom
backport/gh-18152-members-filter-dc/eminently-ample-ladybird

Conversation

@hc-github-team-consul-core
Copy link
Copy Markdown
Collaborator

Backport

This PR is auto-generated from #18223 to be assessed for backporting due to the inclusion of the label backport/1.14.

🚨

Warning automatic cherry-pick of commits failed. If the first commit failed,
you will see a blank no-op commit below. If at least one commit succeeded, you
will see the cherry-picked commits up to, not including, the commit where
the merge conflict occurred.

The person who merged in the original PR is:
@huikang
This person should manually cherry-pick the original PR into a new backport PR,
and close this one when the manual backport PR is merged in.

merge conflict error: unable to process merge commit: "44f52d98940efefcf6a1e15d7679ddb9dbfdf6b8", automatic backport requires rebase workflow

The below text is copied from the body of the original PR.


Description

Add -filter to consul members to filter the members by bexpr. Please see #18152 for the use case

  • unit test added to api

How to Test

Without filter: all members from federated clusters will be listed:

consul members -wan                            
Node          Address              Status  Type    Build      Protocol  DC   Partition  Segment
server-1.dc2  192.168.1.168:8322   alive   server  1.17.0dev  2         dc2  default    <all>
server-1.dc3  192.168.1.168:28322  alive   server  1.17.0dev  2         dc3  default    <all>

Filtered results: only list the members from a specified dc

consul members -wan -filter 'Tags["dc"] == dc2'           
Node          Address             Status  Type    Build      Protocol  DC   Partition  Segment
server-1.dc2  192.168.1.168:8322  alive   server  1.17.0dev  2         dc2  default    <all>


consul members -wan -filter 'Tags["dc"] == dc3'
Node          Address              Status  Type    Build      Protocol  DC   Partition  Segment
server-1.dc3  192.168.1.168:28322  alive   server  1.17.0dev  2         dc3  default    <all>

-->

Links

Fix #18152

PR Checklist

  • updated test coverage
  • external facing docs updated
  • appropriate backport labels added
  • not a security concern

Overview of commits

@hc-github-team-consul-core hc-github-team-consul-core force-pushed the backport/gh-18152-members-filter-dc/eminently-ample-ladybird branch from b9c90c3 to e4152e2 Compare July 25, 2023 17:55
@hc-github-team-consul-core hc-github-team-consul-core force-pushed the backport/gh-18152-members-filter-dc/eminently-ample-ladybird branch from b13503a to cecdcf2 Compare July 25, 2023 17:55
@github-actions github-actions Bot added type/docs Documentation needs to be created/updated/clarified theme/api Relating to the HTTP API interface theme/cli Flags and documentation for the CLI interface labels Jul 25, 2023
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Auto approved Consul Bot automated PR

@hc-github-team-consul-core
Copy link
Copy Markdown
Collaborator Author

🤔 This PR has changes in the website/ directory but does not have a type/docs-cherrypick label. If the changes are for the next version, this can be ignored. If they are updates to current docs, attach the label to auto cherrypick to the stable-website branch after merging.

@vercel vercel Bot temporarily deployed to Preview – consul July 25, 2023 17:56 Inactive
@huikang huikang marked this pull request as ready for review July 25, 2023 18:01
@huikang huikang requested a review from a team as a code owner July 25, 2023 18:01
@huikang huikang force-pushed the backport/gh-18152-members-filter-dc/eminently-ample-ladybird branch from cecdcf2 to 0deb48e Compare July 25, 2023 19:10
@huikang huikang enabled auto-merge (squash) July 25, 2023 20:15
@huikang huikang merged commit 2897fc7 into release/1.14.x Jul 25, 2023
@huikang huikang deleted the backport/gh-18152-members-filter-dc/eminently-ample-ladybird branch July 25, 2023 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

theme/api Relating to the HTTP API interface theme/cli Flags and documentation for the CLI interface type/docs Documentation needs to be created/updated/clarified

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants