Skip to content

Commit 599339f

Browse files
uw-scclaude
andauthored
feat(helm): deploy O3K on Kubernetes — single-node & multi-node chart (SPEC-008) (#54)
* docs(spec): add SPEC-007 implementation plan Plan the two Helm prerequisites — admin-password bootstrap (WS-2) and configurable catalog scheme (WS-3) — against the codebase. No schema migration, no new dependencies, no OpenStack API shape change; all constitution gates pass. Artifacts (docs/specs/007-helm-prereqs-bootstrap-catalog/): - plan.md technical context, constitution check, project structure - research.md R1-R8 implementation decisions with rationale/alternatives - data-model.md existing entities/seed IDs touched; provisioning state machine - contracts/ observable contracts (auth C1, catalog scheme C2) -> SPEC-000 - quickstart.md manual verification for every WS-2/WS-3 case Key decisions: - WS-2: internal/keystone/bootstrap.go, called from main.go after MigrateUp. First-boot seed (write-once via bcrypt-compare), reuse HashPassword, custom user -> create + admin-role grant on default project + domain_id, neutralize seeded admin (enabled=false); concurrency-safe via ON CONFLICT / optimistic UPDATE. - WS-3: shared internal/common scheme helper (EndpointScheme/ForceScheme) applied to the Keystone catalog AND common.BaseURL self-links; presentation-time, default http, warn-and-default on invalid. Spec refinements from planning (Clarifications Session 2026-06-08): - FR-013a: O3K_ENDPOINT_SCHEME also governs self-link/pagination URLs. - TLS exposure model: the chart must terminate TLS per service port (port-based); single-:443 path/subdomain ingress is out of scope. Spec: docs/specs/007-helm-prereqs-bootstrap-catalog/spec.md Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Uwe Schwaeke <uwe.schwaeke@clyso.com> * docs(spec): add SPEC-007 task breakdown Add the dependency-ordered, test-first task list for the two Helm prerequisites, plus two small spec wording fixes surfaced during cross-artifact analysis. tasks.md (new): 19 tasks across Setup, Foundational, US1 (admin-password bootstrap — MVP), US2 (configurable catalog scheme), and Polish. Tests lead each story (Constitution Article III). Covers concurrency (FR-008a/SC-009), project isolation (FR-007), permissive password validation (FR-006a), and a test-DB harness (T002). spec.md: - Pin the no-password (FR-006) and invalid-scheme (FR-014) warnings to WARN log level. - Normalize clarification dates to 2026-06-08 and merge the two same-day Clarifications sessions into one. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Uwe Schwaeke <uwe.schwaeke@clyso.com> * docs(spec): add SPEC-008 Helm charts specification Single in-repo Helm chart to deploy O3K on Kubernetes in single-node and multi-node modes (one chart, mode selector), capturing user stories, functional requirements, edge cases, and success criteria, plus the spec quality checklist. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Uwe Schwaeke <uwe.schwaeke@clyso.com> * docs(spec): add SPEC-008 implementation plan Phase 0/1 planning artifacts for the O3K Helm chart: plan.md, research.md (design decisions), data-model.md (the values.yaml schema), contracts/ (values, rendered-resource, and helm-test contracts), and quickstart.md. Single-node stub (plus optional TLS) is the validated MVP; real-mode and multi-node templates are authored with end-to-end validation deferred to the post-conditions (issue #52). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Uwe Schwaeke <uwe.schwaeke@clyso.com> * docs(spec): add SPEC-008 task breakdown Dependency-ordered tasks for the O3K Helm chart: 35 tasks across setup, foundational, and the three user stories (US1 single-node stub MVP, US2 multi-node, US3 day-2 ops), plus polish. Config is delivered via a Secret-backed o3k.yaml; real-mode and multi-node end-to-end validation is gated on the post-conditions (issue #52). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Uwe Schwaeke <uwe.schwaeke@clyso.com> * feat(helm): add O3K Helm chart — single-node MVP (SPEC-008 US1) In-repo chart at charts/o3k deploying the O3K single binary to Kubernetes. Covers Setup + Foundational + User Story 1 (single-node, stub mode, optional TLS) — the validated MVP per SPEC-008: - one chart with a deploymentMode selector; Deployment for single-node - config delivered via a Secret-backed o3k.yaml (binary has no per-key env layer) - fail-fast install gates: required image/jwt/admin/db (FR-007/007a/006/018), TLS-without-cert, multi-node-real local backend (FR-012e), cache-without-redis (FR-006a) - optional per-service-port TLS sets the https catalog scheme (FR-008b); helm test identity hook (FR-015) - real-mode templates authored (privileged/hostNetwork/hostPath/PSA); real-mode and multi-node end-to-end validation deferred to the post-conditions (issue #52) - reference image adds dnsmasq for real-mode DHCP (FR-012f) Validated with helm lint + helm template (renders + gates fire). helm-unittest specs and a kind smoke script are included; native execution pending plugin/cluster. Marks SPEC-008 tasks T001-T017 complete. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Uwe Schwaeke <uwe.schwaeke@clyso.com> * feat(helm): add multi-node DaemonSet (SPEC-008 US2) Multi-node deployment for the O3K chart: - templates/daemonset.yaml: one instance per designation-labeled node, RollingUpdate - _helpers.tpl: shared o3k.podSpec used by both the Deployment and the DaemonSet (deployment.yaml reworked to use it, so container/config/probes/real-mode stay identical) - multi-node sets neutron.vxlan_enabled and the o3k.io/compute nodeSelector - helm-unittest specs: multi-node render + storage (FR-012e) and cache (FR-006a) gates - test/helm_multinode_test.sh: e2e hookup, gated off until the post-conditions (issue #52) - NOTES: node labeling, minProductVersion (FR-010), floating-IP pool routing (FR-009c) Cross-node VM lifecycle (SC-003/SC-004) and real-mode VM usability remain deferred to the post-conditions (WS-1/4/5/6, issue #52); the DaemonSet deploys now. Validated with helm lint + helm template (multi-node DaemonSet renders; gates fire). Marks T018-T025. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Uwe Schwaeke <uwe.schwaeke@clyso.com> * docs(helm): add chart README and day-2/isolation tests (SPEC-008 US3) Day-2 operations for the O3K chart: - charts/o3k/README.md: complete values reference (purpose, default, applicable mode for every value — FR-017/SC-007), install/upgrade/uninstall/retention, multi-release, and testing sections - tests/release_isolation_test.yaml: all resources release-prefixed (FR-016) - test/helm_upgrade_uninstall_test.sh: config change applied on upgrade (SC-005), no orphaned workloads after uninstall (SC-006), data retention documented (FR-014) Upgrade semantics were already in the templates (Recreate for single-node real, DaemonSet RollingUpdate, config-checksum pod roll); this story documents and tests them. Marks SPEC-008 tasks T026-T031 complete. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Uwe Schwaeke <uwe.schwaeke@clyso.com> * docs(helm): polish — OpenShift/MetalLB recipes and env-var doc correction (SPEC-008) - charts/o3k/README.md: OpenShift SCC instructions for privileged real mode (FR-012d) and the MetalLB / routed-subnet floating-IP routing recipe (FR-009c) - docs/CONFIGURATION.md: remove the documented-but-unimplemented O3K_<SECTION>_<KEY> env convention; the binary honors exactly four env vars (O3K_DB_URL, O3K_JWT_SECRET, O3K_ENDPOINT_HOST, O3K_ENDPOINT_SCHEME) — everything else is config-file only. Fixed the admin-credentials and rate-limiting sections that relied on it. - tasks.md: mark T032/T033; record the T035 final-gate result (lint + 17/17 render/gate permutation matrix passed; helm-unittest and the quickstart e2e remain environment-gated) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Uwe Schwaeke <uwe.schwaeke@clyso.com> * docs(spec): mark T034 — quickstart smoke passed on minikube (SPEC-008) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: Uwe Schwaeke <uwe.schwaeke@clyso.com> * docs(spec): defer uninstall teardown to issue #53 (SPEC-008) The active purge on uninstall — the blocking pre-delete cleanup hook that removes network namespaces/routes, libvirt domains, orphaned storage, and the PVCs Helm does not delete by default (the `dataRetentionPolicy: delete` path) — is out of scope for SPEC-008 and tracked in issue #53. In scope here: plain `helm uninstall` removing release workloads (SC-006) and the default `retain`. FR-014, T027/T029, and the `dataRetentionPolicy` value annotated accordingly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Uwe Schwaeke <uwe.schwaeke@clyso.com> * fix(helm): address PR #54 review comments + sync docs (SPEC-008) Review by @senolcolak: - _helpers.tpl: drop the dead "REPLACE_ME" database.url placeholder; renders "" when unset (#1). - deployment.yaml + daemonset.yaml: gate the whole `annotations:` block (the checksum/config hash) on `not secrets.existingSecret` — the chart can't hash a Secret it doesn't render, and an empty annotations key is invalid (#2, #3). - _helpers.tpl + values.yaml: wire `database.existingSecret` — inject O3K_DB_URL via secretKeyRef (+ `database.existingSecretKey`, default "url"); fix the misleading value comment. Add `automountServiceAccountToken: false` (O3K never calls the k8s API) (#4). - ingress.yaml + values: never render an empty `tls` secretName — derive `<release>-o3k-tls` when unset — and emit a kind-aware cert-manager annotation via new `tls.certManagerKind` (ClusterIssuer|Issuer); schema + ingress_test.yaml added (#5). - NOTES.txt: `kubectl rollout status` targets ds/ in multi-node, deploy/ in single-node (#6). - README.md: sync docs to the above — document database.existingSecretKey and tls.certManagerKind, the derived tls secret name + cert-manager annotation, the existing-Secret checksum caveat, automountServiceAccountToken, and that dataRetentionPolicy=delete is deferred to #53. helm lint clean; helm unittest 7 suites / 28 tests green. Signed-off-by: Uwe Schwaeke <uwe.schwaeke@clyso.com> * test(helm): unittests for PR #54 review fixes + chart-test target Pin the PR #54 review fixes that were otherwise unprotected by tests: - config_render_test.yaml database.url carries the supplied value, no REPLACE_ME default (C1) - config_checksum_test.yaml checksum/config present by default, omitted with secrets.existingSecret (C2/C3) - db_existingsecret_test.yaml O3K_DB_URL secretKeyRef from database.existingSecret + automountServiceAccountToken:false (C4) - notes_test.yaml NOTES rollout targets ds/ (multi-node) vs deploy/ (single-node) (C6) (C5 was already covered by ingress_test.yaml.) Makefile: install-tools now also installs Helm + the helm-unittest plugin (idempotent), and a new chart-test target runs charts/o3k/ci/run-tests.sh (lint + template + unittest). Wired into test-all, .PHONY, and help. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Signed-off-by: Uwe Schwaeke <uwe.schwaeke@clyso.com> --------- Signed-off-by: Uwe Schwaeke <uwe.schwaeke@clyso.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 859d2df commit 599339f

42 files changed

Lines changed: 2762 additions & 61 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Makefile‎

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: build run test clean install-deps migrate db-up db-down build-ebpf bench bench-quick
1+
.PHONY: build run test chart-test clean install-deps install-tools migrate db-up db-down build-ebpf bench bench-quick
22

33
# Build variables
44
BINARY_NAME=o3k
@@ -82,8 +82,15 @@ test-errors:
8282
@curl -s http://localhost:35357/v3 > /dev/null || (echo "ERROR: O3K not running." && exit 1)
8383
@bash test/error_handling_test.sh
8484

85-
# Run all tests (unit + contract + integration + performance)
86-
test-all: test test-contract test-integration test-multi-tenant test-errors test-performance
85+
# Run Helm chart tests (helm lint + template + unittest; no cluster or running O3K needed)
86+
chart-test:
87+
@echo "Running Helm chart tests (lint + template + unittest)..."
88+
@command -v helm >/dev/null 2>&1 || (echo "ERROR: helm not found. Run 'make install-tools' first." && exit 1)
89+
@helm plugin list 2>/dev/null | grep -q '^unittest' || (echo "ERROR: helm-unittest plugin not found. Run 'make install-tools' first." && exit 1)
90+
@bash charts/o3k/ci/run-tests.sh
91+
92+
# Run all tests (unit + chart + contract + integration + performance)
93+
test-all: test chart-test test-contract test-integration test-multi-tenant test-errors test-performance
8794
@echo ""
8895
@echo "All tests completed!"
8996

@@ -146,11 +153,24 @@ lint:
146153
@echo "Linting code..."
147154
go tool golangci-lint run ./...
148155

149-
# Install development tools
156+
# Install development tools (Go tools + Helm + the helm-unittest plugin for chart tests)
150157
install-tools:
151158
@echo "Installing development tools..."
152159
go install github.com/air-verse/air@latest
153160
go install -tags 'postgres' github.com/golang-migrate/migrate/v4/cmd/migrate@latest
161+
@echo "Checking Helm CLI..."
162+
@if command -v helm >/dev/null 2>&1; then \
163+
echo " helm present: $$(helm version --short)"; \
164+
else \
165+
echo " helm not found - installing via the official get-helm-3 script (may prompt for sudo)..."; \
166+
curl -fsSL https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash; \
167+
fi
168+
@echo "Installing/updating the helm-unittest plugin (for 'helm unittest charts/o3k')..."
169+
@if helm plugin list 2>/dev/null | grep -q '^unittest'; then \
170+
helm plugin update unittest; \
171+
else \
172+
helm plugin install https://github.com/helm-unittest/helm-unittest; \
173+
fi
154174

155175
# Install eBPF development tools (Linux only)
156176
install-ebpf-tools:
@@ -178,6 +198,7 @@ help:
178198
@echo " test-multi-tenant - Run multi-tenancy isolation tests"
179199
@echo " test-performance - Run performance and load tests"
180200
@echo " test-errors - Run error handling tests"
201+
@echo " chart-test - Run Helm chart tests (lint + template + unittest; no cluster)"
181202
@echo " test-all - Run all test suites"
182203
@echo " clean - Remove build artifacts"
183204
@echo " install-deps - Install Go dependencies"
@@ -187,5 +208,5 @@ help:
187208
@echo " dev - Run with hot reload (requires air)"
188209
@echo " fmt - Format code"
189210
@echo " lint - Lint code"
190-
@echo " install-tools - Install development tools"
211+
@echo " install-tools - Install dev tools (Go tools + Helm + helm-unittest plugin)"
191212
@echo " install-ebpf-tools - Install eBPF development tools (Linux only)"

‎build/package/Dockerfile‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ RUN apk add --no-cache \
3636
tzdata \
3737
iproute2 \
3838
iptables \
39-
ipset
39+
ipset \
40+
dnsmasq
4041

4142
# Create non-root user (but will run as root in privileged mode for networking)
4243
RUN addgroup -g 1000 o3k && \

‎charts/o3k/.helmignore‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Patterns to ignore when packaging the chart.
2+
.git/
3+
.gitignore
4+
.DS_Store
5+
*.tmp
6+
*.swp
7+
*.bak
8+
# helm-unittest specs live at the chart root under /tests (not templates/tests).
9+
/tests/
10+
ci/

‎charts/o3k/Chart.yaml‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: v2
2+
name: o3k
3+
description: Deploy O3K (lightweight OpenStack-compatible cloud) on Kubernetes — single-node and multi-node modes from one chart.
4+
type: application
5+
# Chart version (SemVer). Bumped independently of the product.
6+
version: 0.1.0
7+
# Default product image tag when image.tag is unset (image.repository is REQUIRED, no default — FR-018).
8+
appVersion: "0.7.0"
9+
kubeVersion: ">=1.25.0-0"
10+
home: https://github.com/cobaltcore-dev/o3k
11+
sources:
12+
- https://github.com/cobaltcore-dev/o3k
13+
keywords:
14+
- openstack
15+
- o3k
16+
- iaas
17+
maintainers:
18+
- name: O3K maintainers
19+
url: https://github.com/cobaltcore-dev/o3k

‎charts/o3k/README.md‎

Lines changed: 212 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,212 @@
1+
# O3K Helm Chart
2+
3+
Deploy [O3K](https://github.com/cobaltcore-dev/o3k) — a lightweight, OpenStack-compatible
4+
cloud in a single binary — on Kubernetes, in **single-node** or **multi-node** mode from
5+
one chart.
6+
7+
> **Scope.** The validated deliverable is **single-node, stub mode (plus optional TLS)** —
8+
> the MVP. Real-mode and multi-node templates are authored and render/lint-clean, but their
9+
> end-to-end behavior (VM login, floating IPs, cross-node traffic, networking surviving
10+
> restarts) depends on product post-conditions tracked in
11+
> [issue #52](https://github.com/cobaltcore-dev/o3k/issues/52) and is **not yet functional**.
12+
13+
## Prerequisites
14+
15+
- Kubernetes **≥ 1.25** (PodSecurity Admission GA) or k3s; Helm **≥ 3.12**.
16+
- A reachable **external PostgreSQL** — the chart deploys no database (FR-006).
17+
- An **O3K container image** — required, no default (FR-018).
18+
- Real mode only: Linux nodes with a running host `libvirtd` + qemu/KVM, and an image that
19+
includes `dnsmasq` (the reference Dockerfile does).
20+
21+
## Install
22+
23+
```bash
24+
helm install o3k ./charts/o3k \
25+
--set image.repository=<registry>/o3k \
26+
--set image.tag=<tag> \
27+
--set database.url='postgres://o3k:<pw>@<host>:5432/o3k?sslmode=disable' \
28+
--set secrets.jwtSecret='<strong-random>' \
29+
--set secrets.adminPassword='<non-default-admin-pw>'
30+
```
31+
32+
Installation **fails fast** with a clear message if `image.repository`, the token secret,
33+
the admin password, or the database URL is missing — there are no insecure defaults.
34+
35+
Then: `kubectl rollout status deploy/o3k-o3k` and `helm test o3k`.
36+
37+
## Configuration values
38+
39+
Defaults target the single-node stub MVP. "Mode" = where the value applies.
40+
41+
### Image & mode
42+
| Key | Default | Mode | Purpose |
43+
|-----|---------|------|---------|
44+
| `image.repository` | `""` **(required)** | all | container image — no default (FR-018) |
45+
| `image.tag` | `""` → `Chart.appVersion` | all | image tag |
46+
| `image.pullPolicy` | `IfNotPresent` | all | |
47+
| `image.pullSecrets` | `[]` | all | image pull secrets |
48+
| `deploymentMode` | `single-node` | all | `single-node` (Deployment) or `multi-node` (DaemonSet) |
49+
| `replicaCount` | `1` | single-node | stub replicas (real forces 1) |
50+
51+
### Database & secrets (required)
52+
| Key | Default | Mode | Purpose |
53+
|-----|---------|------|---------|
54+
| `database.url` | `""` **(required)** | all | external PostgreSQL URL |
55+
| `database.existingSecret` | `""` | all | Secret holding the DB URL (alternative to `database.url`); injected as `O3K_DB_URL` |
56+
| `database.existingSecretKey` | `url` | all | key within `database.existingSecret` that holds the URL |
57+
| `secrets.jwtSecret` | `""` **(required)** | all | token signing secret |
58+
| `secrets.adminUser` | `admin` | all | admin account name |
59+
| `secrets.adminPassword` | `""` **(required)** | all | admin password (no `admin/secret`) |
60+
| `secrets.existingSecret` | `""` | all | pre-rendered Secret with an `o3k.yaml` key (GitOps) |
61+
62+
> Config (including credentials) is rendered into a **Secret** mounted at the binary's
63+
> `--config` path — the binary has no per-key env override for most settings, so they are
64+
> not injectable via individual env vars. The pod also sets
65+
> `automountServiceAccountToken: false` (O3K never calls the Kubernetes API).
66+
67+
### Exposure & TLS
68+
| Key | Default | Mode | Purpose |
69+
|-----|---------|------|---------|
70+
| `endpointHost` | `""` | all | advertised catalog host (`O3K_ENDPOINT_HOST`) |
71+
| `service.type` | `ClusterIP` | all | `ClusterIP`/`NodePort`/`LoadBalancer` |
72+
| `service.annotations` | `{}` | all | e.g. LoadBalancer annotations |
73+
| `ingress.enabled` / `className` / `annotations` / `hosts` | `false` / … | all | external Ingress |
74+
| `tls.enabled` | `false` | all | per-service-port TLS; sets the `https` catalog scheme |
75+
| `tls.secretName` | `""` → `<release>-o3k-tls` | all | cert Secret; defaults to `<release>-o3k-tls` when unset |
76+
| `tls.certManagerIssuer` | `""` | all | cert-manager (Cluster)Issuer name; chart emits the annotation so the cert is provisioned |
77+
| `tls.certManagerKind` | `ClusterIssuer` | all | which cert-manager annotation: `ClusterIssuer` or `Issuer` |
78+
79+
### Service modes
80+
| Key | Default | Mode | Purpose |
81+
|-----|---------|------|---------|
82+
| `nova.libvirtMode` | `stub` | all | `stub` / `real` |
83+
| `neutron.networkingMode` | `stub` | all | `stub` / `iptables` / `ebpf` |
84+
| `neutron.securityGroupMode` | `stub` | all | `stub` / `iptables` / `ebpf` |
85+
| `cinder.storageMode` | `stub` | all | `stub` / `local` / `rbd` / `local,rbd` |
86+
| `glance.storageMode` | `stub` | all | `stub` / `local` / `rbd` / `s3` / hybrids |
87+
88+
### Real mode (privileged; e2e deferred — #52)
89+
| Key | Default | Mode | Purpose |
90+
|-----|---------|------|---------|
91+
| `realMode.enabled` | `false` | real | gate privileged pod + host mounts |
92+
| `realMode.privileged` / `hostNetwork` | `false` | real | host-level access |
93+
| `realMode.libvirtSocketPath` | `/var/run/libvirt/libvirt-sock` | real | host libvirtd socket (hostPath) |
94+
| `realMode.hostStoragePath` | `/var/lib/o3k` | real | node-local VM/volume/image data (hostPath) |
95+
| `realMode.floatingIpPool` | `""` | real | operator pool routed to nodes (FR-009c) |
96+
| `podSecurity.applyPrivilegedNamespaceLabel` | `false` | real | label the namespace `privileged` (FR-012d) |
97+
98+
### Multi-node (e2e deferred — #52)
99+
| Key | Default | Mode | Purpose |
100+
|-----|---------|------|---------|
101+
| `multiNode.nodeSelectorLabel` | `o3k.io/compute=true` | multi-node | DaemonSet node selector |
102+
| `multiNode.vxlanEnabled` | `true` | multi-node | VXLAN overlay |
103+
| `multiNode.vxlanPort` | `4789` | multi-node | node-to-node UDP |
104+
| `multiNode.minProductVersion` | `""` | multi-node | min product version (FR-010) |
105+
106+
### Cache, retention, observability
107+
| Key | Default | Mode | Purpose |
108+
|-----|---------|------|---------|
109+
| `cache.enabled` | `false` | all | opt-in Redis cache |
110+
| `cache.redisUrl` | `""` | all | **single shared** Redis in multi-node (FR-006a) |
111+
| `dataRetentionPolicy` | `retain` | all | only `retain` is active; the `delete` purge is deferred to issue #53 |
112+
| `logging.level` / `logging.format` | `info` / `json` | all | structured logs (FR-013a) |
113+
| `resources` / `nodeSelector` / `tolerations` / `affinity` | `{}`/… | all | pod scheduling |
114+
115+
## Deployment modes
116+
117+
- **Single-node** → a `Deployment`. Stub may scale (`replicaCount`); real pins one replica
118+
with `Recreate`.
119+
- **Multi-node** → a `DaemonSet` on nodes labeled `multiNode.nodeSelectorLabel`. Add capacity
120+
by labeling a node; remove the label to evict. *(Cross-node function gated on #52.)*
121+
- **stub vs real** is independent of node count. Stub needs no privileges (passes `restricted`
122+
PodSecurity). Real needs host access on the labeled/privileged nodes.
123+
124+
## TLS
125+
126+
Set `tls.enabled=true` with `ingress.enabled=true`, then either supply your own cert Secret
127+
(`tls.secretName`) or name a cert-manager issuer (`tls.certManagerIssuer`). With an issuer,
128+
the chart emits the matching annotation — `cert-manager.io/cluster-issuer` by default, or
129+
`cert-manager.io/issuer` when `tls.certManagerKind: Issuer` — and points it at `tls.secretName`
130+
(defaulting to `<release>-o3k-tls`), so cert-manager provisions the cert. The chart never
131+
generates certs itself. Either way it advertises `https://` catalog/self-link URLs
132+
(`O3K_ENDPOINT_SCHEME=https`); TLS terminates per service port.
133+
134+
## Upgrade
135+
136+
```bash
137+
helm upgrade o3k ./charts/o3k --reuse-values --set logging.level=debug
138+
```
139+
Config changes roll the pod (a config checksum annotation) — except with
140+
`secrets.existingSecret`, where the chart can't hash a Secret it doesn't render, so roll the
141+
pod yourself (`kubectl rollout restart`, or a tool like Reloader). Single-node real upgrades
142+
use `Recreate` (brief downtime); multi-node uses a DaemonSet rolling update. The external
143+
database and any networked/host storage are untouched — **no data loss** (FR-014, SC-005).
144+
145+
## Uninstall & data retention
146+
147+
```bash
148+
helm uninstall o3k
149+
```
150+
Removes all release-owned resources (Deployment/DaemonSet, Service, Secret, Ingress) — no
151+
orphans (SC-006). **Not** removed: the external database, networked backends (RBD/S3), and
152+
**node-local `hostPath` data** on each node (not Helm-managed). Today only
153+
`dataRetentionPolicy: retain` is active; the active `delete` purge (DB reset, namespaces,
154+
libvirt domains, node-local data) is deferred to [issue #53](https://github.com/cobaltcore-dev/o3k/issues/53).
155+
Until then, clean node-local data manually.
156+
157+
## Multiple releases
158+
159+
All resources are release-prefixed (`<release>-o3k-*`), so multiple releases coexist in one
160+
cluster without collision (FR-016).
161+
162+
## OpenShift (real mode)
163+
164+
OpenShift enforces SecurityContextConstraints instead of plain PodSecurity labels.
165+
`podSecurity.applyPrivilegedNamespaceLabel` has no effect there; grant the release's
166+
service account the `privileged` SCC on the target namespace (FR-012d):
167+
168+
```bash
169+
oc adm policy add-scc-to-user privileged -z default -n <namespace>
170+
```
171+
172+
Stub mode needs nothing — it runs under the default `restricted-v2` SCC.
173+
174+
## Floating-IP ingress (real mode, deferred — #52)
175+
176+
Floating IPs stay real, API-compatible OpenStack IP objects: O3K programs the DNAT on the
177+
node hosting the VM (FR-009c). Your job as operator is only to **route the pool to the
178+
nodes** (`realMode.floatingIpPool`, e.g. `192.0.2.128/25`):
179+
180+
- **MetalLB (cloud / bare metal):** announce the pool from the O3K nodes in L2 mode —
181+
182+
```yaml
183+
apiVersion: metallb.io/v1beta1
184+
kind: IPAddressPool
185+
metadata: { name: o3k-floating, namespace: metallb-system }
186+
spec:
187+
addresses: ["192.0.2.128/25"]
188+
---
189+
apiVersion: metallb.io/v1beta1
190+
kind: L2Advertisement
191+
metadata: { name: o3k-floating, namespace: metallb-system }
192+
spec:
193+
ipAddressPools: ["o3k-floating"]
194+
nodeSelectors:
195+
- matchLabels: { o3k.io/compute: "true" }
196+
```
197+
198+
- **Routed / L2 subnet (datacenter, lab):** point a static route for the pool at the
199+
node uplinks (or place the pool in the nodes' L2 segment). No MetalLB needed.
200+
201+
The chart installs neither MetalLB nor host routes; it only carries the pool value and
202+
this documentation. End-to-end floating-IP traffic additionally requires the product
203+
post-condition WS-5 (issue #52).
204+
205+
## Testing
206+
207+
```bash
208+
helm lint ./charts/o3k -f charts/o3k/ci/test-values.yaml
209+
charts/o3k/ci/run-tests.sh # lint + template + helm-unittest
210+
./test/helm_singlenode_stub_test.sh # kind/k3s smoke (needs a cluster)
211+
./test/helm_upgrade_uninstall_test.sh # day-2 scenario (needs a cluster)
212+
```

‎charts/o3k/ci/run-tests.sh‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
# SPEC-008 T004 — chart test runner (no cluster needed).
3+
# helm plugin install https://github.com/helm-unittest/helm-unittest # one-time
4+
# charts/o3k/ci/run-tests.sh
5+
set -euo pipefail
6+
CHART="$(cd "$(dirname "$0")/.." && pwd)"
7+
VALS="$CHART/ci/test-values.yaml"
8+
9+
echo "== helm lint =="
10+
helm lint "$CHART" -f "$VALS"
11+
12+
echo "== helm template (renders cleanly) =="
13+
helm template r "$CHART" -f "$VALS" >/dev/null
14+
15+
echo "== helm template: TLS + real-mode permutations render =="
16+
helm template r "$CHART" -f "$VALS" --set tls.enabled=true --set tls.secretName=c --set ingress.enabled=true >/dev/null
17+
helm template r "$CHART" -f "$VALS" --set realMode.enabled=true --set realMode.privileged=true >/dev/null
18+
19+
echo "== helm unittest (requires the helm-unittest plugin) =="
20+
helm unittest "$CHART"
21+
22+
echo "chart tests OK"

‎charts/o3k/ci/test-values.yaml‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Minimal valid values for chart lint/template in CI (not for production).
2+
image:
3+
repository: ghcr.io/o3k/o3k
4+
tag: v0.7.0
5+
secrets:
6+
jwtSecret: ci-test-jwt
7+
adminPassword: Ci-Test-Admin-1
8+
database:
9+
url: "postgres://o3k:ci@db:5432/o3k?sslmode=disable"

0 commit comments

Comments
 (0)