Skip to content

CNTRLPLANE-3724: adding agentic SDLC documentation for etcd - #389

Closed
sandeepknd wants to merge 1 commit into
openshift:mainfrom
sandeepknd:sdlc-etcd
Closed

CNTRLPLANE-3724: adding agentic SDLC documentation for etcd#389
sandeepknd wants to merge 1 commit into
openshift:mainfrom
sandeepknd:sdlc-etcd

Conversation

@sandeepknd

@sandeepknd sandeepknd commented Jun 25, 2026

Copy link
Copy Markdown

Hi Team,
This PR about adding agentic SDLC documentation for etcd. Kindly find the below details.

AGENTS.md - AI Agent Development Guide

  - Architecture patterns ✓
  - Code organization ✓
  - Development workflows ✓
  - What to Always/Ask/Never Do sections ✓
  - Common agent mistakes ✓
  - Testing strategies ✓

ARCHITECTURE.md - Detailed System Documentation

  - System architecture diagrams ✓
  - Component architecture ✓
  - Design decisions with rationale ✓
  - Failure modes and recovery ✓
  - Deployment topology ✓

CONTRIBUTING.md - Updated with Links

  - References to new documentation ✓
  - Integration with existing workflow ✓

Summary by CodeRabbit

  • Documentation
    • Added a new quick-reference guide and an in-depth architecture overview for the OpenShift etcd fork.
    • Expanded contributor guidance with clearer pointers to fork-specific workflows and key reading.
    • Linked the main docs together so it’s easier to find development, recovery, performance, and operational information.

@openshift-ci openshift-ci Bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 25, 2026
@openshift-ci

openshift-ci Bot commented Jun 25, 2026

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown

Walkthrough

Adds AGENTS.md and ARCHITECTURE.md as repository documentation, updates CLAUDE.md to point to AGENTS.md, and revises CONTRIBUTING.md to surface the new fork-specific reading list and resource links.

Changes

Repository documentation and guidance

Layer / File(s) Summary
AGENTS reference and operations
AGENTS.md
Adds the guide scope, repository map, compaction and restore guidance, TLS notes, and performance tuning references.
AGENTS rules and metadata
AGENTS.md
Adds development workflows, testing guidance, critical rules, common mistakes, metrics, defaults, OpenShift notes, resource links, and footer metadata.
Architecture overview and core storage path
ARCHITECTURE.md
Adds the system overview, data flow, EtcdServer, Raft node, MVCC, backend persistence, WAL, and snapshot store sections.
Consensus, storage semantics, and client APIs
ARCHITECTURE.md
Adds Raft behavior, storage semantics, compaction and defragmentation, transactions, client APIs, and watch semantics.
Leases, auth, cluster operations, and deployment
ARCHITECTURE.md
Adds lease, authentication, RBAC, cluster management, recovery, performance, failure-mode, and deployment topology sections.
Contributor references and symlink
CLAUDE.md, CONTRIBUTING.md
Points CLAUDE.md at AGENTS.md and revises CONTRIBUTING.md notes and resource links.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~15 minutes

🚥 Pre-merge checks | ✅ 15
✅ Passed checks (15 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding agentic SDLC documentation for etcd.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Stable And Deterministic Test Names ✅ Passed PASS: The PR only adds/edits Markdown docs; I found no Ginkgo test titles or dynamic test-name patterns in the changed files.
Test Structure And Quality ✅ Passed The PR only changes AGENTS.md, ARCHITECTURE.md, CLAUDE.md, and CONTRIBUTING.md; no Ginkgo test code was modified, so this test-quality check is not applicable.
Microshift Test Compatibility ✅ Passed No new Ginkgo e2e tests or OpenShift API usages were introduced; the e2e suites are plain testing-based etcd tests with no MicroShift-only concerns.
Single Node Openshift (Sno) Test Compatibility ✅ Passed PR changes are docs-only (AGENTS/ARCHITECTURE/CONTRIBUTING/CLAUDE); no new Ginkgo e2e tests or SNO-sensitive multi-node assumptions were added.
Topology-Aware Scheduling Compatibility ✅ Passed Only docs and a symlink were added; no deployment manifests, operator code, or controllers were changed, so no topology-aware scheduling issue is introduced.
Ote Binary Stdout Contract ✅ Passed PR only adds docs/symlink; no changes to main/init/TestMain/suite setup or logging code, so no stdout contract risk.
Ipv6 And Disconnected Network Test Compatibility ✅ Passed PR adds docs only; no new/changed Ginkgo e2e tests or IPv4/external-network assumptions were introduced.
No-Weak-Crypto ✅ Passed Added docs mention SHA256/CRC32/TLS/RBAC only; no MD5/SHA1/DES/RC4/3DES/Blowfish/ECB, custom crypto, or secret-comparison code found.
Container-Privileges ✅ Passed Scanned the added YAML/Dockerfiles in the commit tree and found no privileged, hostPID, hostNetwork, hostIPC, or allowPrivilegeEscalation settings.
No-Sensitive-Data-In-Logs ✅ Passed The PR only adds docs; log examples are redacted and any credentials/hosts shown are generic placeholders, not real sensitive data.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands.

@sandeepknd sandeepknd changed the title adding agentic SDLC documentation for etcd CNTRLPLANE-3724: adding agentic SDLC documentation for etcd Jun 25, 2026
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Jun 25, 2026
@openshift-ci-robot

openshift-ci-robot commented Jun 25, 2026

Copy link
Copy Markdown

@sandeepknd: This pull request references CNTRLPLANE-3724 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "5.0.0" version, but no target version was set.

Details

In response to this:

Hi Team,
This PR about adding agentic SDLC documentation for etcd. Kindly find the below details.

✅ AGENTS.md - Comprehensive Development Guide

  • Architecture patterns ✓
  • Code organization ✓
  • Development workflows ✓
  • What to Always/Ask/Never Do sections ✓
  • Common agent mistakes ✓
  • Testing strategies ✓

✅ ARCHITECTURE.md - Detailed System Documentation

  • System architecture diagrams ✓
  • Component architecture ✓
  • Design decisions with rationale ✓
  • Failure modes and recovery ✓
  • Deployment topology ✓

✅ CONTRIBUTING.md - Updated with Links

  • References to new documentation ✓
  • Integration with existing workflow ✓

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 openshift-eng/jira-lifecycle-plugin repository.

@sandeepknd
sandeepknd marked this pull request as ready for review June 25, 2026 13:13
@openshift-ci openshift-ci Bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 25, 2026
@openshift-ci
openshift-ci Bot requested review from hasbro17 and tjungblu June 25, 2026 13:14
@sandeepknd

Copy link
Copy Markdown
Author

/assign @dusk125

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 6

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@AGENTS.md`:
- Around line 117-131: The watch design notes overstate the guarantee by saying
“No events are lost”; update the wording in the AGENTS.md watch section to
describe ordered, resumable delivery instead, and keep the rest of the guidance
consistent with the watcher-related implementation symbols `watchable_store.go`,
`watcher.go`, and `pkg/v3/notify` so readers understand watches can be
compacted, disconnected, or backpressured.
- Around line 81-99: The fenced diagram example is missing a language tag,
causing markdownlint warnings and inconsistent rendering. Update the affected
fenced blocks in AGENTS.md to use an explicit tag such as text, and scan the
rest of the file for the same bare-fence pattern so all examples are tagged
consistently.

In `@ARCHITECTURE.md`:
- Around line 150-173: Update the EtcdServer sketch so it mirrors the live
struct in server.go: replace the non-existent types and fields shown here with
the actual EtcdServer members, and add the missing real ones such as
snapshotter, authStore, alarmStore, and AccessController. Use the current
server/etcdserver/server.go EtcdServer definition as the source of truth, and
keep the field grouping aligned with the real layout so this documentation stays
authoritative.
- Around line 788-805: Qualify the Watch Guarantees section in ARCHITECTURE.md
so it does not read as an absolute promise; update the text under the “Watch
Guarantees” and “Slow Consumer Handling” headings to reflect that ordering,
uniqueness, and resumability only hold within the available history window and
that watches may be canceled on compaction or slow consumption. Keep the wording
aligned with the existing watcher/victim behavior described in the
watch-handling docs and make sure the guarantees are presented as conditional
rather than unconditional.
- Around line 1059-1070: Update the recovery section to make the restore flow
the default path: in the snapshot recovery steps shown near the “Restore from
snapshot on one member” and “Start restored member” examples, keep the `etcdutl
snapshot restore` flow as the primary guidance and replace the `etcd
--force-new-cluster` start step with a stronger note that `--force-new-cluster`
is only a discouraged fallback. Reference the existing recovery examples and
wording around `snapshot restore` and `force-new-cluster` so the new text
clearly steers users to the restore-based path first.
- Around line 56-1428: The fenced code blocks in ARCHITECTURE.md are missing
language annotations, which triggers markdownlint MD040. Update each bare fence
in the document to use the appropriate language tag based on the snippet
content, such as go, bash, protobuf, or text, and ensure the named sections
around the examples (for example, the gRPC service definitions, client/v3
samples, and shell commands) are tagged consistently. If any fence is
intentionally language-agnostic, handle it via an explicit lint exemption
instead of leaving it bare.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 6d4c4813-b06a-4b41-9c66-342b7476e084

📥 Commits

Reviewing files that changed from the base of the PR and between bf6c009 and 70889660acd6d0e762d06cb5b5b414c50eeb8e88.

📒 Files selected for processing (4)
  • AGENTS.md
  • ARCHITECTURE.md
  • CLAUDE.md
  • CONTRIBUTING.md

Comment thread AGENTS.md Outdated
Comment on lines +81 to +99
```
┌─────────────────────────────────────────┐
│ KV Store (Interface) │
└─────────────────┬───────────────────────┘
┌─────────────────▼───────────────────────┐
│ MVCC Layer │
│ - Revision management │
│ - Transaction coordination │
│ - Watch event generation │
└─────────────────┬───────────────────────┘
┌─────────────────▼───────────────────────┐
│ BoltDB Backend (bbolt) │
│ - B+tree storage │
│ - ACID transactions │
│ - Snapshot support │
└─────────────────────────────────────────┘
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Tag the fenced examples.

These bare fences are already tripping markdownlint, and the same pattern repeats throughout the file. Please add explicit language tags (text, go, protobuf, etc.) so the doc renders consistently and the lint warnings go away.

🛠️ Example fix
- ```
+ ```text
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
```
┌─────────────────────────────────────────┐
│ KV Store (Interface) │
└─────────────────┬───────────────────────┘
┌─────────────────▼───────────────────────┐
│ MVCC Layer │
│ - Revision management │
│ - Transaction coordination │
│ - Watch event generation │
└─────────────────┬───────────────────────┘
┌─────────────────▼───────────────────────┐
│ BoltDB Backend (bbolt) │
│ - B+tree storage │
│ - ACID transactions │
│ - Snapshot support │
└─────────────────────────────────────────┘
```
🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 81-81: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@AGENTS.md` around lines 81 - 99, The fenced diagram example is missing a
language tag, causing markdownlint warnings and inconsistent rendering. Update
the affected fenced blocks in AGENTS.md to use an explicit tag such as text, and
scan the rest of the file for the same bare-fence pattern so all examples are
tagged consistently.

Source: Linters/SAST tools

Comment thread AGENTS.md Outdated
Comment thread ARCHITECTURE.md
Comment on lines +56 to +1428
│ (Single) │
└──────────────┘
```

**Use**: Local development, testing
**Fault Tolerance**: None
**Performance**: Full read/write speed

### Production (3 Nodes)

```
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ etcd-1 │◄────►│ etcd-2 │◄────►│ etcd-3 │
│ (Leader) │ │ (Follower) │ │ (Follower) │
└──────────────┘ └──────────────┘ └──────────────┘
```

**Use**: Small production clusters
**Fault Tolerance**: 1 node failure
**Quorum**: 2 nodes

### High Availability (5 Nodes)

```
┌──────────────┐ ┌──────────────┐ ┌──────────────┐
│ etcd-1 │◄────►│ etcd-2 │◄────►│ etcd-3 │
│ (Leader) │ │ (Follower) │ │ (Follower) │
└──────────────┘ └──────────────┘ └──────────────┘
▲ ▲
│ │
▼ ▼
┌──────────────┐ ┌──────────────┐
│ etcd-4 │◄──────────────────────────►│ etcd-5 │
│ (Follower) │ │ (Follower) │
└──────────────┘ └──────────────┘
```

**Use**: Large production clusters
**Fault Tolerance**: 2 node failures
**Quorum**: 3 nodes

### Multi-Region (5 Nodes)

```
Region 1 Region 2 Region 3
┌──────────┐ ┌──────────┐ ┌──────────┐
│ etcd-1 │◄───────►│ etcd-2 │◄───────►│ etcd-3 │
│(Follower)│ │ (Leader) │ │(Follower)│
└──────────┘ └──────────┘ └──────────┘
Region 1 ┌──────────┐ Region 3
┌──────────┐ │ etcd-4 │ ┌──────────┐
│ etcd-5 │◄───────►│(Follower)│◄───────►│ (etc) │
│(Follower)│ └──────────┘ │ │
└──────────┘ Region 2 └──────────┘
```

**Use**: Global availability
**Considerations**:
- Higher latency (cross-region)
- Place majority in low-latency region
- Consider network costs

### Kubernetes/OpenShift

```
┌─────────────────────────────────────────────┐
│ Kubernetes/OpenShift Cluster │
│ │
│ ┌────────────────────────────────────────┐ │
│ │ Control Plane Nodes │ │
│ │ │ │
│ │ ┌──────────┐ ┌──────────┐ ┌───────┐│ │
│ │ │ etcd-1 │ │ etcd-2 │ │ etcd-3││ │
│ │ │(Static │ │(Static │ │(Static││ │
│ │ │ Pod) │ │ Pod) │ │ Pod) ││ │
│ │ └──────────┘ └──────────┘ └───────┘│ │
│ │ ▲ ▲ ▲ │ │
│ └───────┼──────────────┼──────────────┼──┘ │
│ │ │ │ │
│ ┌───────▼──────────────▼──────────────▼──┐ │
│ │ kube-apiserver instances │ │
│ │ (read/write cluster state to etcd) │ │
│ └────────────────────────────────────────┘ │
└─────────────────────────────────────────────┘
```

**Characteristics**:
- etcd runs as static pods
- Co-located with kube-apiserver
- Dedicated data directory (hostPath)
- Separate network for peer communication

---

**Document Version**: 1.0
**Last Updated**: 2026-06-25
**Maintained By**: OpenShift etcd Team

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Add language tags to the fenced blocks.

markdownlint is already flagging every bare fence here (MD040). Please mark the snippets with the right language (go, bash, protobuf, text, etc.) or exempt the file if bare fences are intentional.

🧰 Tools
🪛 LanguageTool

[style] ~1293-~1293: As an alternative to the over-used intensifier ‘very’, consider replacing this phrase.
Context: ...res defragmentation - Not optimized for very large datasets (>100GB) ### Why gRPC? **Rea...

(EN_WEAK_ADJECTIVE)

🪛 markdownlint-cli2 (0.22.1)

[warning] 56-56: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 107-107: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 120-120: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 129-129: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 211-211: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 243-243: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 252-252: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 331-331: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 345-345: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 384-384: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 396-396: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 471-471: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 477-477: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 484-484: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 506-506: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 570-570: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 730-730: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 811-811: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 1326-1326: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 1339-1339: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 1352-1352: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 1372-1372: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


[warning] 1396-1396: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ARCHITECTURE.md` around lines 56 - 1428, The fenced code blocks in
ARCHITECTURE.md are missing language annotations, which triggers markdownlint
MD040. Update each bare fence in the document to use the appropriate language
tag based on the snippet content, such as go, bash, protobuf, or text, and
ensure the named sections around the examples (for example, the gRPC service
definitions, client/v3 samples, and shell commands) are tagged consistently. If
any fence is intentionally language-agnostic, handle it via an explicit lint
exemption instead of leaving it bare.

Source: Linters/SAST tools

Comment thread ARCHITECTURE.md
Comment on lines +150 to +173
**Key Structures**:
```go
type EtcdServer struct {
// Raft consensus
r raftNode
raftStorage *raft.MemoryStorage

// Storage
kv mvcc.ConsistentWatchableKV
be backend.Backend

// Cluster state
cluster api.Cluster
id types.ID

// Configuration
Cfg config.ServerConfig

// Lease management
lessor lease.Lessor

// Apply layer
applyV3 apply.ApplyV3
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win

Make this EtcdServer sketch match server.go.

The current example names types that do not exist in the live struct (mvcc.ConsistentWatchableKV, api.Cluster, apply.ApplyV3) and omits several real fields (snapshotter, authStore, alarmStore, AccessController, etc.). Readers will treat this as authoritative, so it should mirror the actual struct layout. Based on the current server/etcdserver/server.go struct.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ARCHITECTURE.md` around lines 150 - 173, Update the EtcdServer sketch so it
mirrors the live struct in server.go: replace the non-existent types and fields
shown here with the actual EtcdServer members, and add the missing real ones
such as snapshotter, authStore, alarmStore, and AccessController. Use the
current server/etcdserver/server.go EtcdServer definition as the source of
truth, and keep the field grouping aligned with the real layout so this
documentation stays authoritative.

Comment thread ARCHITECTURE.md
Comment on lines +788 to +805
### Watch Guarantees

1. **Ordered**: Events delivered in revision order
2. **Reliable**: No events are lost or duplicated
3. **Resumable**: Can resume from any revision
4. **Atomic**: Transactional puts generate single event

### Slow Consumer Handling

**Problem**: Slow consumer can't keep up with event rate.

**Solution**: Event buffering with overflow detection.

**Behavior**:
- Events buffered in channel (default 1024)
- If buffer fills, watcher marked as "victim"
- Victim watchers receive all queued events in one batch
- Client must process or risk watch cancellation

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Qualify the watch guarantees.

This reads as an absolute guarantee, but etcd only promises ordered/unique/reliable delivery within the available history window, and a slow or compacted watch can still be canceled and must be re-established. (etcd.io)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ARCHITECTURE.md` around lines 788 - 805, Qualify the Watch Guarantees section
in ARCHITECTURE.md so it does not read as an absolute promise; update the text
under the “Watch Guarantees” and “Slow Consumer Handling” headings to reflect
that ordering, uniqueness, and resumability only hold within the available
history window and that watches may be canceled on compaction or slow
consumption. Keep the wording aligned with the existing watcher/victim behavior
described in the watch-handling docs and make sure the guarantees are presented
as conditional rather than unconditional.

Comment thread ARCHITECTURE.md
Comment on lines +1059 to +1070
**2. Restore from snapshot on one member**:
```bash
etcdutl snapshot restore snapshot.db \
--name=member1 \
--initial-cluster=member1=http://host1:2380 \
--initial-advertise-peer-urls=http://host1:2380
```

**3. Start restored member**:
```bash
etcd --force-new-cluster
```

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Use the restore flow as the default recovery path.

The normal recovery path is etcdutl snapshot restore, which creates new data dirs and rewrites member/cluster IDs; --force-new-cluster is only a discouraged fallback and can panic if old members are still alive. (etcd.io)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ARCHITECTURE.md` around lines 1059 - 1070, Update the recovery section to
make the restore flow the default path: in the snapshot recovery steps shown
near the “Restore from snapshot on one member” and “Start restored member”
examples, keep the `etcdutl snapshot restore` flow as the primary guidance and
replace the `etcd --force-new-cluster` start step with a stronger note that
`--force-new-cluster` is only a discouraged fallback. Reference the existing
recovery examples and wording around `snapshot restore` and `force-new-cluster`
so the new text clearly steers users to the restore-based path first.

@openshift-ci

openshift-ci Bot commented Jun 26, 2026

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: sandeepknd
Once this PR has been reviewed and has the lgtm label, please ask for approval from dusk125. 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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

♻️ Duplicate comments (5)
ARCHITECTURE.md (4)

1059-1070: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Don't make --force-new-cluster the normal restart step.

After snapshot restore, the restored member should be started normally. --force-new-cluster is only a fallback and makes this recovery path look unsafe by default.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ARCHITECTURE.md` around lines 1059 - 1070, The recovery steps in the snapshot
restore section should not present `--force-new-cluster` as the standard way to
start the restored member. Update the instructions around the `snapshot restore`
and `etcd` startup steps so the restored member is started normally by default,
and mention `--force-new-cluster` only as an exceptional fallback if needed.

150-173: 📐 Maintainability & Code Quality | 🟠 Major | 🏗️ Heavy lift

Mirror the live EtcdServer layout.

This sketch still doesn't match server.go and will read as authoritative. Please replace the placeholder types/fields with the real members from the struct definition.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ARCHITECTURE.md` around lines 150 - 173, The EtcdServer sketch in
Architecture documentation is still using placeholder types and fields instead
of the real struct layout from EtcdServer in server.go. Update the documented
members to match the actual EtcdServer definition exactly, including the correct
field names and types for raft, storage, cluster state, configuration, lease,
and apply components, so the reference stays authoritative and in sync with the
code.

788-805: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Qualify the watch guarantees.

No events are lost or duplicated is still too strong; watches can be canceled by compaction or slow consumers and must be resumed from a revision.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ARCHITECTURE.md` around lines 788 - 805, Qualify the Watch Guarantees section
in ARCHITECTURE.md so it no longer states unconditional reliability. Update the
guarantee text to reflect that watches preserve order and resumability, but may
be canceled by compaction or slow consumer handling, requiring clients to resume
from a revision; keep the wording aligned with the Watch Guarantees and Slow
Consumer Handling sections.

56-102: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Tag the remaining bare fences.

The document still has many unlabeled code/diagram fences, so MD040 will keep firing and the examples will render inconsistently. Please mark them with explicit languages such as go, bash, protobuf, or text.

Also applies to: 107-134, 211-261, 331-350, 384-402, 471-488, 506-517, 730-754, 780-786, 811-831, 1326-1416

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@ARCHITECTURE.md` around lines 56 - 102, The architecture document still
contains bare fenced blocks that trigger MD040 and inconsistent rendering.
Update the affected fences around the etcd cluster diagram and the other listed
sections by adding an explicit language tag that matches the content, using text
for diagrams and the appropriate code language for any actual snippets. Keep the
existing content intact and make sure each fence is clearly labeled so the
markdown linter stops flagging them.

Source: Linters/SAST tools

AGENTS.md (1)

21-30: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Tag the remaining bare fences.

These blocks still trip MD040. Please add explicit language tags (text, bash, etc.) so the examples render consistently.

Also applies to: 69-74, 178-183

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@AGENTS.md` around lines 21 - 30, The documentation examples still contain
bare fenced code blocks that trigger MD040. Update the fenced blocks in
AGENTS.md under the listed section blocks so each fence has an explicit language
tag such as text or bash, and apply the same fix to the other remaining bare
fences noted in the comment. Keep the surrounding example content unchanged and
ensure the fenced blocks under the storage/client/CLI sections are consistently
tagged.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Duplicate comments:
In `@AGENTS.md`:
- Around line 21-30: The documentation examples still contain bare fenced code
blocks that trigger MD040. Update the fenced blocks in AGENTS.md under the
listed section blocks so each fence has an explicit language tag such as text or
bash, and apply the same fix to the other remaining bare fences noted in the
comment. Keep the surrounding example content unchanged and ensure the fenced
blocks under the storage/client/CLI sections are consistently tagged.

In `@ARCHITECTURE.md`:
- Around line 1059-1070: The recovery steps in the snapshot restore section
should not present `--force-new-cluster` as the standard way to start the
restored member. Update the instructions around the `snapshot restore` and
`etcd` startup steps so the restored member is started normally by default, and
mention `--force-new-cluster` only as an exceptional fallback if needed.
- Around line 150-173: The EtcdServer sketch in Architecture documentation is
still using placeholder types and fields instead of the real struct layout from
EtcdServer in server.go. Update the documented members to match the actual
EtcdServer definition exactly, including the correct field names and types for
raft, storage, cluster state, configuration, lease, and apply components, so the
reference stays authoritative and in sync with the code.
- Around line 788-805: Qualify the Watch Guarantees section in ARCHITECTURE.md
so it no longer states unconditional reliability. Update the guarantee text to
reflect that watches preserve order and resumability, but may be canceled by
compaction or slow consumer handling, requiring clients to resume from a
revision; keep the wording aligned with the Watch Guarantees and Slow Consumer
Handling sections.
- Around line 56-102: The architecture document still contains bare fenced
blocks that trigger MD040 and inconsistent rendering. Update the affected fences
around the etcd cluster diagram and the other listed sections by adding an
explicit language tag that matches the content, using text for diagrams and the
appropriate code language for any actual snippets. Keep the existing content
intact and make sure each fence is clearly labeled so the markdown linter stops
flagging them.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: openshift/coderabbit/.coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 70734fd5-c535-4179-b634-a516c6b59d78

📥 Commits

Reviewing files that changed from the base of the PR and between 70889660acd6d0e762d06cb5b5b414c50eeb8e88 and 1bcee55.

📒 Files selected for processing (4)
  • AGENTS.md
  • ARCHITECTURE.md
  • CLAUDE.md
  • CONTRIBUTING.md
✅ Files skipped from review due to trivial changes (2)
  • CLAUDE.md
  • CONTRIBUTING.md

@openshift-ci

openshift-ci Bot commented Jun 26, 2026

Copy link
Copy Markdown

@sandeepknd: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/upstream-integration 1bcee55 link false /test upstream-integration
ci/prow/upstream-e2e 1bcee55 link false /test upstream-e2e
ci/prow/e2e-aws-ovn 1bcee55 link true /test e2e-aws-ovn

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@hasbro17

Copy link
Copy Markdown

@sandeepknd Sorry just getting around to this but I think a very useful piece that's missing in these context docs is an overview of the more permanent downstream patches that make openshift/etcd different from upstream.

E.g the whole workflow around discover-etcd-initial cluster and how it helps us bootstrap is something that's not well documented.
https://github.com/openshift/etcd/tree/main/openshift-tools/discover-etcd-initial-cluster

And there's other ones around learner flags/env vars that we've set.

The current architecture is largely just an overview of how upstream etcd works.

Let me know if you want to add that or I can take over this PR as well if not.

@sandeepknd

Copy link
Copy Markdown
Author

Hi @hasbro17 ,
Sure, please feel free to take it over as you would be able to better depict the intricacies of the downstream etcd.

@hasbro17

hasbro17 commented Sep 2, 2026

Copy link
Copy Markdown

Replaced by #411

@hasbro17 hasbro17 closed this Sep 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

jira/valid-reference Indicates that this PR references a valid Jira ticket of any type.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants