cozystack/hack
Aleksei Sviridkin 49d896caca
feat(gateway): per-tenant Issuer enables child-tenant ACME, VAP unconditional
Two correctness fixes for multi-tenant Gateway ACME, plus a small
default-tightening.

1. Per-tenant Issuer (child-tenant ACME closes)

packages/extra/gateway/templates/issuer.yaml (new): render a
cert-manager.io/v1 Issuer named 'gateway' in the tenant's own
namespace. It carries its own ACME account (privateKeySecretRef
'gateway-acme-account') and an http01.gatewayHTTPRoute solver whose
parentRef points to the local Gateway 'cozystack' at sectionName http
— no namespace on parentRef, so it attaches in-namespace only.

packages/extra/gateway/templates/gateway.yaml: the wildcard
Certificate now references issuerRef kind: Issuer, name: gateway
(namespace-scoped) instead of the previous cluster-scoped
letsencrypt-prod. The result: every tenant that enables
tenant.spec.gateway=true gets a fully self-contained ACME flow —
its own account, its own HTTPRoute, its own Gateway, no cross-
namespace dependency on the publishing tenant. Child tenants with
gateway: true now work end-to-end for ACME HTTP-01.

The template maps 'publishing.certificates.issuerName' to a
concrete ACME server URL: letsencrypt-prod →
acme-v02.api.letsencrypt.org/directory, letsencrypt-stage →
acme-staging-v02.api.letsencrypt.org/directory. Any other value
fails the render with an explicit error pointing at the file to
extend.

Three new helm-unittest cases cover Certificate→Issuer linkage,
staging-server selection, and the unknown-issuer fail path.

2. Hostname VAP installs unconditionally

packages/system/cozystack-basics/templates/gateway-hostname-policy.yaml:
drop the 'eq gateway-enabled true' guard. The ValidatingAdmissionPolicy
now installs whenever publishing.host is set, regardless of whether
gateway.enabled is flipped. Rationale: Gateway CRDs ship
unconditionally (gateway-api-crds is loaded in every bundle), so a
tenant could create a Gateway manually even with gateway.enabled=false.
The VAP must guard that path too.

3. Restore opt-in default in e2e

hack/e2e-install-cozystack.bats: revert the gateway.enabled: true
line so the default e2e platform configuration matches production
defaults. Gateway API remains strictly opt-in. The
'exposed services render HTTPRoute/TLSRoute but not Ingress' test
(which required platform-wide gateway.enabled=true) is removed; the
VAP cross-tenant reject test stays and now works against the
unconditionally-installed policy.

Assisted-By: Claude <noreply@anthropic.com>
Signed-off-by: Aleksei Sviridkin <f@lex.la>
2026-04-24 17:03:59 +03:00
..
e2e-apps feat(gateway): per-tenant Issuer enables child-tenant ACME, VAP unconditional 2026-04-24 17:03:59 +03:00
boilerplate.go.txt Introduce cozystack-controller (#560) 2025-01-09 12:24:51 +01:00
cdi_golden_image_create.sh [vm-default-images] Added new optional package 2026-04-14 19:59:19 +05:00
check-host-runtime.bats test(hack): assert sudo prefix in single-service HINTs, explicit exit code, and glob regression 2026-04-11 14:36:58 +03:00
check-host-runtime.sh fix(hack): wrap du in 'timeout 5s' to prevent preflight stall 2026-04-11 17:07:35 +03:00
check-optional-repos.sh Rename cozypkg to cozyhr 2025-12-25 16:54:22 +01:00
check-readiness.sh Added check-readiness.sh script 2026-03-29 13:16:35 +05:00
collect-images.sh [dx] Refactor collect-images functionality 2025-07-03 14:26:56 +03:00
common-envs.mk fix(build): filter git describe to match only v* tags 2026-04-13 14:25:25 +02:00
cozyreport.sh [ci] Cozyreport improvements 2026-02-11 17:09:47 +03:00
cozytest.sh [tests] Add pre-cleanup, fix port-forward race, fix temp leak 2026-03-23 17:25:01 +03:00
download-dashboards.sh Add monitoring for NATs 2026-02-17 22:54:12 +01:00
e2e-install-cozystack.bats feat(gateway): per-tenant Issuer enables child-tenant ACME, VAP unconditional 2026-04-24 17:03:59 +03:00
e2e-prepare-cluster.bats [ci] Run e2e tests on shared runners 2026-01-20 22:13:16 +01:00
e2e-test-openapi.bats [apps] Refactor apiserver to use typed objects and fix UnstructuredList GVK 2025-12-01 22:06:23 +01:00
helm-unit-tests.sh [ci,dx] Add unit tests for cozy-lib 2025-11-19 17:56:17 +03:00
migrate-to-version-1.0.sh Fixed packages name conversion in migration script 2026-03-03 19:10:39 +05:00
package.mk refactor: move scripts to hack directory 2026-01-15 16:06:56 +01:00
pre-checks.sh Fix osx grep have no -P flag (#438) 2024-10-21 11:59:56 +02:00
update-codegen.sh [docs] Fixed controller-gen markers 2026-03-25 15:57:25 +05:00
update-crd.sh refactor(labels): remove cozystack.io/ui label 2026-01-19 13:59:29 +01:00
upload-assets.sh [docs] Added openapi generation tool 2026-03-25 15:57:25 +05:00
upload-releasenotes.sh Add AI-agent for changelogs generation 2025-11-26 20:18:43 +01:00