From 02914f60ec6d61cbb97ccabe0665eb832a36a8bb Mon Sep 17 00:00:00 2001 From: Timofei Larkin Date: Wed, 18 Nov 2026 10:50:30 +0100 Subject: [PATCH] refactor(cozyplane): vendor the charts inside wrapper charts cozyplane is an upstream project and must not carry anything Cozystack-specific, so each of the three packages now follows the umbrella pattern the rest of packages/system uses: the upstream chart lives verbatim under charts/, re-vendored by make update from a pinned ref, and every Cozystack setting lives in the wrapper. The wrapper owns the Talos overlays (KubePrism, the 00- conflist), the apiserver's etcd storage class, which the platform used to inject and the chart's own default contradicted, and the apiserver's replica count, now two since it backs every tenant's SDN API. The platform nests the egress values it threads under the cozyplane subchart key. Rendered output is unchanged apart from the replica count. The update target extracts into a temporary directory and replaces the chart only once the download has succeeded. Assisted-by: LLM Signed-off-by: Timofei Larkin --- .../platform/templates/bundles/system.yaml | 10 +- .../bundles_networking_variant_test.yaml | 29 +---- .../system/cozyplane-apiserver/Chart.yaml | 18 +-- packages/system/cozyplane-apiserver/Makefile | 24 ++-- .../cozyplane-apiserver}/.helmignore | 0 .../charts/cozyplane-apiserver/Chart.yaml | 19 +++ .../cozyplane-apiserver}/README.md | 0 .../templates/_helpers.tpl | 0 .../templates/apiserver.yaml | 0 .../templates/etcd-cluster.yaml | 0 .../charts/cozyplane-apiserver/values.yaml | 58 +++++++++ .../tests/etcd_render_test.yaml | 40 ++++-- .../system/cozyplane-apiserver/values.yaml | 69 ++-------- packages/system/cozyplane-kpr/Chart.yaml | 18 +-- packages/system/cozyplane-kpr/Makefile | 23 ++-- .../{ => charts/cozyplane-kpr}/.helmignore | 0 .../charts/cozyplane-kpr/Chart.yaml | 19 +++ .../cozyplane-kpr}/templates/daemonset.yaml | 0 .../charts/cozyplane-kpr/values-talos.yaml | 9 ++ .../charts/cozyplane-kpr/values.yaml | 29 +++++ .../tests/talos_render_test.yaml | 2 +- .../system/cozyplane-kpr/values-talos.yaml | 13 +- packages/system/cozyplane-kpr/values.yaml | 30 +---- packages/system/cozyplane/Chart.yaml | 18 +-- packages/system/cozyplane/Makefile | 24 ++-- .../{ => charts/cozyplane}/.helmignore | 0 .../cozyplane/charts/cozyplane/Chart.yaml | 19 +++ .../{ => charts/cozyplane}/README.md | 0 .../cozyplane}/templates/_helpers.tpl | 0 .../cozyplane}/templates/agent.yaml | 0 .../cozyplane}/templates/authz.yaml | 0 .../cozyplane}/templates/controller.yaml | 0 .../cozyplane}/templates/crds.yaml | 0 .../cozyplane}/templates/tenant-rbac.yaml | 0 .../charts/cozyplane/values-talos.yaml | 27 ++++ .../cozyplane/charts/cozyplane/values.yaml | 119 +++++++++++++++++ .../cozyplane/tests/talos_render_test.yaml | 14 +- packages/system/cozyplane/values-talos.yaml | 37 ++---- packages/system/cozyplane/values.yaml | 120 +----------------- 39 files changed, 397 insertions(+), 391 deletions(-) rename packages/system/cozyplane-apiserver/{ => charts/cozyplane-apiserver}/.helmignore (100%) create mode 100644 packages/system/cozyplane-apiserver/charts/cozyplane-apiserver/Chart.yaml rename packages/system/cozyplane-apiserver/{ => charts/cozyplane-apiserver}/README.md (100%) rename packages/system/cozyplane-apiserver/{ => charts/cozyplane-apiserver}/templates/_helpers.tpl (100%) rename packages/system/cozyplane-apiserver/{ => charts/cozyplane-apiserver}/templates/apiserver.yaml (100%) rename packages/system/cozyplane-apiserver/{ => charts/cozyplane-apiserver}/templates/etcd-cluster.yaml (100%) create mode 100644 packages/system/cozyplane-apiserver/charts/cozyplane-apiserver/values.yaml rename packages/system/cozyplane-kpr/{ => charts/cozyplane-kpr}/.helmignore (100%) create mode 100644 packages/system/cozyplane-kpr/charts/cozyplane-kpr/Chart.yaml rename packages/system/cozyplane-kpr/{ => charts/cozyplane-kpr}/templates/daemonset.yaml (100%) create mode 100644 packages/system/cozyplane-kpr/charts/cozyplane-kpr/values-talos.yaml create mode 100644 packages/system/cozyplane-kpr/charts/cozyplane-kpr/values.yaml rename packages/system/cozyplane/{ => charts/cozyplane}/.helmignore (100%) create mode 100644 packages/system/cozyplane/charts/cozyplane/Chart.yaml rename packages/system/cozyplane/{ => charts/cozyplane}/README.md (100%) rename packages/system/cozyplane/{ => charts/cozyplane}/templates/_helpers.tpl (100%) rename packages/system/cozyplane/{ => charts/cozyplane}/templates/agent.yaml (100%) rename packages/system/cozyplane/{ => charts/cozyplane}/templates/authz.yaml (100%) rename packages/system/cozyplane/{ => charts/cozyplane}/templates/controller.yaml (100%) rename packages/system/cozyplane/{ => charts/cozyplane}/templates/crds.yaml (100%) rename packages/system/cozyplane/{ => charts/cozyplane}/templates/tenant-rbac.yaml (100%) create mode 100644 packages/system/cozyplane/charts/cozyplane/values-talos.yaml create mode 100644 packages/system/cozyplane/charts/cozyplane/values.yaml diff --git a/packages/core/platform/templates/bundles/system.yaml b/packages/core/platform/templates/bundles/system.yaml index 2686cac79..80b98f77d 100644 --- a/packages/core/platform/templates/bundles/system.yaml +++ b/packages/core/platform/templates/bundles/system.yaml @@ -95,7 +95,7 @@ {{- $clusterDNS = printf "%s.%s.%s.10" (index $octets 0) (index $octets 1) (index $octets 2) -}} {{- end -}} {{- $egress := dict "clusterCIDR" $net.podCIDR "serviceCIDR" $net.serviceCIDR "clusterDNS" $clusterDNS -}} -{{- $cozyplaneComponents := dict "cozyplane" (dict "values" (dict "egress" $egress)) -}} +{{- $cozyplaneComponents := dict "cozyplane" (dict "values" (dict "cozyplane" (dict "egress" $egress))) -}} {{- /* The cozyplane leg does not go through package.networking, so it must invoke the live-variant guard itself: a kubeovn-cilium cluster switched here loses Cilium AND kube-ovn in one reconcile. */ -}} @@ -289,13 +289,7 @@ the tenant kinds have no CRDs at all. The CNI package ships only the LOCAL group's CRDs (local.sdn.cozystack.io — underlay IPAM, which must work before cert-manager, etcd and this server, all of which are pods). */ -}} -{{- /* local, not the chart's replicated default: a 3-member etcd already - replicates at the application level, and the local class exists before - any replication pool is configured. The EtcdCluster's storageClassName - is immutable post-create, so the default has to be right on the first - render. */ -}} -{{- $cozyplaneApiserverComponents := dict "cozyplane-apiserver" (dict "values" (dict "etcd" (dict "operator" (dict "storageClass" "local")))) -}} -{{include "cozystack.platform.package" (list "cozystack.cozyplane-apiserver" "default" $ $cozyplaneApiserverComponents) }} +{{include "cozystack.platform.package.default" (list "cozystack.cozyplane-apiserver" $) }} {{- end }} {{- /* The ClusterIssuers of cert-manager-issuers and the per-tenant Issuers rendered for TenantGateway both use an http01.gatewayHTTPRoute solver diff --git a/packages/core/platform/tests/bundles_networking_variant_test.yaml b/packages/core/platform/tests/bundles_networking_variant_test.yaml index 16f5ef273..2ca3819d2 100644 --- a/packages/core/platform/tests/bundles_networking_variant_test.yaml +++ b/packages/core/platform/tests/bundles_networking_variant_test.yaml @@ -186,7 +186,7 @@ tests: path: metadata.name value: cozystack.networking equal: - path: spec.components.cozyplane.values.egress + path: spec.components.cozyplane.values.cozyplane.egress value: clusterCIDR: "192.168.0.0/17" serviceCIDR: "172.20.0.0/16" @@ -207,7 +207,7 @@ tests: path: metadata.name value: cozystack.networking equal: - path: spec.components.cozyplane.values.egress.clusterDNS + path: spec.components.cozyplane.values.cozyplane.egress.clusterDNS value: "10.43.0.53" - it: refuses cozyplane without the networking CIDRs @@ -251,30 +251,9 @@ tests: path: metadata.name value: cozystack.networking equal: - path: spec.components.cozyplane.values.egress.clusterDNS + path: spec.components.cozyplane.values.cozyplane.egress.clusterDNS value: "fd00:10:96::a" - # storageClassName is immutable on the EtcdCluster, so the platform must set - # the right class on the first render; local, because a 3-member etcd already - # replicates at the application level and local exists before any pool setup. - - it: pins the apiserver etcd to the local storage class - set: - bundles: - system: - enabled: true - variant: isp-full - networkingVariant: cozyplane - asserts: - - documentSelector: - path: metadata.name - value: cozystack.cozyplane-apiserver - equal: - path: spec.components.cozyplane-apiserver.values.etcd.operator.storageClass - value: local - - # The ciliumPool derivation requires a /20-or-shorter podCIDR — a kube-ovn - # constraint: the last /21 is carved out for Cilium. cozyplane runs no - # kube-ovn, so a small pod CIDR must render there. - it: accepts a /24 pod CIDR on cozyplane set: bundles: @@ -289,7 +268,7 @@ tests: path: metadata.name value: cozystack.networking equal: - path: spec.components.cozyplane.values.egress.clusterCIDR + path: spec.components.cozyplane.values.cozyplane.egress.clusterCIDR value: "192.168.5.0/24" # The cozyplane leg bypasses package.networking, so it invokes the diff --git a/packages/system/cozyplane-apiserver/Chart.yaml b/packages/system/cozyplane-apiserver/Chart.yaml index 7fc146910..35f4f9c44 100644 --- a/packages/system/cozyplane-apiserver/Chart.yaml +++ b/packages/system/cozyplane-apiserver/Chart.yaml @@ -1,17 +1,3 @@ apiVersion: v2 -name: cozyplane-apiserver -description: Aggregated API server for cozyplane's sdn.cozystack.io group (VPC tenancy), with its dedicated etcd -type: application -# Placeholder; the real version is stamped by the build/release pipeline. -version: 0.0.1 -appVersion: "0.1.0" -kubeVersion: ">=1.30.0-0" -keywords: - - cni - - networking - - api-aggregation - - cozystack - - vpc -home: https://github.com/lllamnyp/cozyplane -sources: - - https://github.com/lllamnyp/cozyplane +name: cozy-cozyplane-apiserver +version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process diff --git a/packages/system/cozyplane-apiserver/Makefile b/packages/system/cozyplane-apiserver/Makefile index 9fb8ea044..8500b6d97 100644 --- a/packages/system/cozyplane-apiserver/Makefile +++ b/packages/system/cozyplane-apiserver/Makefile @@ -4,24 +4,16 @@ export NAMESPACE=cozy-cozyplane include ../../../hack/common-envs.mk include ../../../hack/package.mk -# Vendored from github.com/lllamnyp/cozyplane (chart/cozyplane-apiserver), -# adapted for Cozystack's etcd-operator (etcd-operator.cozystack.io/v1alpha2, -# memory-backed). The image is built and published from that repo; there is no -# image build target here. +# 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 test: - helm lint . helm unittest . -# The vendoring ref in lllamnyp/cozyplane (a release tag once upstream cuts -# them; keep the three cozyplane packages on the same ref). Makefile and -# tests/ are Cozystack-side and survive the vendor, and so does the version -# stanza below: Cozystack owns the chart version, upstream keeps 0.0.0. -COZYPLANE_REF=a0f32e272640c6ac99d863622570bdf9677bf7ab -CHART_VERSION=0.0.1 - update: - find . -mindepth 1 -maxdepth 1 ! -name Makefile ! -name tests -exec rm -rf {} + - curl -sSL https://github.com/lllamnyp/cozyplane/archive/$(COZYPLANE_REF).tar.gz | \ - tar -xzf - --strip-components=3 cozyplane-$(COZYPLANE_REF)/chart/cozyplane-apiserver - sed -i -e '/# Unused as a release coordinate/,/^version: 0.0.0/c\# Placeholder; the real version is stamped by the build/release pipeline.\nversion: $(CHART_VERSION)' Chart.yaml + tmp=$$(mktemp -d) && \ + curl -fsSL https://github.com/lllamnyp/cozyplane/archive/$(COZYPLANE_REF).tar.gz | \ + tar -xzf - -C "$$tmp" --strip-components=3 cozyplane-$(COZYPLANE_REF)/chart/cozyplane-apiserver && \ + rm -rf charts/cozyplane-apiserver && mkdir -p charts && mv "$$tmp" charts/cozyplane-apiserver diff --git a/packages/system/cozyplane-apiserver/.helmignore b/packages/system/cozyplane-apiserver/charts/cozyplane-apiserver/.helmignore similarity index 100% rename from packages/system/cozyplane-apiserver/.helmignore rename to packages/system/cozyplane-apiserver/charts/cozyplane-apiserver/.helmignore diff --git a/packages/system/cozyplane-apiserver/charts/cozyplane-apiserver/Chart.yaml b/packages/system/cozyplane-apiserver/charts/cozyplane-apiserver/Chart.yaml new file mode 100644 index 000000000..6ae69348b --- /dev/null +++ b/packages/system/cozyplane-apiserver/charts/cozyplane-apiserver/Chart.yaml @@ -0,0 +1,19 @@ +apiVersion: v2 +name: cozyplane-apiserver +description: Aggregated API server for cozyplane's sdn.cozystack.io group (VPC tenancy), with its dedicated etcd +type: application +# Unused as a release coordinate: these charts are consumed straight from this +# git repository (packages/packagesources/, GitRepository -> PackageSource), so +# the commit is the version and nothing resolves this field. Kept at 0.0.0. +version: 0.0.0 +appVersion: "0.1.0" +kubeVersion: ">=1.30.0-0" +keywords: + - cni + - networking + - api-aggregation + - cozystack + - vpc +home: https://github.com/lllamnyp/cozyplane +sources: + - https://github.com/lllamnyp/cozyplane diff --git a/packages/system/cozyplane-apiserver/README.md b/packages/system/cozyplane-apiserver/charts/cozyplane-apiserver/README.md similarity index 100% rename from packages/system/cozyplane-apiserver/README.md rename to packages/system/cozyplane-apiserver/charts/cozyplane-apiserver/README.md diff --git a/packages/system/cozyplane-apiserver/templates/_helpers.tpl b/packages/system/cozyplane-apiserver/charts/cozyplane-apiserver/templates/_helpers.tpl similarity index 100% rename from packages/system/cozyplane-apiserver/templates/_helpers.tpl rename to packages/system/cozyplane-apiserver/charts/cozyplane-apiserver/templates/_helpers.tpl diff --git a/packages/system/cozyplane-apiserver/templates/apiserver.yaml b/packages/system/cozyplane-apiserver/charts/cozyplane-apiserver/templates/apiserver.yaml similarity index 100% rename from packages/system/cozyplane-apiserver/templates/apiserver.yaml rename to packages/system/cozyplane-apiserver/charts/cozyplane-apiserver/templates/apiserver.yaml diff --git a/packages/system/cozyplane-apiserver/templates/etcd-cluster.yaml b/packages/system/cozyplane-apiserver/charts/cozyplane-apiserver/templates/etcd-cluster.yaml similarity index 100% rename from packages/system/cozyplane-apiserver/templates/etcd-cluster.yaml rename to packages/system/cozyplane-apiserver/charts/cozyplane-apiserver/templates/etcd-cluster.yaml diff --git a/packages/system/cozyplane-apiserver/charts/cozyplane-apiserver/values.yaml b/packages/system/cozyplane-apiserver/charts/cozyplane-apiserver/values.yaml new file mode 100644 index 000000000..c43666b31 --- /dev/null +++ b/packages/system/cozyplane-apiserver/charts/cozyplane-apiserver/values.yaml @@ -0,0 +1,58 @@ +# 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 +imagePullPolicy: IfNotPresent +imagePullSecrets: [] + +replicas: 1 +resources: + requests: + cpu: 50m + memory: 128Mi + limits: + memory: 256Mi + +etcd: + # Operator-managed etcd (the aenix-io etcd-operator; Cozystack ships it): + # replicated, PVC-backed, TLS end to end. The production path, and the default + # — the Cozystack install this chart is packaged for always has the operator + # (packages/packagesources/apiserver.yaml dependsOn cozystack.etcd-operator). + # Turn it off for a standalone/kind install with no operator: the chart then + # falls back to the built-in single-pod etcd below, which is one pod holding + # every sdn.cozystack.io object in the cluster. + operator: + enabled: true + replicas: 3 + size: 4Gi + # etcd version the operator runs (required by the EtcdCluster schema). + version: "3.6.11" + # persistent: PVC-backed (durable) vs tmpfs. The aggregated API's objects + # are cluster state; a memory-backed etcd loses all of them on a + # full-cluster restart, which is what a node reboot is. Requires a storage + # layer, so the component must be sequenced after it. + persistent: true + # StorageClass for the members' PVCs ("" = cluster default). Replicated, so + # a member's data survives losing the node it was scheduled on. Cozystack's + # storage layers (linstor, blockstor) both provide a "replicated" class. + 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: + persistentVolumeClaim: + claimName: cozyplane-etcd-data + # The PVC the chart creates when storage above references it. + persistence: + enabled: true + storageClassName: "" # "" = the cluster default + size: 2Gi + resources: + requests: + cpu: 50m + memory: 128Mi + limits: + memory: 256Mi diff --git a/packages/system/cozyplane-apiserver/tests/etcd_render_test.yaml b/packages/system/cozyplane-apiserver/tests/etcd_render_test.yaml index 194544935..8602143c7 100644 --- a/packages/system/cozyplane-apiserver/tests/etcd_render_test.yaml +++ b/packages/system/cozyplane-apiserver/tests/etcd_render_test.yaml @@ -5,14 +5,14 @@ suite: cozyplane-apiserver etcd wiring # operator's Service — never per-pod endpoints, which the operator names # randomly (getting that wrong looks exactly like a dead etcd). templates: - - templates/etcd-cluster.yaml - - templates/apiserver.yaml + - charts/cozyplane-apiserver/templates/etcd-cluster.yaml + - charts/cozyplane-apiserver/templates/apiserver.yaml release: name: cozyplane-apiserver namespace: cozy-cozyplane tests: - it: renders a PVC-backed v1alpha2 EtcdCluster by default - templates: [templates/etcd-cluster.yaml] + templates: [charts/cozyplane-apiserver/templates/etcd-cluster.yaml] documentSelector: path: kind value: EtcdCluster @@ -23,9 +23,11 @@ tests: - equal: path: spec.storage.medium value: "" + # The wrapper's class: the EtcdCluster field is immutable, so the class + # must be the one a fresh install can bind. - equal: path: spec.storage.storageClassName - value: replicated + value: local # certManager-mode TLS: exactly one of certManager/secretRef per surface # (a CRD CEL rule); the platform supplies the issuers. - exists: @@ -38,11 +40,12 @@ tests: # tmpfs is the no-storage-layer escape hatch; spec.storage.medium is # immutable post-create, so this must come out right the first time. - it: renders a memory-backed member when persistence is off - templates: [templates/etcd-cluster.yaml] + templates: [charts/cozyplane-apiserver/templates/etcd-cluster.yaml] set: - etcd: - operator: - persistent: false + cozyplane-apiserver: + etcd: + operator: + persistent: false documentSelector: path: kind value: EtcdCluster @@ -52,7 +55,7 @@ tests: value: Memory - it: dials the operator's etcd Service, not per-pod endpoints - templates: [templates/apiserver.yaml] + templates: [charts/cozyplane-apiserver/templates/apiserver.yaml] documentSelector: path: kind value: Deployment @@ -63,10 +66,21 @@ tests: - it: falls back to the built-in single-pod etcd when the operator is off set: - etcd: - operator: - enabled: false + cozyplane-apiserver: + etcd: + operator: + enabled: false asserts: - hasDocuments: count: 0 - template: templates/etcd-cluster.yaml + template: charts/cozyplane-apiserver/templates/etcd-cluster.yaml + + - it: runs two apiserver replicas + templates: [charts/cozyplane-apiserver/templates/apiserver.yaml] + documentSelector: + path: kind + value: Deployment + asserts: + - equal: + path: spec.replicas + value: 2 diff --git a/packages/system/cozyplane-apiserver/values.yaml b/packages/system/cozyplane-apiserver/values.yaml index c43666b31..ef004844b 100644 --- a/packages/system/cozyplane-apiserver/values.yaml +++ b/packages/system/cozyplane-apiserver/values.yaml @@ -1,58 +1,11 @@ -# 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 -imagePullPolicy: IfNotPresent -imagePullSecrets: [] - -replicas: 1 -resources: - requests: - cpu: 50m - memory: 128Mi - limits: - memory: 256Mi - -etcd: - # Operator-managed etcd (the aenix-io etcd-operator; Cozystack ships it): - # replicated, PVC-backed, TLS end to end. The production path, and the default - # — the Cozystack install this chart is packaged for always has the operator - # (packages/packagesources/apiserver.yaml dependsOn cozystack.etcd-operator). - # Turn it off for a standalone/kind install with no operator: the chart then - # falls back to the built-in single-pod etcd below, which is one pod holding - # every sdn.cozystack.io object in the cluster. - operator: - enabled: true - replicas: 3 - size: 4Gi - # etcd version the operator runs (required by the EtcdCluster schema). - version: "3.6.11" - # persistent: PVC-backed (durable) vs tmpfs. The aggregated API's objects - # are cluster state; a memory-backed etcd loses all of them on a - # full-cluster restart, which is what a node reboot is. Requires a storage - # layer, so the component must be sequenced after it. - persistent: true - # StorageClass for the members' PVCs ("" = cluster default). Replicated, so - # a member's data survives losing the node it was scheduled on. Cozystack's - # storage layers (linstor, blockstor) both provide a "replicated" class. - 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: - persistentVolumeClaim: - claimName: cozyplane-etcd-data - # The PVC the chart creates when storage above references it. - persistence: - enabled: true - storageClassName: "" # "" = the cluster default - size: 2Gi - resources: - requests: - cpu: 50m - memory: 128Mi - limits: - memory: 256Mi +cozyplane-apiserver: + # The aggregated apiserver backs every tenant's SDN API. + replicas: 2 + etcd: + operator: + # local, not the chart's replicated default: a 3-member etcd already + # replicates at the application level, and the local class exists + # before any replication pool is configured. The EtcdCluster's + # storageClassName is immutable after creation, so this has to be + # right on the first install. + storageClass: local diff --git a/packages/system/cozyplane-kpr/Chart.yaml b/packages/system/cozyplane-kpr/Chart.yaml index c426744b8..d1f3120a3 100644 --- a/packages/system/cozyplane-kpr/Chart.yaml +++ b/packages/system/cozyplane-kpr/Chart.yaml @@ -1,17 +1,3 @@ apiVersion: v2 -name: cozyplane-kpr -description: cozyplane kube-proxy replacement — socket-LB service load balancing (replaces Cilium/kube-proxy KPR) -type: application -# Placeholder; the real version is stamped by the build/release pipeline. -version: 0.1.0 -appVersion: "0.1.0" -kubeVersion: ">=1.30.0-0" -keywords: - - kube-proxy - - service - - load-balancer - - ebpf - - cozystack -home: https://github.com/lllamnyp/cozyplane -sources: - - https://github.com/lllamnyp/cozyplane +name: cozy-cozyplane-kpr +version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process diff --git a/packages/system/cozyplane-kpr/Makefile b/packages/system/cozyplane-kpr/Makefile index d0843b269..63acf012d 100644 --- a/packages/system/cozyplane-kpr/Makefile +++ b/packages/system/cozyplane-kpr/Makefile @@ -4,23 +4,16 @@ export NAMESPACE=cozy-cozyplane include ../../../hack/common-envs.mk include ../../../hack/package.mk -# cozyplane-kpr builds and publishes its own container image from -# github.com/lllamnyp/cozyplane (kpr/); this package only vendors the Helm chart -# and references the published image in values.yaml. No image build target here. +# 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 test: - helm lint . helm unittest . -# The vendoring ref in lllamnyp/cozyplane (a release tag once upstream cuts -# them; keep the three cozyplane packages on the same ref). Makefile and -# tests/ are Cozystack-side and survive the vendor, and so does the version -# stanza below: Cozystack owns the chart version, upstream keeps 0.0.0. -COZYPLANE_REF=a0f32e272640c6ac99d863622570bdf9677bf7ab -CHART_VERSION=0.1.0 - update: - find . -mindepth 1 -maxdepth 1 ! -name Makefile ! -name tests -exec rm -rf {} + - curl -sSL https://github.com/lllamnyp/cozyplane/archive/$(COZYPLANE_REF).tar.gz | \ - tar -xzf - --strip-components=3 cozyplane-$(COZYPLANE_REF)/chart/cozyplane-kpr - sed -i -e '/# Unused as a release coordinate/,/^version: 0.0.0/c\# Placeholder; the real version is stamped by the build/release pipeline.\nversion: $(CHART_VERSION)' Chart.yaml + tmp=$$(mktemp -d) && \ + curl -fsSL https://github.com/lllamnyp/cozyplane/archive/$(COZYPLANE_REF).tar.gz | \ + tar -xzf - -C "$$tmp" --strip-components=3 cozyplane-$(COZYPLANE_REF)/chart/cozyplane-kpr && \ + rm -rf charts/cozyplane-kpr && mkdir -p charts && mv "$$tmp" charts/cozyplane-kpr diff --git a/packages/system/cozyplane-kpr/.helmignore b/packages/system/cozyplane-kpr/charts/cozyplane-kpr/.helmignore similarity index 100% rename from packages/system/cozyplane-kpr/.helmignore rename to packages/system/cozyplane-kpr/charts/cozyplane-kpr/.helmignore diff --git a/packages/system/cozyplane-kpr/charts/cozyplane-kpr/Chart.yaml b/packages/system/cozyplane-kpr/charts/cozyplane-kpr/Chart.yaml new file mode 100644 index 000000000..d36aaea1d --- /dev/null +++ b/packages/system/cozyplane-kpr/charts/cozyplane-kpr/Chart.yaml @@ -0,0 +1,19 @@ +apiVersion: v2 +name: cozyplane-kpr +description: cozyplane kube-proxy replacement — socket-LB service load balancing (replaces Cilium/kube-proxy KPR) +type: application +# Unused as a release coordinate: these charts are consumed straight from this +# git repository (packages/packagesources/, GitRepository -> PackageSource), so +# the commit is the version and nothing resolves this field. Kept at 0.0.0. +version: 0.0.0 +appVersion: "0.1.0" +kubeVersion: ">=1.30.0-0" +keywords: + - kube-proxy + - service + - load-balancer + - ebpf + - cozystack +home: https://github.com/lllamnyp/cozyplane +sources: + - https://github.com/lllamnyp/cozyplane diff --git a/packages/system/cozyplane-kpr/templates/daemonset.yaml b/packages/system/cozyplane-kpr/charts/cozyplane-kpr/templates/daemonset.yaml similarity index 100% rename from packages/system/cozyplane-kpr/templates/daemonset.yaml rename to packages/system/cozyplane-kpr/charts/cozyplane-kpr/templates/daemonset.yaml diff --git a/packages/system/cozyplane-kpr/charts/cozyplane-kpr/values-talos.yaml b/packages/system/cozyplane-kpr/charts/cozyplane-kpr/values-talos.yaml new file mode 100644 index 000000000..13a5c6c8e --- /dev/null +++ b/packages/system/cozyplane-kpr/charts/cozyplane-kpr/values-talos.yaml @@ -0,0 +1,9 @@ +# Talos runs KubePrism (a node-local apiserver load balancer) on localhost:7445 — +# the real endpoint `apiServerURL` asks for; see values.yaml. A hostNetwork pod +# reaches it on localhost, before any ClusterIP proxy exists. +apiServerURL: "https://localhost:7445" + +# Applied as the SECOND valuesFile of the `cozyplane-kpr` component +# (packages/packagesources/networking.yaml): the Cozystack operator applies the +# first with strategy Overwrite and every later one with Merge, so this overlay +# only works as a file distinct from values.yaml. diff --git a/packages/system/cozyplane-kpr/charts/cozyplane-kpr/values.yaml b/packages/system/cozyplane-kpr/charts/cozyplane-kpr/values.yaml new file mode 100644 index 000000000..2f678de2e --- /dev/null +++ b/packages/system/cozyplane-kpr/charts/cozyplane-kpr/values.yaml @@ -0,0 +1,29 @@ +# cozyplane-kpr container image, built from kpr/ in this repository. +# Digest-pinned (no floating tag); built and pushed by release.yml's kpr-image +# job for amd64 and arm64, like the cozyplane image. docs/packaging.md has the +# procedure and how the pin is refreshed. +# It imports Cilium's LB control plane, so it is a large image and a SEPARATE +# component from the cozyplane agent — never co-mingled. +image: ghcr.io/lllamnyp/cozyplane-kpr@sha256:ba0b4babaddcda91af3c4aab58d5f999541b0bcd5437d1af7ba1edf5bfce03da +imagePullPolicy: IfNotPresent +imagePullSecrets: [] + +# The apiserver endpoint cozyplane-kpr connects to. It must NOT be the +# kubernetes.default ClusterIP: with kube-proxy gone, that VIP is unserved until +# kpr itself is running (chicken-and-egg). Point it at a real endpoint. Empty +# uses the in-cluster config (only valid where some other proxy already serves +# the ClusterIP); on Talos, values-talos.yaml sets the KubePrism local endpoint. +apiServerURL: "" + +# The host cgroup2 root (bind-mounted into the pod) where socket-LB attaches, +# and the host bpffs root where the LB service/backend maps are pinned. +cgroupRoot: /host/cgroup2 +bpffsRoot: /sys/fs/bpf + +# externalTrafficPolicy: Cluster via DSR. Off, a Cluster-policy Service degrades +# to node-local delivery: a node with no ready backend serves nothing for that +# frontend. On, remote backends are reached by DSR, which needs EVERY node +# permitted to source the LB/external addresses on the wire -- an underlay +# property cozyplane cannot verify, and one that black-holes silently when the +# fabric denies it. Hence opt-in (docs/lb-ingress.md, DSR caveats). +clusterDSR: false diff --git a/packages/system/cozyplane-kpr/tests/talos_render_test.yaml b/packages/system/cozyplane-kpr/tests/talos_render_test.yaml index d3fe7d6e5..a0a3abdd7 100644 --- a/packages/system/cozyplane-kpr/tests/talos_render_test.yaml +++ b/packages/system/cozyplane-kpr/tests/talos_render_test.yaml @@ -3,7 +3,7 @@ suite: cozyplane-kpr renders with the Talos overlay # platform relies on (the bootstrap endpoint, the node identity, the DSR # default), not chart internals. templates: - - templates/daemonset.yaml + - charts/cozyplane-kpr/templates/daemonset.yaml release: name: cozyplane-kpr namespace: cozy-cozyplane diff --git a/packages/system/cozyplane-kpr/values-talos.yaml b/packages/system/cozyplane-kpr/values-talos.yaml index 13a5c6c8e..952da204b 100644 --- a/packages/system/cozyplane-kpr/values-talos.yaml +++ b/packages/system/cozyplane-kpr/values-talos.yaml @@ -1,9 +1,4 @@ -# Talos runs KubePrism (a node-local apiserver load balancer) on localhost:7445 — -# the real endpoint `apiServerURL` asks for; see values.yaml. A hostNetwork pod -# reaches it on localhost, before any ClusterIP proxy exists. -apiServerURL: "https://localhost:7445" - -# Applied as the SECOND valuesFile of the `cozyplane-kpr` component -# (packages/packagesources/networking.yaml): the Cozystack operator applies the -# first with strategy Overwrite and every later one with Merge, so this overlay -# only works as a file distinct from values.yaml. +cozyplane-kpr: + # kpr is the ClusterIP proxy, so it cannot reach the apiserver through a + # ClusterIP it has not programmed yet; on Talos it dials KubePrism. + apiServerURL: "https://localhost:7445" diff --git a/packages/system/cozyplane-kpr/values.yaml b/packages/system/cozyplane-kpr/values.yaml index 2f678de2e..14e04284c 100644 --- a/packages/system/cozyplane-kpr/values.yaml +++ b/packages/system/cozyplane-kpr/values.yaml @@ -1,29 +1 @@ -# cozyplane-kpr container image, built from kpr/ in this repository. -# Digest-pinned (no floating tag); built and pushed by release.yml's kpr-image -# job for amd64 and arm64, like the cozyplane image. docs/packaging.md has the -# procedure and how the pin is refreshed. -# It imports Cilium's LB control plane, so it is a large image and a SEPARATE -# component from the cozyplane agent — never co-mingled. -image: ghcr.io/lllamnyp/cozyplane-kpr@sha256:ba0b4babaddcda91af3c4aab58d5f999541b0bcd5437d1af7ba1edf5bfce03da -imagePullPolicy: IfNotPresent -imagePullSecrets: [] - -# The apiserver endpoint cozyplane-kpr connects to. It must NOT be the -# kubernetes.default ClusterIP: with kube-proxy gone, that VIP is unserved until -# kpr itself is running (chicken-and-egg). Point it at a real endpoint. Empty -# uses the in-cluster config (only valid where some other proxy already serves -# the ClusterIP); on Talos, values-talos.yaml sets the KubePrism local endpoint. -apiServerURL: "" - -# The host cgroup2 root (bind-mounted into the pod) where socket-LB attaches, -# and the host bpffs root where the LB service/backend maps are pinned. -cgroupRoot: /host/cgroup2 -bpffsRoot: /sys/fs/bpf - -# externalTrafficPolicy: Cluster via DSR. Off, a Cluster-policy Service degrades -# to node-local delivery: a node with no ready backend serves nothing for that -# frontend. On, remote backends are reached by DSR, which needs EVERY node -# permitted to source the LB/external addresses on the wire -- an underlay -# property cozyplane cannot verify, and one that black-holes silently when the -# fabric denies it. Hence opt-in (docs/lb-ingress.md, DSR caveats). -clusterDSR: false +cozyplane-kpr: {} diff --git a/packages/system/cozyplane/Chart.yaml b/packages/system/cozyplane/Chart.yaml index 1a51a50d3..ed3760a37 100644 --- a/packages/system/cozyplane/Chart.yaml +++ b/packages/system/cozyplane/Chart.yaml @@ -1,17 +1,3 @@ apiVersion: v2 -name: cozyplane -description: Multi-tenant eBPF CNI for Cozystack — flat default network plus VPC tenancy -type: application -# Placeholder; the real version is stamped by the build/release pipeline. -version: 0.3.29 -appVersion: "0.1.0" -kubeVersion: ">=1.30.0-0" -keywords: - - cni - - networking - - ebpf - - cozystack - - vpc -home: https://github.com/lllamnyp/cozyplane -sources: - - https://github.com/lllamnyp/cozyplane +name: cozy-cozyplane +version: 0.0.0 # Placeholder, the actual version will be automatically set during the build process diff --git a/packages/system/cozyplane/Makefile b/packages/system/cozyplane/Makefile index ad7bbcc1c..c303af2c0 100644 --- a/packages/system/cozyplane/Makefile +++ b/packages/system/cozyplane/Makefile @@ -4,24 +4,16 @@ export NAMESPACE=cozy-$(NAME) include ../../../hack/common-envs.mk include ../../../hack/package.mk -# cozyplane builds and publishes its own container image from -# github.com/lllamnyp/cozyplane; this package only vendors the Helm chart (kept -# in that repo's chart/cozyplane) and references the published image in -# values.yaml. There is no image build target here. +# 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 test: - helm lint . helm unittest . -# The vendoring ref in lllamnyp/cozyplane (a release tag once upstream cuts -# them; keep the three cozyplane packages on the same ref). Makefile and -# tests/ are Cozystack-side and survive the vendor, and so does the version -# stanza below: Cozystack owns the chart version, upstream keeps 0.0.0. -COZYPLANE_REF=a0f32e272640c6ac99d863622570bdf9677bf7ab -CHART_VERSION=0.3.29 - update: - find . -mindepth 1 -maxdepth 1 ! -name Makefile ! -name tests -exec rm -rf {} + - curl -sSL https://github.com/lllamnyp/cozyplane/archive/$(COZYPLANE_REF).tar.gz | \ - tar -xzf - --strip-components=3 cozyplane-$(COZYPLANE_REF)/chart/cozyplane - sed -i -e '/# Unused as a release coordinate/,/^version: 0.0.0/c\# Placeholder; the real version is stamped by the build/release pipeline.\nversion: $(CHART_VERSION)' Chart.yaml + tmp=$$(mktemp -d) && \ + curl -fsSL https://github.com/lllamnyp/cozyplane/archive/$(COZYPLANE_REF).tar.gz | \ + tar -xzf - -C "$$tmp" --strip-components=3 cozyplane-$(COZYPLANE_REF)/chart/cozyplane && \ + rm -rf charts/cozyplane && mkdir -p charts && mv "$$tmp" charts/cozyplane diff --git a/packages/system/cozyplane/.helmignore b/packages/system/cozyplane/charts/cozyplane/.helmignore similarity index 100% rename from packages/system/cozyplane/.helmignore rename to packages/system/cozyplane/charts/cozyplane/.helmignore diff --git a/packages/system/cozyplane/charts/cozyplane/Chart.yaml b/packages/system/cozyplane/charts/cozyplane/Chart.yaml new file mode 100644 index 000000000..42396ed4d --- /dev/null +++ b/packages/system/cozyplane/charts/cozyplane/Chart.yaml @@ -0,0 +1,19 @@ +apiVersion: v2 +name: cozyplane +description: Multi-tenant eBPF CNI for Cozystack — flat default network plus VPC tenancy +type: application +# Unused as a release coordinate: these charts are consumed straight from this +# git repository (packages/packagesources/, GitRepository -> PackageSource), so +# the commit is the version and nothing resolves this field. Kept at 0.0.0. +version: 0.0.0 +appVersion: "0.1.0" +kubeVersion: ">=1.30.0-0" +keywords: + - cni + - networking + - ebpf + - cozystack + - vpc +home: https://github.com/lllamnyp/cozyplane +sources: + - https://github.com/lllamnyp/cozyplane diff --git a/packages/system/cozyplane/README.md b/packages/system/cozyplane/charts/cozyplane/README.md similarity index 100% rename from packages/system/cozyplane/README.md rename to packages/system/cozyplane/charts/cozyplane/README.md diff --git a/packages/system/cozyplane/templates/_helpers.tpl b/packages/system/cozyplane/charts/cozyplane/templates/_helpers.tpl similarity index 100% rename from packages/system/cozyplane/templates/_helpers.tpl rename to packages/system/cozyplane/charts/cozyplane/templates/_helpers.tpl diff --git a/packages/system/cozyplane/templates/agent.yaml b/packages/system/cozyplane/charts/cozyplane/templates/agent.yaml similarity index 100% rename from packages/system/cozyplane/templates/agent.yaml rename to packages/system/cozyplane/charts/cozyplane/templates/agent.yaml diff --git a/packages/system/cozyplane/templates/authz.yaml b/packages/system/cozyplane/charts/cozyplane/templates/authz.yaml similarity index 100% rename from packages/system/cozyplane/templates/authz.yaml rename to packages/system/cozyplane/charts/cozyplane/templates/authz.yaml diff --git a/packages/system/cozyplane/templates/controller.yaml b/packages/system/cozyplane/charts/cozyplane/templates/controller.yaml similarity index 100% rename from packages/system/cozyplane/templates/controller.yaml rename to packages/system/cozyplane/charts/cozyplane/templates/controller.yaml diff --git a/packages/system/cozyplane/templates/crds.yaml b/packages/system/cozyplane/charts/cozyplane/templates/crds.yaml similarity index 100% rename from packages/system/cozyplane/templates/crds.yaml rename to packages/system/cozyplane/charts/cozyplane/templates/crds.yaml diff --git a/packages/system/cozyplane/templates/tenant-rbac.yaml b/packages/system/cozyplane/charts/cozyplane/templates/tenant-rbac.yaml similarity index 100% rename from packages/system/cozyplane/templates/tenant-rbac.yaml rename to packages/system/cozyplane/charts/cozyplane/templates/tenant-rbac.yaml diff --git a/packages/system/cozyplane/charts/cozyplane/values-talos.yaml b/packages/system/cozyplane/charts/cozyplane/values-talos.yaml new file mode 100644 index 000000000..bcb43ad15 --- /dev/null +++ b/packages/system/cozyplane/charts/cozyplane/values-talos.yaml @@ -0,0 +1,27 @@ +# Talos overlay for the cozyplane networking variant (cozyplane + cozyplane-kpr, +# no Cilium, no kube-proxy). +# +# Applied as the SECOND valuesFile of the `cozyplane` component +# (packages/packagesources/networking.yaml): the Cozystack operator applies the +# first file with strategy Overwrite and every later one with Merge, so this +# file must stay separate from values.yaml — folding it in would make these +# settings the chart's defaults, and they are wrong off Talos. + +# cozyplane is the sole CNI; its conflist sorts first (00-) so kubelet uses it as +# the primary CNI over any co-installed one. +cniConfName: "00-cozyplane.conflist" + +# Talos runs KubePrism (a node-local apiserver load balancer) on localhost:7445 — +# the real endpoint `kubeApiServer` asks for; see values.yaml. +kubeApiServer: + host: "localhost" + port: "7445" + +# The aggregated API server is NOT part of this package: cozyplane installs +# FIRST (it is the CNI), before cert-manager, and the apiserver needs +# cert-manager Certificates. It ships as the separate cozyplane-apiserver +# package (packages/packagesources/apiserver.yaml, dependsOn cert-manager + +# etcd-operator + the storage layer). This chart ships only the LOCAL group's +# CRDs (local.sdn.cozystack.io — FabricIP); the tenant group sdn.cozystack.io +# has no CRDs at all and is unserved until the apiserver lands, by design +# (docs/api-groups.md). diff --git a/packages/system/cozyplane/charts/cozyplane/values.yaml b/packages/system/cozyplane/charts/cozyplane/values.yaml new file mode 100644 index 000000000..8b1768081 --- /dev/null +++ b/packages/system/cozyplane/charts/cozyplane/values.yaml @@ -0,0 +1,119 @@ +# Container image for all cozyplane components (agent, CNI plugin, controller). +# 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 +imagePullPolicy: IfNotPresent +imagePullSecrets: [] + +# Pod MTU (underlay MTU minus Geneve overhead, ~50 bytes). +mtu: 1450 + +# Geneve UDP destination port. Override (e.g. 6082) only to coexist with another +# overlay still holding 6081 on the node. +genevePort: 6081 + +# CNI conflist filename written to /etc/cni/net.d. Lower names sort first; use a +# low prefix (e.g. "00-cozyplane.conflist") to win over a co-installed CNI such +# as Cilium (which ships 05-cilium.conflist). +cniConfName: "10-cozyplane.conflist" + +# Kube-apiserver endpoint the hostNetwork agent/responder dial. Empty = the +# in-cluster kubernetes.default ClusterIP (10.96.0.1) — correct once a service +# proxy serves it. When cozyplane is the CNI AND there is no kube-proxy, that +# ClusterIP is unserved until cozyplane-kpr (which needs the agent) is up, a +# bootstrap cycle — so point the agent at a real endpoint (Talos: KubePrism +# localhost:7445). +kubeApiServer: + host: "" + port: "" + +# The cluster DNS domain (kubelet's clusterDomain) — the zone the split-horizon +# resolver answers authoritatively for VPC pods. Empty (the default) +# autodetects it from the resolver's own kubelet-written search path (the +# DaemonSet runs ClusterFirstWithHostNet, so the cluster domain is present +# despite hostNetwork); set explicitly only to override. +clusterDomain: "" + +# Cluster networking facts for pod egress to the outside world. Not reliably +# discoverable in-cluster, so declared here. +egress: + # The cluster pod supernet(s), comma-separated for dual-stack (e.g. + # "10.244.0.0/16,fd00:10:244::/56"). Enables the cluster-egress masquerade + # (pods get an off-cluster return path) and is denied to VPC tenants at + # their gateways. Empty disables both. + clusterCIDR: "10.244.0.0/16" + # Masquerade implementation: "bpf" (eBPF SNAT at the uplink, no netfilter, + # both families), "iptables" (legacy kernel rule, v4 only), or "off". + masquerade: "bpf" + # The Service CIDR, denied to VPC tenants at their gateways. + serviceCIDR: "10.96.0.0/16" + # Cluster DNS ClusterIP; the one cluster-internal door a VPC gateway opens + # (:53 only), so tenant pods resolve with a stock resolv.conf. + clusterDNS: "10.96.0.10" + # Additional cluster-internal networks VPC tenants must not reach through + # their gateways (e.g. the node/management network). + internalCIDRs: [] + +agent: + # Bind address for the per-VPC Prometheus metrics (/metrics). The kubelet + # resolves $(HOST_IP) to the node's primary InternalIP, so in-cluster + # Prometheus scrapes the agent pods on :9411 as usual (hostNetwork: pod IP == + # host IP) while any other node address — a public one included — serves + # nothing. The agent brackets the host itself, so this is also correct when + # that primary address is IPv6; only the primary FAMILY is served, though, so + # nothing listens on the other family's node address. ":9411" restores + # listening on every address; "" disables metrics. See README.md § Upgrading. + metricsBindAddress: "$(HOST_IP):9411" + # Delegated authn/authz on /metrics (TokenReview + SubjectAccessReview against + # the kube-apiserver): the scraper sends its ServiceAccount token — a standard + # in-cluster prometheus/vmagent scrape with bearerTokenFile, plain HTTP — and + # that ServiceAccount needs `get` on nonResourceURL /metrics, so bind the + # cozyplane-metrics-reader ClusterRole to it. false serves /metrics + # unauthenticated to anything that can reach the bind address. + metricsSecure: true + priorityClassName: system-node-critical + resources: + requests: + cpu: 50m + # The eBPF maps are charged to the agent's memory cgroup, and most of them + # are PREALLOCATED at load: the LRU conntrack and service maps alone + # (ct_fwd/ct_rev/svc_fwd/svc_rev at 262k entries each, np_ct at 131k) come + # to ~100MB+ before the Go heap. Request enough that the scheduler knows. + memory: 192Mi + limits: + # Sized for the same preallocated map footprint as the request above, with + # headroom for new maps — not for the Go heap. + memory: 512Mi + +controller: + replicas: 1 + priorityClassName: system-cluster-critical + resources: + requests: + cpu: 10m + memory: 64Mi + limits: + memory: 128Mi + +# The export ValidatingAdmissionPolicy that gates VPCBinding creation on the +# 'export' verb of the referenced VPC. Requires Kubernetes >= 1.30. Disable only +# if your cluster predates VAP (then VPCBinding/VPCPeering creation is governed +# by plain create RBAC alone, with no export/peer verb check). Only relevant in +# CRD mode: the aggregated apiserver enforces both verbs in its strategies. +exportPolicy: + enabled: true + +# CRDs for the LOCAL group (local.sdn.cozystack.io): underlay IPAM (FabricIP). +# This is the layer beneath everything — it must work before cert-manager, +# before etcd, and before cozyplane's own aggregated apiserver, all of which run +# as default-network pods. +# +# The tenant kinds (VPC, Port, SecurityGroup, HostFirewall, ...) are NOT CRDs. +# They are served only by chart/cozyplane-apiserver: a group served by both a +# CRD and an APIService makes the kube-apiserver's OpenAPI merge collide, and +# `kubectl apply` then fails for every object in the group (docs/api-groups.md). +# +# Disable only if you install these CRDs out-of-band. +crds: + enabled: true diff --git a/packages/system/cozyplane/tests/talos_render_test.yaml b/packages/system/cozyplane/tests/talos_render_test.yaml index 3f069dd2d..82be7db08 100644 --- a/packages/system/cozyplane/tests/talos_render_test.yaml +++ b/packages/system/cozyplane/tests/talos_render_test.yaml @@ -5,9 +5,9 @@ suite: cozyplane CNI renders with the Talos overlay # lllamnyp/cozyplane, so keep assertions to the contract the platform relies # on, not to chart internals. templates: - - templates/agent.yaml - - templates/controller.yaml - - templates/crds.yaml + - charts/cozyplane/templates/agent.yaml + - charts/cozyplane/templates/controller.yaml + - charts/cozyplane/templates/crds.yaml release: name: cozyplane namespace: cozy-cozyplane @@ -19,7 +19,7 @@ tests: # against a real endpoint. On Talos that is KubePrism on localhost:7445; # without these env vars the agent deadlocks against the unserved VIP. - it: dials KubePrism instead of the unserved ClusterIP - templates: [templates/agent.yaml] + templates: [charts/cozyplane/templates/agent.yaml] documentSelector: path: kind value: DaemonSet @@ -38,7 +38,7 @@ tests: # 00- sorts before any co-installed CNI's conflist (Cilium ships 05-), so # the kubelet keeps cozyplane as the primary CNI. - it: writes the primary conflist under the 00- prefix - templates: [templates/agent.yaml] + templates: [charts/cozyplane/templates/agent.yaml] documentSelector: path: kind value: DaemonSet @@ -48,7 +48,7 @@ tests: content: "--cni-conf-name=00-cozyplane.conflist" - it: renders the controller - templates: [templates/controller.yaml] + templates: [charts/cozyplane/templates/controller.yaml] documentSelector: path: kind value: Deployment @@ -60,7 +60,7 @@ tests: # served by the aggregated apiserver alone, and a CRD for them would break # the group's OpenAPI (docs/api-groups.md upstream). - it: ships only local.sdn.cozystack.io CRDs - templates: [templates/crds.yaml] + templates: [charts/cozyplane/templates/crds.yaml] asserts: - matchRegex: path: spec.group diff --git a/packages/system/cozyplane/values-talos.yaml b/packages/system/cozyplane/values-talos.yaml index bcb43ad15..8976c78fe 100644 --- a/packages/system/cozyplane/values-talos.yaml +++ b/packages/system/cozyplane/values-talos.yaml @@ -1,27 +1,10 @@ -# Talos overlay for the cozyplane networking variant (cozyplane + cozyplane-kpr, -# no Cilium, no kube-proxy). -# -# Applied as the SECOND valuesFile of the `cozyplane` component -# (packages/packagesources/networking.yaml): the Cozystack operator applies the -# first file with strategy Overwrite and every later one with Merge, so this -# file must stay separate from values.yaml — folding it in would make these -# settings the chart's defaults, and they are wrong off Talos. - -# cozyplane is the sole CNI; its conflist sorts first (00-) so kubelet uses it as -# the primary CNI over any co-installed one. -cniConfName: "00-cozyplane.conflist" - -# Talos runs KubePrism (a node-local apiserver load balancer) on localhost:7445 — -# the real endpoint `kubeApiServer` asks for; see values.yaml. -kubeApiServer: - host: "localhost" - port: "7445" - -# The aggregated API server is NOT part of this package: cozyplane installs -# FIRST (it is the CNI), before cert-manager, and the apiserver needs -# cert-manager Certificates. It ships as the separate cozyplane-apiserver -# package (packages/packagesources/apiserver.yaml, dependsOn cert-manager + -# etcd-operator + the storage layer). This chart ships only the LOCAL group's -# CRDs (local.sdn.cozystack.io — FabricIP); the tenant group sdn.cozystack.io -# has no CRDs at all and is unserved until the apiserver lands, by design -# (docs/api-groups.md). +cozyplane: + # 00- sorts before any co-installed CNI's conflist, so the kubelet keeps + # cozyplane as the primary CNI. + cniConfName: "00-cozyplane.conflist" + # With no kube-proxy, the kubernetes.default ClusterIP is unserved until + # cozyplane-kpr runs, and kpr needs the agent; the agent and the resolver + # bootstrap against Talos's KubePrism instead. + kubeApiServer: + host: "localhost" + port: "7445" diff --git a/packages/system/cozyplane/values.yaml b/packages/system/cozyplane/values.yaml index 8b1768081..e37e57325 100644 --- a/packages/system/cozyplane/values.yaml +++ b/packages/system/cozyplane/values.yaml @@ -1,119 +1 @@ -# Container image for all cozyplane components (agent, CNI plugin, controller). -# 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 -imagePullPolicy: IfNotPresent -imagePullSecrets: [] - -# Pod MTU (underlay MTU minus Geneve overhead, ~50 bytes). -mtu: 1450 - -# Geneve UDP destination port. Override (e.g. 6082) only to coexist with another -# overlay still holding 6081 on the node. -genevePort: 6081 - -# CNI conflist filename written to /etc/cni/net.d. Lower names sort first; use a -# low prefix (e.g. "00-cozyplane.conflist") to win over a co-installed CNI such -# as Cilium (which ships 05-cilium.conflist). -cniConfName: "10-cozyplane.conflist" - -# Kube-apiserver endpoint the hostNetwork agent/responder dial. Empty = the -# in-cluster kubernetes.default ClusterIP (10.96.0.1) — correct once a service -# proxy serves it. When cozyplane is the CNI AND there is no kube-proxy, that -# ClusterIP is unserved until cozyplane-kpr (which needs the agent) is up, a -# bootstrap cycle — so point the agent at a real endpoint (Talos: KubePrism -# localhost:7445). -kubeApiServer: - host: "" - port: "" - -# The cluster DNS domain (kubelet's clusterDomain) — the zone the split-horizon -# resolver answers authoritatively for VPC pods. Empty (the default) -# autodetects it from the resolver's own kubelet-written search path (the -# DaemonSet runs ClusterFirstWithHostNet, so the cluster domain is present -# despite hostNetwork); set explicitly only to override. -clusterDomain: "" - -# Cluster networking facts for pod egress to the outside world. Not reliably -# discoverable in-cluster, so declared here. -egress: - # The cluster pod supernet(s), comma-separated for dual-stack (e.g. - # "10.244.0.0/16,fd00:10:244::/56"). Enables the cluster-egress masquerade - # (pods get an off-cluster return path) and is denied to VPC tenants at - # their gateways. Empty disables both. - clusterCIDR: "10.244.0.0/16" - # Masquerade implementation: "bpf" (eBPF SNAT at the uplink, no netfilter, - # both families), "iptables" (legacy kernel rule, v4 only), or "off". - masquerade: "bpf" - # The Service CIDR, denied to VPC tenants at their gateways. - serviceCIDR: "10.96.0.0/16" - # Cluster DNS ClusterIP; the one cluster-internal door a VPC gateway opens - # (:53 only), so tenant pods resolve with a stock resolv.conf. - clusterDNS: "10.96.0.10" - # Additional cluster-internal networks VPC tenants must not reach through - # their gateways (e.g. the node/management network). - internalCIDRs: [] - -agent: - # Bind address for the per-VPC Prometheus metrics (/metrics). The kubelet - # resolves $(HOST_IP) to the node's primary InternalIP, so in-cluster - # Prometheus scrapes the agent pods on :9411 as usual (hostNetwork: pod IP == - # host IP) while any other node address — a public one included — serves - # nothing. The agent brackets the host itself, so this is also correct when - # that primary address is IPv6; only the primary FAMILY is served, though, so - # nothing listens on the other family's node address. ":9411" restores - # listening on every address; "" disables metrics. See README.md § Upgrading. - metricsBindAddress: "$(HOST_IP):9411" - # Delegated authn/authz on /metrics (TokenReview + SubjectAccessReview against - # the kube-apiserver): the scraper sends its ServiceAccount token — a standard - # in-cluster prometheus/vmagent scrape with bearerTokenFile, plain HTTP — and - # that ServiceAccount needs `get` on nonResourceURL /metrics, so bind the - # cozyplane-metrics-reader ClusterRole to it. false serves /metrics - # unauthenticated to anything that can reach the bind address. - metricsSecure: true - priorityClassName: system-node-critical - resources: - requests: - cpu: 50m - # The eBPF maps are charged to the agent's memory cgroup, and most of them - # are PREALLOCATED at load: the LRU conntrack and service maps alone - # (ct_fwd/ct_rev/svc_fwd/svc_rev at 262k entries each, np_ct at 131k) come - # to ~100MB+ before the Go heap. Request enough that the scheduler knows. - memory: 192Mi - limits: - # Sized for the same preallocated map footprint as the request above, with - # headroom for new maps — not for the Go heap. - memory: 512Mi - -controller: - replicas: 1 - priorityClassName: system-cluster-critical - resources: - requests: - cpu: 10m - memory: 64Mi - limits: - memory: 128Mi - -# The export ValidatingAdmissionPolicy that gates VPCBinding creation on the -# 'export' verb of the referenced VPC. Requires Kubernetes >= 1.30. Disable only -# if your cluster predates VAP (then VPCBinding/VPCPeering creation is governed -# by plain create RBAC alone, with no export/peer verb check). Only relevant in -# CRD mode: the aggregated apiserver enforces both verbs in its strategies. -exportPolicy: - enabled: true - -# CRDs for the LOCAL group (local.sdn.cozystack.io): underlay IPAM (FabricIP). -# This is the layer beneath everything — it must work before cert-manager, -# before etcd, and before cozyplane's own aggregated apiserver, all of which run -# as default-network pods. -# -# The tenant kinds (VPC, Port, SecurityGroup, HostFirewall, ...) are NOT CRDs. -# They are served only by chart/cozyplane-apiserver: a group served by both a -# CRD and an APIService makes the kube-apiserver's OpenAPI merge collide, and -# `kubectl apply` then fails for every object in the group (docs/api-groups.md). -# -# Disable only if you install these CRDs out-of-band. -crds: - enabled: true +cozyplane: {}