From 2065b7a5235608792b22eeb1d33a98defe06c125 Mon Sep 17 00:00:00 2001 From: Timofei Larkin Date: Tue, 17 Nov 2026 15:12:37 +0100 Subject: [PATCH] feat(cozyplane): bump to VPC egress and the netlink retry Re-vendor at upstream a0f32e2. VPC egress becomes NAT gateways, route tables and routes in sdn.cozystack.io (lllamnyp/cozyplane#65), served by the aggregated apiserver like the other tenant kinds; the gateways' leased port blocks are a new NATPortBlock kind in the local group, the only new CRD. VPCGateway's nat.enabled keeps working as a transition: the controller creates and owns a NATGateway, a default RouteTable and a default route per family, adopting the existing NAT Services so the egress address does not change. The agent also retries netlink dumps the kernel interrupted, instead of failing them (lllamnyp/cozyplane#67). Chart-side the change is the matching agent, controller and tenant RBAC and the image pin; the kpr image is unchanged. Assisted-by: LLM Signed-off-by: Timofei Larkin --- packages/system/cozyplane-apiserver/Makefile | 2 +- .../system/cozyplane-apiserver/values.yaml | 2 +- packages/system/cozyplane-kpr/Makefile | 2 +- packages/system/cozyplane/Makefile | 2 +- .../system/cozyplane/templates/agent.yaml | 12 ++ .../cozyplane/templates/controller.yaml | 19 +++ packages/system/cozyplane/templates/crds.yaml | 132 ++++++++++++++++++ .../cozyplane/templates/tenant-rbac.yaml | 9 ++ packages/system/cozyplane/values.yaml | 2 +- 9 files changed, 177 insertions(+), 5 deletions(-) diff --git a/packages/system/cozyplane-apiserver/Makefile b/packages/system/cozyplane-apiserver/Makefile index ab0ab2314..9fb8ea044 100644 --- a/packages/system/cozyplane-apiserver/Makefile +++ b/packages/system/cozyplane-apiserver/Makefile @@ -17,7 +17,7 @@ test: # 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=d328c1d8365265948ea8437501e8b7382e5b1712 +COZYPLANE_REF=a0f32e272640c6ac99d863622570bdf9677bf7ab CHART_VERSION=0.0.1 update: diff --git a/packages/system/cozyplane-apiserver/values.yaml b/packages/system/cozyplane-apiserver/values.yaml index 32356fc74..c43666b31 100644 --- a/packages/system/cozyplane-apiserver/values.yaml +++ b/packages/system/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:55132be06a41a1edf4a57f2120d02996f3c6ffb98ab553f4c1dda581fec257d4 +image: ghcr.io/lllamnyp/cozyplane@sha256:25c209e247a65ee3d430b0a1ba4f10ca2cf066d64c2bef10fdaa9f6c0266e48a imagePullPolicy: IfNotPresent imagePullSecrets: [] diff --git a/packages/system/cozyplane-kpr/Makefile b/packages/system/cozyplane-kpr/Makefile index 618a411bc..d0843b269 100644 --- a/packages/system/cozyplane-kpr/Makefile +++ b/packages/system/cozyplane-kpr/Makefile @@ -16,7 +16,7 @@ test: # 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=d328c1d8365265948ea8437501e8b7382e5b1712 +COZYPLANE_REF=a0f32e272640c6ac99d863622570bdf9677bf7ab CHART_VERSION=0.1.0 update: diff --git a/packages/system/cozyplane/Makefile b/packages/system/cozyplane/Makefile index 630230323..ad7bbcc1c 100644 --- a/packages/system/cozyplane/Makefile +++ b/packages/system/cozyplane/Makefile @@ -17,7 +17,7 @@ test: # 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=d328c1d8365265948ea8437501e8b7382e5b1712 +COZYPLANE_REF=a0f32e272640c6ac99d863622570bdf9677bf7ab CHART_VERSION=0.3.29 update: diff --git a/packages/system/cozyplane/templates/agent.yaml b/packages/system/cozyplane/templates/agent.yaml index f6ecc1419..bcb0dabdb 100644 --- a/packages/system/cozyplane/templates/agent.yaml +++ b/packages/system/cozyplane/templates/agent.yaml @@ -71,6 +71,18 @@ rules: - apiGroups: ["local.sdn.cozystack.io"] resources: ["fabricips"] verbs: ["get", "list", "watch", "create", "delete", "deletecollection"] + # NAT gateways, route tables and routes: the agent programs vpc_routes, + # port_rt and the NAT maps from them (docs/vpc-egress.md §6). + - apiGroups: ["sdn.cozystack.io"] + resources: ["natgateways", "routetables", "routes"] + verbs: ["get", "list", "watch"] + # NATPortBlock leases: the agent claims, releases and acks them (§4.3). + - apiGroups: ["local.sdn.cozystack.io"] + resources: ["natportblocks"] + verbs: ["get", "list", "watch", "create", "delete"] + - apiGroups: ["local.sdn.cozystack.io"] + resources: ["natportblocks/status"] + verbs: ["get", "patch"] # HostFirewalls: the agent compiles the objects selecting its node into the # hf_allow map and arms enforcement (docs/host-firewall.md). - apiGroups: ["sdn.cozystack.io"] diff --git a/packages/system/cozyplane/templates/controller.yaml b/packages/system/cozyplane/templates/controller.yaml index 911204412..6c156adab 100644 --- a/packages/system/cozyplane/templates/controller.yaml +++ b/packages/system/cozyplane/templates/controller.yaml @@ -116,6 +116,25 @@ rules: - apiGroups: ["local.sdn.cozystack.io"] resources: ["fabricips"] verbs: ["get", "list", "watch", "delete"] + # NAT gateways, route tables and routes (docs/vpc-egress.md): the controller + # allocates their ids, resolves routes, owns each NAT gateway's LoadBalancer + # Services, and creates the objects a VPCGateway's nat.enabled asks for (§7). + - apiGroups: ["sdn.cozystack.io"] + resources: ["natgateways", "routetables", "routes"] + verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] + - apiGroups: ["sdn.cozystack.io"] + resources: ["natgateways/status", "routetables/status", "routes/status"] + verbs: ["get", "update", "patch"] + # NATPortBlock leases: the controller deletes those of gone nodes and of + # deleted NAT gateways, and counts them into NATGateway status (§4.3). + - apiGroups: ["local.sdn.cozystack.io"] + resources: ["natportblocks"] + verbs: ["get", "list", "watch", "delete"] + # IPAddressClaims (the address-controller): read a named claim's addresses to + # choose the families of the Service that attaches it (§2.1). Never written. + - apiGroups: ["local.sdn.cozystack.io"] + resources: ["ipaddressclaims"] + verbs: ["get"] --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding diff --git a/packages/system/cozyplane/templates/crds.yaml b/packages/system/cozyplane/templates/crds.yaml index c9f835214..cbf77c731 100644 --- a/packages/system/cozyplane/templates/crds.yaml +++ b/packages/system/cozyplane/templates/crds.yaml @@ -104,4 +104,136 @@ spec: served: true storage: true subresources: {} +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.19.0 + name: natportblocks.local.sdn.cozystack.io +spec: + group: local.sdn.cozystack.io + names: + kind: NATPortBlock + listKind: NATPortBlockList + plural: natportblocks + singular: natportblock + scope: Cluster + versions: + - additionalPrinterColumns: + - jsonPath: .spec.natGatewayRef.name + name: NATGateway + type: string + - jsonPath: .spec.natGatewayRef.namespace + name: Namespace + type: string + - jsonPath: .spec.block + name: Block + type: integer + - jsonPath: .spec.node + name: Node + type: string + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + name: v1alpha1 + schema: + openAPIV3Schema: + description: |- + NATPortBlock is one node's lease on one block of one NAT gateway's port space + (docs/vpc-egress.md §2.5, §4.3). + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: NATPortBlockSpec records which node holds which block of + which NAT gateway. + properties: + block: + description: 'Block is the block number: ports 1024+Block*blockSize + up to the next block.' + format: int32 + type: integer + natGatewayRef: + description: NATGatewayRef is the NAT gateway whose port space the + block belongs to. + properties: + name: + type: string + namespace: + type: string + uid: + description: |- + UID is a type that holds unique ID values, including UUIDs. Because we + don't ONLY use UUIDs, this is an alias to string. Being a type captures + intent and helps make sure that UIDs and names do not get conflated. + type: string + required: + - name + - namespace + - uid + type: object + node: + description: Node is the node that holds the block. + type: string + required: + - block + - natGatewayRef + - node + type: object + status: + description: NATPortBlockStatus carries the per-node acknowledgements. + properties: + acks: + description: |- + Acks lists the nodes whose agent has programmed this block's owner. The + holder allocates from the block only once every Ready node is listed. + Each agent server-side-applies its own entry. + items: + description: NATPortBlockAck records that one node's agent has programmed + this block's owner. + properties: + bootID: + description: |- + BootID is the acking node's boot ID (Node.status.nodeInfo.bootID). The + datapath state an ack vouches for does not survive a reboot, so an ack + counts only while the node's boot ID still matches. + type: string + node: + type: string + required: + - node + type: object + type: array + x-kubernetes-list-map-keys: + - node + x-kubernetes-list-type: map + active: + description: |- + Active is set by the holder the first time every Ready node has acked. + Once active a block stays active: a node that reboots and has not + re-acked yet is kept from attracting the NAT gateway's address instead + (docs/vpc-egress.md §4.3). + type: boolean + type: object + type: object + served: true + storage: true + subresources: + status: {} {{- end }} diff --git a/packages/system/cozyplane/templates/tenant-rbac.yaml b/packages/system/cozyplane/templates/tenant-rbac.yaml index 9c4400630..53bd87b6e 100644 --- a/packages/system/cozyplane/templates/tenant-rbac.yaml +++ b/packages/system/cozyplane/templates/tenant-rbac.yaml @@ -23,6 +23,9 @@ rules: - vpcpeerings - securitygroups - floatingips + - natgateways + - routetables + - routes verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] - apiGroups: ["sdn.cozystack.io"] resources: @@ -31,6 +34,9 @@ rules: - vpcpeerings/status - securitygroups/status - floatingips/status + - natgateways/status + - routetables/status + - routes/status verbs: ["get"] {{- /* Granting the virtual verbs in an aggregated edit role is not an @@ -61,4 +67,7 @@ rules: - vpcpeerings - securitygroups - floatingips + - natgateways + - routetables + - routes verbs: ["get", "list", "watch"] diff --git a/packages/system/cozyplane/values.yaml b/packages/system/cozyplane/values.yaml index d4b21e8d6..8b1768081 100644 --- a/packages/system/cozyplane/values.yaml +++ b/packages/system/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:55132be06a41a1edf4a57f2120d02996f3c6ffb98ab553f4c1dda581fec257d4 +image: ghcr.io/lllamnyp/cozyplane@sha256:25c209e247a65ee3d430b0a1ba4f10ca2cf066d64c2bef10fdaa9f6c0266e48a imagePullPolicy: IfNotPresent imagePullSecrets: []