Skip to content

Improve "How to get keys by prefix" task page - #1248

Open
namrathatiptur wants to merge 1 commit into
etcd-io:mainfrom
namrathatiptur:improve-get-by-prefix
Open

namrathatiptur wants to merge 1 commit into
etcd-io:mainfrom
namrathatiptur:improve-get-by-prefix

Conversation

@namrathatiptur

Copy link
Copy Markdown

Fixes #1247

What this changes

Rewrites the "How to get keys by prefix" task page, as requested in the issue:

  • Replaced the GIF with text examples. Each example now shows the command and its real output, so readers can copy the commands.
  • Uses realistic key paths. The examples use Kubernetes-style keys (/registry/pods/<namespace>/<name>) to show how prefixes work like folders.
  • Added a Go client example using clientv3.WithPrefix(), with the setup steps (go mod init, go get, go run) so it can be run as-is.

I also added:

  • A short "End prefixes with a separator" section. It shows that /registry/pods/default also matches /registry/pods/default-staging/..., which is an easy mistake to make.
  • An export ENDPOINTS=... step, since the page uses $ENDPOINTS but never set it.
  • A "Clean up" step at the end to delete the example keys.
  • Small fixes to match the sibling pages ("Prerequisites", install link, flag descriptions copied from etcdctl get --help).

Versions

  • Updated the same page in v3.6, v3.7 and v3.8, since they were identical and all had the GIF.
  • Did not change v3.5/tutorials/how-to-get-key-by-prefix.md, because v3.5 uses a different layout. Happy to do it in a follow-up if wanted.
  • I can split this into one PR per version if you prefer.

Notes for reviewers

  • Output is shown in separate text blocks instead of in the same block as the command. I did this so the commands can be copied without the output. Happy to switch to the style used on the other pages if you prefer.
  • The Go example uses spaces instead of tabs, because markdownlint in this repo does not allow hard tabs.

Testing

  • Ran every command on the page, in order, against a local etcd v3.7.3, and pasted the real output.
  • Built and ran the Go example in a fresh module with go.etcd.io/etcd/client/v3 v3.7.3. go vet passes.
  • markdownlint-cli2 passes on all three files.
  • Previewed the pages locally with hugo serve.

Signed-off-by: namrathatiptur <namrathatm2018@gmail.com>
@kubernetes-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: namrathatiptur
Once this PR has been reviewed and has the lgtm label, please assign nate-double-u for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubernetes-prow

Copy link
Copy Markdown

Hi @namrathatiptur. Thanks for your PR.

I'm waiting for a etcd-io member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work.

Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@jberkus

jberkus commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

/ok-to-test

@jberkus

jberkus commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Looks good, going to wait for Prow to clear before I try to merge.

@jberkus

jberkus commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

Did not change v3.5/tutorials/how-to-get-key-by-prefix.md, because v3.5 uses a different layout. Happy to do it in a follow-up if wanted.

Don't worry about that, 3.5 will be EOL in may, we don't need to backport.

@jberkus

jberkus commented Nov 12, 2026

Copy link
Copy Markdown
Contributor

/retest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve How To Get Keys By Prefix

2 participants