|
| 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 | +``` |
0 commit comments