Skip to content

Conversation

ronaldngounou
Copy link
Member

@ronaldngounou ronaldngounou commented Apr 16, 2025

This PR introduces a guide on how to use etcdctl for distributed locking. This PR contributes to isssue #794.

It covers:

  • Prerequisities: Requirements such as running etcd cluster and etcdctl installed.
  • Explanation of the concept of lock.
  • Lock Creation
  • Lock Release

Test

  • npm run serve
  • Executed etcdctl lock commands on a virtual machine
  • Markdown lint normalization

@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

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

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

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

@k8s-ci-robot
Copy link

Hi @ronaldngounou. 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.

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.

github-actions bot and others added 2 commits April 15, 2025 22:54
cc. @etcd-io/maintainers-website

Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

Add section Embedding etcd in a Go Application

Signed-off-by: Ronald Ngounou <[email protected]>

Fix markdown lint errors

Signed-off-by: Ronald Ngounou <[email protected]>

rewrite Quickstart for local etcd setup

Signed-off-by: Ronald Ngounou <[email protected]>

Fix quickstart page to respect markdownlint normalization rules

Signed-off-by: Ronald Ngounou <[email protected]>

Add package json to gitignore

Signed-off-by: Ronald Ngounou <[email protected]>

Fix lint error related to website references

Signed-off-by: Ronald Ngounou <[email protected]>

Fix lint error: files should end with a single line character

Signed-off-by: Ronald Ngounou <[email protected]>

issue980 Revise the Whats next section to focus on two separate paths

Signed-off-by: Ronald Ngounou <[email protected]>
@ronaldngounou ronaldngounou force-pushed the issue794-create-locks branch from a1639e4 to f4d25d7 Compare April 16, 2025 05:57
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be the only file in this PR.

Copy link
Contributor

@jberkus jberkus left a comment

Choose a reason for hiding this comment

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

Great start! Here's what needs to happen next:

  1. Remove all the extraneous files from the PR
  2. Base it on revising 3.6 docs, and backport to 3.5
  3. Add information about unlocking

Here's a great blog post which gives more information on lock/unlock via the Go libraries: https://hemaks.org/posts/building-a-distributed-lock-system-with-go-and-etcd-a-step-by-step-guide/

@@ -1,16 +1,67 @@
---
title: How to create locks
description: Guide to creating distributed locks in etcd
description:
Copy link
Contributor

Choose a reason for hiding this comment

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

Why no description?


## Releasing a lock

When using the `etcdctl lock` command, the lock is released as soon as the command completes.
Copy link
Contributor

Choose a reason for hiding this comment

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

Not correct. If the client doesn't die, then the lock needs to be explicitly released with an unlock command. You'll want to cover the unlock operation here as well.

@wendy-ha18
Copy link
Contributor

@ronaldngounou I'm just curious, if we put this tutorial under https://etcd.io/docs/v3.5/tutorials/how-to-create-locks/, will it auto update for https://etcd.io/docs/v3.6/tutorials/how-to-create-locks/ as well? (cause the latest release is v3.6 so I just thought should we keep the tutorial for latest release updated rather than the old one?)

@ronaldngounou
Copy link
Member Author

Yes it should be under v3.6

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.

4 participants