Skip to content

Commit dbafe08

Browse files
committed
docs: unify README format
Standardize heading order, section structure, and table format to match the cocoonstack-wide README template.
1 parent 0062a89 commit dbafe08

1 file changed

Lines changed: 31 additions & 33 deletions

File tree

README.md

Lines changed: 31 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,69 +4,67 @@ Kubernetes admission webhook for sticky scheduling of VM-backed pods in [cocoons
44

55
## Overview
66

7-
cocoon-webhook provides two admission endpoints:
8-
97
- **Mutating** (`POST /mutate`) -- on Pod CREATE, derives a stable VM name from the Deployment/ReplicaSet owner chain, looks up the previously assigned node in the `cocoon-vm-affinity` ConfigMap, and patches `spec.nodeName` so the pod returns to the same worker. Writes the `cocoon.cis/vm-name` annotation when missing.
10-
118
- **Validating** (`POST /validate`) -- on Deployment/StatefulSet UPDATE, blocks scale-down for cocoon-type workloads. Agents are stateful VMs; reducing replicas would destroy state. Use the Hibernation CRD to suspend individual agents instead.
9+
- **Health check** -- served on `GET /healthz`
1210

13-
A health check is served on `GET /healthz`.
14-
15-
## When to use
16-
17-
Recommended for:
18-
19-
- Multi-worker cocoon pools where restart affinity matters
20-
- Deployments that recreate VM-backed pods while expecting state continuity
21-
22-
Often unnecessary for:
23-
24-
- Single-worker labs
25-
- Setups that pin workloads explicitly with `nodeName`
26-
- Setups that rely only on CocoonSet (the controller handles placement)
11+
Recommended for multi-worker cocoon pools where restart affinity matters and Deployments that recreate VM-backed pods while expecting state continuity. Often unnecessary for single-worker labs, setups that pin workloads explicitly with `nodeName`, or setups that rely only on CocoonSet.
2712

2813
## Installation
2914

15+
### Download
16+
3017
Download a pre-built binary from [GitHub Releases](https://github.com/cocoonstack/cocoon-webhook/releases):
3118

3219
```bash
33-
# Download the latest release (Linux amd64)
20+
# Linux (amd64)
3421
curl -fSL -o cocoon-webhook \
3522
"https://github.com/cocoonstack/cocoon-webhook/releases/latest/download/cocoon-webhook-linux-amd64"
3623
chmod +x cocoon-webhook
3724

38-
# Or for macOS (amd64)
25+
# macOS (amd64)
3926
curl -fSL -o cocoon-webhook \
4027
"https://github.com/cocoonstack/cocoon-webhook/releases/latest/download/cocoon-webhook-darwin-amd64"
4128
chmod +x cocoon-webhook
4229
```
4330

44-
Alternatively, build from source (see below).
45-
46-
## Building
31+
### Build from source
4732

4833
```bash
34+
git clone https://github.com/cocoonstack/cocoon-webhook.git
35+
cd cocoon-webhook
4936
make build # produces ./cocoon-webhook
50-
make test # vet + race-detected tests with coverage
51-
make lint # golangci-lint for linux and darwin
5237
```
5338

54-
See the [Makefile](Makefile) for the full list of targets (`make help`).
39+
## Configuration
5540

56-
## Deployment
41+
The binary expects TLS certificates and listens on `:8443`.
5742

58-
The binary expects TLS certificates (configurable via `TLS_CERT` / `TLS_KEY` environment variables, defaulting to `/etc/cocoon/webhook/certs/tls.crt` and `tls.key`). It listens on `:8443`.
43+
| Variable | Default | Description |
44+
|---|---|---|
45+
| `TLS_CERT` | `/etc/cocoon/webhook/certs/tls.crt` | Path to TLS certificate |
46+
| `TLS_KEY` | `/etc/cocoon/webhook/certs/tls.key` | Path to TLS private key |
5947

6048
Package it behind a standard Kubernetes Deployment, Service, and MutatingWebhookConfiguration, or run it on a control-plane host if that fits your environment.
6149

62-
## Related projects
50+
## Development
51+
52+
```bash
53+
make build # build binary
54+
make test # vet + race-detected tests with coverage
55+
make lint # golangci-lint for linux and darwin
56+
make fmt # format code
57+
make help # show all targets
58+
```
59+
60+
## Related Projects
6361

6462
| Project | Role |
65-
|---------|------|
66-
| [cocoon](https://github.com/cocoonstack/cocoon) | Virtual-kubelet provider managing VM lifecycle |
67-
| cocoon-operator | CocoonSet and Hibernation CRDs |
68-
| epoch | Remote snapshot storage |
69-
| glance | Web dashboard (does not depend on this webhook) |
63+
|---|---|
64+
| [vk-cocoon](https://github.com/cocoonstack/vk-cocoon) | Virtual kubelet provider managing VM lifecycle |
65+
| [cocoon-operator](https://github.com/cocoonstack/cocoon-operator) | CocoonSet and Hibernation CRDs |
66+
| [epoch](https://github.com/cocoonstack/epoch) | Remote snapshot storage |
67+
| [glance](https://github.com/cocoonstack/glance) | Web dashboard |
7068

7169
## License
7270

0 commit comments

Comments
 (0)