You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+31-33Lines changed: 31 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,69 +4,67 @@ Kubernetes admission webhook for sticky scheduling of VM-backed pods in [cocoons
4
4
5
5
## Overview
6
6
7
-
cocoon-webhook provides two admission endpoints:
8
-
9
7
-**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
-
11
8
-**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`
12
10
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.
27
12
28
13
## Installation
29
14
15
+
### Download
16
+
30
17
Download a pre-built binary from [GitHub Releases](https://github.com/cocoonstack/cocoon-webhook/releases):
make test# vet + race-detected tests with coverage
51
-
make lint # golangci-lint for linux and darwin
52
37
```
53
38
54
-
See the [Makefile](Makefile) for the full list of targets (`make help`).
39
+
## Configuration
55
40
56
-
## Deployment
41
+
The binary expects TLS certificates and listens on `:8443`.
57
42
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 |
59
47
60
48
Package it behind a standard Kubernetes Deployment, Service, and MutatingWebhookConfiguration, or run it on a control-plane host if that fits your environment.
61
49
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
63
61
64
62
| 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)| Virtualkubelet provider managing VM lifecycle |
65
+
|[cocoon-operator](https://github.com/cocoonstack/cocoon-operator)| CocoonSet and Hibernation CRDs |
0 commit comments