Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 49 additions & 8 deletions .coderabbit.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,70 @@
# # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
# language: "en-US"

# tone_instructions: |
# Senior Engineer & Security Specialist. Review for: 1. Security (no leaks, URL/port validation). 2. Performance (prefer Promise.allSettled). 3. TUI/UX (intuitive CLI flows, handle cancellations). 4. Tests (full vitest coverage for new logic).

# reviews:
# profile: "assertive"
# high_level_summary: true
# auto_review:
# enabled: true
# drafts: false

# path_filters:
# - "!dist/**"
# - "!node_modules/**"
# - "!package-lock.json"
# - "src/**"
# - ".github/workflows/**"

# path_instructions:
# - path: "src/commands/**/*.ts"
# instructions: |
# - Verify that all commands follow the modular registration pattern.
# - Ensure errors are handled gracefully and logged using the project's logger.
# - For TUI interactions, verify that `@vr_patel/tui` tools are used correctly.
# - path: "src/utils/config.ts"
# instructions: |
# - Ensure configuration keys are type-safe.
# - Verify that sensitive information is not stored in plain text if possible.
# - path: "src/__tests__/**/*.ts"
# instructions: |
# - Ensure mocks are clean and shared correctly.
# - Verify that tests cover both happy paths and error conditions.

# pre_merge_checks:
# linked_issue_assessment:
# mode: "warning"


# updated

# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

language: "en-US"

tone_instructions: |
Senior Engineer & Security Specialist. Review for: 1. Security (no leaks, URL/port validation). 2. Performance (prefer Promise.allSettled). 3. TUI/UX (intuitive CLI flows, handle cancellations). 4. Tests (full vitest coverage for new logic).
# ✅ Fix: tone_instructions was > 250 characters, causing a parse error
# and falling back to defaults on every review.
tone_instructions: "Senior Engineer. Review for: security (no leaks, validate inputs), performance (prefer Promise.allSettled), TUI/UX (handle cancellations), and full vitest test coverage."

reviews:
profile: "assertive"
high_level_summary: true
auto_review:
enabled: true
drafts: false

path_filters:
- "!dist/**"
- "!node_modules/**"
- "!package-lock.json"
- "src/**"
- ".github/workflows/**"

path_instructions:
- path: "src/commands/**/*.ts"
instructions: |
- Verify that all commands follow the modular registration pattern.
- Ensure errors are handled gracefully and logged using the project's logger.
- For TUI interactions, verify that `@vr_patel/tui` tools are used correctly.
- path: "src/utils/config.ts"
instructions: |
- Ensure configuration keys are type-safe.
Expand All @@ -33,6 +74,6 @@ reviews:
- Ensure mocks are clean and shared correctly.
- Verify that tests cover both happy paths and error conditions.

pre_merge_checks:
linked_issue_assessment:
mode: "warning"
pre_merge_checks:
linked_issue_assessment:
mode: "warning"
133 changes: 98 additions & 35 deletions docs/v1.2.1/health/README.md
Original file line number Diff line number Diff line change
@@ -1,91 +1,154 @@
# `kdm health` — Health Status

**Version:** v1.2.1
> **Version:** `v1.2.1`

---

## Overview

The `kdm health` command checks and reports the health status of Kubernetes pods or Docker containers. It provides insights into readiness, crash loops, and other health conditions.
The `kdm health` command checks and reports the health status of Kubernetes pods or Docker containers. It provides a clean, color-coded table with real-time status fetched directly from Docker and Kubernetes clients.

> **Fix (Issue #1):**
> This command previously returned only a placeholder message. It now displays real health data from Docker containers and Kubernetes pods.

---

## Syntax
# Syntax

```bash
kdm health <target>
```

## Parameters
---

# Parameters

| Parameter | Description | Valid Values |
|-----------|-------------|--------------|
| :--- | :--- | :--- |
| `target` | The workload type to check | `pods`, `containers`, `all` |

## Usage
---

### `kdm health pods`
# Usage

---

## `kdm health pods`

Checks the health status of all Kubernetes pods.

**Example:**
### Example

```bash
kdm health pods
```

**Expected Output:**
### Expected Output

```
Checking health for pods...
Showing health for pods...
```text
╭──────┬─────────────────────────────┬─────────┬──────────────────────────────────────╮
│ TYPE │ NAME │ HEALTH │ DETAILS │
├──────┼─────────────────────────────┼─────────┼──────────────────────────────────────┤
│ pod │ node-app-6f65c56b74-7tkvf │ Running │ namespace: default, restarts: 0 │
│ pod │ nginx-deployment-abc123 │ Failed │ namespace: production, restarts: 5 │
╰──────┴─────────────────────────────┴─────────┴──────────────────────────────────────╯
```

**Health Indicators:**
### Health Indicators

- **Ready** — Pod is running and accepting traffic.
- **Unhealthy** — Pod is running but probes are failing.
- **CrashLoopBackOff** — Pod is repeatedly crashing and restarting.
| Status Color | Meaning |
| :--- | :--- |
| 🟢 Green | `healthy`, `running`, `Running` |
| 🔴 Red | `unhealthy`, `exited`, `Failed` |
| 🟡 Yellow | Other states like `Pending`, `paused` |

**Use Cases:**
### Use Cases

- Monitor pod health in real time.
- Identify failing services before they cause outages.
- Monitor pod health in real time
- Identify failing services before outages occur

---

### `kdm health containers`
## `kdm health containers`

Checks the health status of all Docker containers.

**Example:**
### Example

```bash
kdm health containers
```

**Expected Output:**
### Expected Output

```
Checking health for containers...
Showing health for containers...
```text
╭───────────┬────────────┬─────────┬───────────────╮
│ TYPE │ NAME │ HEALTH │ DETAILS │
├───────────┼────────────┼─────────┼───────────────┤
│ container │ test-nginx │ running │ Up 8 minutes │
│ container │ my-app │ exited │ Exited (1) │
╰───────────┴────────────┴─────────┴───────────────╯
```

**Use Cases:**
### Use Cases

- Verify container health.
- Detect containers that are unhealthy or restarting.
- Verify container health
- Detect unhealthy or restarting containers

---

### `kdm health all`
## `kdm health all`

Checks health for both pods and containers in a single call.
Checks health for both pods and containers in a single command. If one source (Docker or Kubernetes) is unavailable, the other still renders successfully.

**Example:**
### Example

```bash
kdm health all
```

## Common Errors
---

### Expected Output (Kubernetes unavailable)

```text
⚠ Kubernetes unavailable: connect ECONNREFUSED 127.0.0.1:8080

╭───────────┬────────────┬─────────┬──────────────╮
│ TYPE │ NAME │ HEALTH │ DETAILS │
├───────────┼────────────┼─────────┼──────────────┤
│ container │ test-nginx │ running │ Up 8 minutes │
╰───────────┴────────────┴─────────┴──────────────╯
```

---

### Expected Output (Both available)

```text
╭───────────┬───────────────────────────┬─────────┬──────────────────────────────────────╮
│ TYPE │ NAME │ HEALTH │ DETAILS │
├───────────┼───────────────────────────┼─────────┼──────────────────────────────────────┤
│ container │ test-nginx │ running │ Up 8 minutes │
│ pod │ node-app-6f65c56b74-7tkvf │ Running │ namespace: default, restarts: 0 │
╰───────────┴───────────────────────────┴─────────┴──────────────────────────────────────╯
```

---

# Common Errors

| Error | Cause | Fix |
| :--- | :--- | :--- |
| `Unknown target` | Invalid target passed | Use `pods`, `containers`, or `all` |
| `No workloads found` | No containers or pods running | Start Docker containers or Kubernetes pods |
| `Docker unavailable` | Docker daemon not running | Run `sudo systemctl start docker` |
| `Kubernetes unavailable` | No cluster connection | Run `minikube start` or configure `kubectl` |

---

# Notes

- **Invalid target** — Use `pods`, `containers`, or `all`.
- **Docker daemon not running** — Start Docker before running `kdm health containers`.
- **Kubernetes context not found** — Run `kubectl config get-contexts` to verify your cluster connection.
- Supports both Docker and Kubernetes environments
- Displays partial results even if one backend fails
- Provides readable CLI tables for faster debugging and monitoring
Loading
Loading