Files
cozystack/packages/system/address-controller
Timofei Larkin 39918b7a72 feat(platform): package the address-controller and its MetalLB driver
Two optional system packages bring in IP addresses as a first-class resource
(cozystack/community#35): cozystack.address-controller, the class-agnostic
core (IPAddressClass / IPAddress / IPAddressClaim, local.sdn.cozystack.io),
and cozystack.metallb-iad, the driver implementing the contract for addresses
announced by MetalLB.

Both follow the umbrella shape: the upstream chart is vendored under charts/
from cozystack/address-controller and cozystack/metallb-iad, and what belongs
to Cozystack rather than to a generic Kubernetes controller lives in the
wrapper. Neither project publishes a chart artifact, so each `update` target
clones at a pinned commit, and the wrapper pins the image built from the
same controller code by digest; the charts' own floating :main defaults
would otherwise leave the controllers free to move underneath a cluster.

The wrapper carries the tenant grant. The upstream chart is Cozystack-
agnostic and grants only the controller, so nothing there lets a tenant use
the API it serves; cozy:addresses, cozy:addresses:view and cozy:addresses:admin
aggregate into the platform's base tenant roles, which resolve by label, so
the grant is present exactly while the package is. Only IPAddressClaim is
granted: the other two kinds are cluster-scoped and cozy:tenant* reaches a
tenant through a per-namespace RoleBinding, so a rule for either could never
be consulted.

The wrapper also turns on the driver's admission policy for tenant
namespaces. MetalLB honours a pin or pool selector from any writer of a
Service, through its current annotations, their metallb.universe.tf
predecessors and spec.loadBalancerIP alike, and a tenant cluster's cloud
provider copies a guest Service's annotations and loadBalancerIP onto the
Service it creates in the tenant namespace. Without the policy, a tenant
could steer MetalLB at an address reserved for someone else. Tenant
namespaces are the ones carrying namespace.cozystack.io/host, which
tenant-root and the tenant chart set and nothing in cozy-* does. An
admission policy binds every principal regardless of RBAC, so the
allowlist names Cozystack's OIDC administrators, cozystack-cluster-admin,
beside the chart's own two admin groups.

The driver points at cozy-metallb instead of the upstream default
metallb-system. Its PackageSource declares dependsOn on the core, whose CRDs
it needs, and on cozystack.metallb. The core installs with upgradeCRDs:
CreateReplace since its CRDs are v1alpha1 and still evolving. Neither package
is in the postgres E2E install closure, so both join the selective-install
fixture's disable list.

Assisted-by: LLM
Signed-off-by: Timofei Larkin <lllamnyp@gmail.com>
2026-11-16 06:49:47 +01:00
..