From c498375ce15f9b596abd0cdb48c01f2cd4b94a93 Mon Sep 17 00:00:00 2001 From: Timofei Larkin Date: Thu, 19 Nov 2026 12:05:32 +0100 Subject: [PATCH] feat(cozyplane): bump to the v0.1.2 release Re-vendor at upstream v0.1.2. The agent now exits with a pointer to the tracking issue on a node without IPv4 or without a default route, instead of coming up unable to serve one, and the controller writes the VIP a VPC knows an attached Service by onto the Service. The wrappers now pin the release images by tag and digest. The vendored chart pins a digest only, which the repo's image tooling does not read inside a vendored chart, so the cozyplane images were never mirrored or promoted; a depth-two values.yaml is where that tooling looks. Assisted-by: LLM Signed-off-by: Timofei Larkin --- packages/system/cozyplane-apiserver/Makefile | 2 +- .../charts/cozyplane-apiserver/README.md | 174 +++++++++++++----- .../charts/cozyplane-apiserver/values.yaml | 9 +- .../system/cozyplane-apiserver/values.yaml | 3 + packages/system/cozyplane-kpr/Makefile | 2 +- packages/system/cozyplane-kpr/values.yaml | 5 +- packages/system/cozyplane/Makefile | 2 +- .../cozyplane/charts/cozyplane/README.md | 25 +-- .../cozyplane/charts/cozyplane/values.yaml | 2 +- packages/system/cozyplane/values.yaml | 5 +- 10 files changed, 163 insertions(+), 66 deletions(-) diff --git a/packages/system/cozyplane-apiserver/Makefile b/packages/system/cozyplane-apiserver/Makefile index 8500b6d97..5ec1fd33a 100644 --- a/packages/system/cozyplane-apiserver/Makefile +++ b/packages/system/cozyplane-apiserver/Makefile @@ -7,7 +7,7 @@ include ../../../hack/package.mk # The lllamnyp/cozyplane ref charts/cozyplane-apiserver is vendored from, verbatim. Keep the # three cozyplane packages on the same ref; Cozystack's settings live in this # wrapper, never in the vendored chart. -COZYPLANE_REF=a0f32e272640c6ac99d863622570bdf9677bf7ab +COZYPLANE_REF=ce771d6122df1a296ea1bfec372ddb44b5b439fc test: helm unittest . diff --git a/packages/system/cozyplane-apiserver/charts/cozyplane-apiserver/README.md b/packages/system/cozyplane-apiserver/charts/cozyplane-apiserver/README.md index 6eceba3e0..086e0d043 100644 --- a/packages/system/cozyplane-apiserver/charts/cozyplane-apiserver/README.md +++ b/packages/system/cozyplane-apiserver/charts/cozyplane-apiserver/README.md @@ -1,50 +1,138 @@ # cozyplane-apiserver Helm chart -The `sdn.cozystack.io` API group served by a real **aggregated API server** -(backed by a dedicated etcd) instead of CRDs — the design target: custom -validation, the export/peer verb checks in-server, and subresources (e.g. the -`/ports` observability subresource) beyond CRD ergonomics. +Serves the `sdn.cozystack.io` API group — the tenant kinds `VPC`, `VPCBinding`, +`VPCPeering`, `VPCGateway`, `NATGateway`, `RouteTable`, `Port`, `SecurityGroup`, +`HostFirewall`, `ServiceVIP` and `FloatingIP` — from an aggregated API server +backed by its own etcd. No chart installs CRDs for this group; this chart is the +only thing that serves it. The [cozyplane](../cozyplane) CNI chart installs only +the `local.sdn.cozystack.io` CRDs (see +[docs/api-groups.md](../../docs/api-groups.md)). -This is a **separate chart from [cozyplane](../cozyplane)** by design. cozyplane -is the CNI and must install before almost everything — including cert-manager — -while this apiserver needs cert-manager `Certificate`s (its serving cert, the -etcd PKI). Splitting lets the CNI slot stay cert-manager-free and this chart -install later, once cert-manager is up (in Cozystack: a component that -`dependsOn` cert-manager). +The chart installs: -## The takeover - -The cozyplane chart installs the group's **CRDs** (its `crds.enabled` default), -so `sdn.cozystack.io` is served — and tenancy works — from the moment the CNI -lands. Installing this chart creates an explicit `APIService` for -`v1alpha1.sdn.cozystack.io`, which **atomically replaces** the CRDs' implicit -serving of the group: from that moment every request goes to the aggregated -server and its etcd. On a fresh cluster the CRD store is empty when that happens -(tenants come later), so the takeover needs no migration. On a cluster with -existing CRD-stored objects, export them first and re-apply after — the CRD -store is not visible through the aggregated server: - -```sh -kubectl get vpcs,ports,vpcbindings,vpcpeerings,securitygroups,floatingips,servicevips -A -o yaml > sdn-backup.yaml -helm install cozyplane-apiserver ./chart/cozyplane-apiserver -n cozyplane-system -kubectl apply -f sdn-backup.yaml -kubectl -n rollout restart deploy/cozyplane-controller ds/cozyplane-agent -``` - -(Strip `resourceVersion`/`uid`/`status` on re-apply, or use `kubectl create`.) - -The final restart is load-bearing: watch streams opened against the CRD serving -survive the takeover (the kube-apiserver closes idle watches only after 30–60 -minutes), so without it the controller and agents keep watching the shadowed -CRD store. Restart **after** the import so agent startup pruning sees a -populated store and no-ops instead of tearing down live datapath state. +- the `cozyplane-apiserver` Deployment and Service; +- its etcd: an operator-managed `EtcdCluster` (default) or a built-in single-pod + etcd ([Storage](#storage)); +- cert-manager `Issuer`s and `Certificate`s for the serving certificate and the + etcd PKI; +- RBAC: delegated authentication and authorization, and the server's own + APIService registration. ## Requirements -- cert-manager (serving certificate, etcd PKI). -- For the production etcd: the aenix-io etcd-operator (`etcd.operator.enabled`), - replicated and PVC-backed. The default is a built-in single-pod etcd with - emptyDir storage — dev/evaluation only; a pod reschedule erases every - `sdn.cozystack.io` object. -- The [cozyplane](../cozyplane) chart (any order relative to it — but the CNI - normally lands first). +- Kubernetes >= 1.30. +- The [cozyplane](../cozyplane) chart, installed and its nodes Ready. The + apiserver and etcd run as default-network pods. +- cert-manager. +- For the default etcd: the aenix-io etcd-operator + (`etcd-operator.cozystack.io/v1alpha2`) and a StorageClass named `replicated`, + or another class set in `etcd.operator.storageClass`. +- For the built-in etcd: a default StorageClass, unless the etcd runs on + emptyDir. + +## Install order + +1. **cozyplane** (the CNI). It has no cert-manager dependency, so it installs + first, on a cluster with no other CNI. +2. **cert-manager**, the **etcd-operator** and the **storage layer**. These run on + the default network the CNI provides. +3. **cozyplane-apiserver** (this chart). + +```sh +helm install cozyplane ./chart/cozyplane -n cozy-cozyplane --create-namespace +# install cert-manager, the etcd-operator and a StorageClass +helm install cozyplane-apiserver ./chart/cozyplane-apiserver -n cozy-cozyplane +``` + +In Cozystack the two charts are separate PackageSources: +`packages/packagesources/networking.yaml` (the CNI, no `dependsOn`) and +`packages/packagesources/apiserver.yaml` (`dependsOn` cert-manager, the +etcd-operator and the storage layer). + +## How the group becomes available + +The chart ships no `APIService`. The server creates `v1alpha1.sdn.cozystack.io` +at startup, pointing at Service `cozyplane-apiserver`, with the cert-manager +cainjector annotation that fills its CA bundle. It re-creates or re-patches the +object every 30 seconds while it serves. + +Until that APIService is available, `sdn.cozystack.io` does not exist: creating +a `VPC` fails with `no matches for kind "VPC"`. The default network works +throughout. The cozyplane controller and agents probe discovery every 15 +seconds and start their tenant controllers and informers once the group +answers, without a restart. + +A fresh install has nothing to migrate: no CRD store for the group exists to +take over from. + +## Storage + +The aggregated API's objects live only in this chart's etcd. Losing that etcd +loses every `sdn.cozystack.io` object in the cluster. + +### Operator-managed etcd (default) + +`etcd.operator.enabled: true` creates an `EtcdCluster` named `cozyplane-etcd`. +The apiserver connects to it over mutual TLS; the etcd-operator issues the +member certificates from the chart's cert-manager issuers. + +| Value | Default | Meaning | +|-------|---------|---------| +| `etcd.operator.replicas` | `3` | etcd members | +| `etcd.operator.persistent` | `true` | `true`: one PVC per member. `false`: tmpfs, lost when the members restart | +| `etcd.operator.storageClass` | `replicated` | StorageClass of the member PVCs; `""` is the cluster default | +| `etcd.operator.size` | `4Gi` | PVC size per member, or the tmpfs cap | +| `etcd.operator.version` | `3.6.11` | etcd version the operator runs | + +The storage medium and StorageClass cannot change after the `EtcdCluster` is +created. Set them before the first install. + +### Built-in single-pod etcd + +`etcd.operator.enabled: false` runs one etcd pod instead: a Deployment and +Service named `cozyplane-etcd`, plaintext on port 2379, with no replication. Use +it where the etcd-operator is absent, such as kind. + +By default its data is on a PVC the chart creates: + +| Value | Default | Meaning | +|-------|---------|---------| +| `etcd.persistence.enabled` | `true` | create the PVC `cozyplane-etcd-data` (ReadWriteOnce) | +| `etcd.persistence.storageClassName` | `""` | StorageClass of the PVC; `""` is the cluster default | +| `etcd.persistence.size` | `2Gi` | PVC size | +| `etcd.storage` | the PVC above | the etcd data volume source | + +On a cluster with no StorageClass, put the data on an emptyDir. Every +`sdn.cozystack.io` object is then lost when the pod is deleted or rescheduled. + +```yaml +etcd: + operator: + enabled: false + persistence: + enabled: false + storage: + persistentVolumeClaim: null + emptyDir: {} +``` + +## Legacy: installs that served `sdn.cozystack.io` from CRDs + +This section applies only to clusters installed from cozyplane before +2026-07-12, when the cozyplane chart shipped the tenant kinds as CRDs and this +chart took the group over from them. No install from the current charts has +such CRDs. + +No supported migration path exists for these clusters. Two facts matter before +upgrading one: + +- The old cozyplane chart rendered the tenant CRDs as templates without + `helm.sh/resource-policy: keep`. Upgrading that release to the current chart + deletes the CRDs and every object stored in them. Export the objects first. +- Exported objects do not re-apply unchanged: `Port.spec.fabricIP` was removed + on 2026-07-13 and the `ExternalPool` kind on 2026-07-18. + +A tenant CRD that survives the upgrade breaks the group's OpenAPI, and with it +`kubectl apply` of every object in the group. The server's +`--remove-bootstrap-crds` flag deletes those CRDs at startup. The chart grants +the RBAC for it but does not set the flag. diff --git a/packages/system/cozyplane-apiserver/charts/cozyplane-apiserver/values.yaml b/packages/system/cozyplane-apiserver/charts/cozyplane-apiserver/values.yaml index c43666b31..a895267b6 100644 --- a/packages/system/cozyplane-apiserver/charts/cozyplane-apiserver/values.yaml +++ b/packages/system/cozyplane-apiserver/charts/cozyplane-apiserver/values.yaml @@ -1,7 +1,7 @@ # Container image (shared with the cozyplane chart — the apiserver binary lives # in the same image). Digest-pinned (no floating tag); keep it equal to # chart/cozyplane/values.yaml's pin. See docs/packaging.md. -image: ghcr.io/lllamnyp/cozyplane@sha256:25c209e247a65ee3d430b0a1ba4f10ca2cf066d64c2bef10fdaa9f6c0266e48a +image: ghcr.io/lllamnyp/cozyplane@sha256:0c0aff04cc029306942258a361223229766ff8fd9ae23167e7f003ce6ad5a53f imagePullPolicy: IfNotPresent imagePullSecrets: [] @@ -38,10 +38,9 @@ etcd: storageClass: "replicated" # Built-in single-pod etcd (dev/evaluation only). image: registry.k8s.io/etcd:3.5.16-0 - # Storage for the built-in single-pod etcd. Default is a PVC — the aggregated - # API's objects (VPCs, Ports, policies) are cluster state, and an emptyDir - # loses them on a pod move. Set `emptyDir: {}` explicitly for a throwaway - # cluster with no storage class. + # Storage for the built-in single-pod etcd. Default is a PVC: an emptyDir + # loses every object on a pod move. For emptyDir, set `persistentVolumeClaim: + # null`, `emptyDir: {}` and `persistence.enabled: false` (README.md § Storage). storage: persistentVolumeClaim: claimName: cozyplane-etcd-data diff --git a/packages/system/cozyplane-apiserver/values.yaml b/packages/system/cozyplane-apiserver/values.yaml index ef004844b..71e1c1ca4 100644 --- a/packages/system/cozyplane-apiserver/values.yaml +++ b/packages/system/cozyplane-apiserver/values.yaml @@ -1,4 +1,7 @@ cozyplane-apiserver: + # The cozyplane release's image by tag and digest, for mirroring and + # promotion; the vendored chart pins a digest only. + image: ghcr.io/lllamnyp/cozyplane:v0.1.2@sha256:0fbf42fca2f65fc500a0b48738ee321c483246952fc013d249b6bb27445cc19f # The aggregated apiserver backs every tenant's SDN API. replicas: 2 etcd: diff --git a/packages/system/cozyplane-kpr/Makefile b/packages/system/cozyplane-kpr/Makefile index 63acf012d..e6d00b6d4 100644 --- a/packages/system/cozyplane-kpr/Makefile +++ b/packages/system/cozyplane-kpr/Makefile @@ -7,7 +7,7 @@ include ../../../hack/package.mk # The lllamnyp/cozyplane ref charts/cozyplane-kpr is vendored from, verbatim. Keep the # three cozyplane packages on the same ref; Cozystack's settings live in this # wrapper, never in the vendored chart. -COZYPLANE_REF=a0f32e272640c6ac99d863622570bdf9677bf7ab +COZYPLANE_REF=ce771d6122df1a296ea1bfec372ddb44b5b439fc test: helm unittest . diff --git a/packages/system/cozyplane-kpr/values.yaml b/packages/system/cozyplane-kpr/values.yaml index 14e04284c..3a5138719 100644 --- a/packages/system/cozyplane-kpr/values.yaml +++ b/packages/system/cozyplane-kpr/values.yaml @@ -1 +1,4 @@ -cozyplane-kpr: {} +cozyplane-kpr: + # The cozyplane release's image by tag and digest, for mirroring and + # promotion; the vendored chart pins a digest only. + image: ghcr.io/lllamnyp/cozyplane-kpr:v0.1.2@sha256:39cd8391952c951c050fe818e4e9a0f83deb10caef20741093e39cea54f4ce01 diff --git a/packages/system/cozyplane/Makefile b/packages/system/cozyplane/Makefile index c303af2c0..d3eabb19a 100644 --- a/packages/system/cozyplane/Makefile +++ b/packages/system/cozyplane/Makefile @@ -7,7 +7,7 @@ include ../../../hack/package.mk # The lllamnyp/cozyplane ref charts/cozyplane is vendored from, verbatim. Keep the # three cozyplane packages on the same ref; Cozystack's settings live in this # wrapper, never in the vendored chart. -COZYPLANE_REF=a0f32e272640c6ac99d863622570bdf9677bf7ab +COZYPLANE_REF=ce771d6122df1a296ea1bfec372ddb44b5b439fc test: helm unittest . diff --git a/packages/system/cozyplane/charts/cozyplane/README.md b/packages/system/cozyplane/charts/cozyplane/README.md index 6a044774e..368a03dbf 100644 --- a/packages/system/cozyplane/charts/cozyplane/README.md +++ b/packages/system/cozyplane/charts/cozyplane/README.md @@ -2,8 +2,8 @@ Packages cozyplane — a multi-tenant eBPF CNI (flat default network + VPC tenancy + VPC peering) — as the node agent DaemonSet, the controller -Deployment, the `local.sdn.cozystack.io` CRDs (underlay IPAM), RBAC, and the -VPCBinding `export` admission policy. The tenant API is not here: the +Deployment, the `local.sdn.cozystack.io` CRDs, RBAC, and the VPCBinding +`export` admission policy. The tenant API is not here: the `sdn.cozystack.io` group is served only by the separate [cozyplane-apiserver](../cozyplane-apiserver) chart. @@ -28,16 +28,17 @@ for the tenancy model. helm install cozyplane ./chart/cozyplane --namespace cozy-cozyplane --create-namespace ``` -This chart installs the CNI and the `local.sdn.cozystack.io` group -(`FabricIP` — underlay IPAM, which has to work before cert-manager, etcd and -cozyplane's own apiserver, all of which are default-network pods). +This chart installs the CNI and the CRDs of the `local.sdn.cozystack.io` group: +`FabricIP`, the underlay IPAM, which has to work before cert-manager, etcd and +cozyplane's own apiserver, all of which are default-network pods; and +`NATPortBlock`, the per-node port-block leases of NAT gateways. -The tenant kinds — `VPC`, `Port`, `SecurityGroup`, `HostFirewall` and the rest of -`sdn.cozystack.io` — have no CRDs and are served only by +The tenant kinds — `VPC`, `Port`, `SecurityGroup`, `HostFirewall` and the rest +of `sdn.cozystack.io` — have no CRDs and are served only by [cozyplane-apiserver](../cozyplane-apiserver), so install that chart too for -tenancy. The two groups are deliberately separate: serving one group through -both a CRD and an APIService collides the kube-apiserver's OpenAPI merge, after -which `kubectl apply` fails for every object in the group. See +tenancy, after cert-manager. The two groups are separate because serving one +group through both a CRD and an APIService collides the kube-apiserver's OpenAPI +merge, after which `kubectl apply` fails for every object in the group. See [docs/api-groups.md](../../docs/api-groups.md). ## Configuration @@ -66,8 +67,8 @@ most likely to set: and CNI binary installer, one per node. - `cozyplane-controller` (Deployment): assigns VNIs, reaps Ports on VPCBinding revocation, and maintains VPCPeering status. -- The `local.sdn.cozystack.io` CRDs: `fabricips`. The tenant kinds - (`vpcs`, `ports`, `securitygroups`, …) are served by +- The `local.sdn.cozystack.io` CRDs: `fabricips` and `natportblocks`. The + tenant kinds (`vpcs`, `ports`, `securitygroups`, …) are served by [cozyplane-apiserver](../cozyplane-apiserver), not by this chart. - RBAC for both components, the aggregated tenant roles (`cozyplane-tenant-edit` / `-view`, docs/multitenancy.md), and the export diff --git a/packages/system/cozyplane/charts/cozyplane/values.yaml b/packages/system/cozyplane/charts/cozyplane/values.yaml index 8b1768081..5332a2f72 100644 --- a/packages/system/cozyplane/charts/cozyplane/values.yaml +++ b/packages/system/cozyplane/charts/cozyplane/values.yaml @@ -2,7 +2,7 @@ # Digest-pinned (no floating tag). Built and published by .github/workflows/ # release.yml on every push to main; see docs/packaging.md for how the digest is # refreshed and why pinning it does not change it. -image: ghcr.io/lllamnyp/cozyplane@sha256:25c209e247a65ee3d430b0a1ba4f10ca2cf066d64c2bef10fdaa9f6c0266e48a +image: ghcr.io/lllamnyp/cozyplane@sha256:0c0aff04cc029306942258a361223229766ff8fd9ae23167e7f003ce6ad5a53f imagePullPolicy: IfNotPresent imagePullSecrets: [] diff --git a/packages/system/cozyplane/values.yaml b/packages/system/cozyplane/values.yaml index e37e57325..6c6d7dfe1 100644 --- a/packages/system/cozyplane/values.yaml +++ b/packages/system/cozyplane/values.yaml @@ -1 +1,4 @@ -cozyplane: {} +cozyplane: + # The cozyplane release's image by tag and digest, for mirroring and + # promotion; the vendored chart pins a digest only. + image: ghcr.io/lllamnyp/cozyplane:v0.1.2@sha256:0fbf42fca2f65fc500a0b48738ee321c483246952fc013d249b6bb27445cc19f