diff --git a/k8s/bases/infrastructure/cluster-policies/best-practices/restrict-tenant-route-hostnames.yaml b/k8s/bases/infrastructure/cluster-policies/best-practices/restrict-tenant-route-hostnames.yaml index c43aa9ff1b..3257ae4fd8 100644 --- a/k8s/bases/infrastructure/cluster-policies/best-practices/restrict-tenant-route-hostnames.yaml +++ b/k8s/bases/infrastructure/cluster-policies/best-practices/restrict-tenant-route-hostnames.yaml @@ -19,8 +19,10 @@ # domain). Each list is that tenant's own declared set from its # deploy/httproute.yaml, covering the production hostname and the *.platform.lan # name used on local/dev clusters where the tenant declares one. business-site -# declares its host in deploy/webapp.yaml and has one public staging name only; -# its production hostname stays on GitHub Pages until a separate cutover. +# declares its staging host in deploy/webapp.yaml and its public and portal +# names in deploy/http-route-public.yaml and http-route-portal.yaml +# (platform#6177). The apex and www keep their GitHub Pages DNS records until a +# separate cutover, so admitting them here changes no live traffic before it. # # Fail-closed for anything NOT listed: the final validation denies every HTTPRoute in a # ksail tenant namespace that has no allow-list above, so a newly onboarded @@ -119,11 +121,12 @@ spec: - expression: >- object.metadata.namespace != 'business-site' || (size(variables.hostnames) > 0 && - variables.hostnames.all(h, h in ['business-site.platform.devantler.tech'])) + variables.hostnames.all(h, h in ['business-site.platform.devantler.tech', 'devantler.tech', 'www.devantler.tech', 'portal.devantler.tech'])) message: >- business-site HTTPRoutes must set spec.hostnames and may only use - business-site.platform.devantler.tech. Omitting hostnames claims every - hostname on the shared platform Gateway listener. + business-site.platform.devantler.tech, devantler.tech, + www.devantler.tech or portal.devantler.tech. Omitting hostnames claims + every hostname on the shared platform Gateway listener. # Catch-all: any ksail tenant namespace without an allow-list above. This is # what makes onboarding fail loudly instead of silently unrestricted, the # exact gap that once left this policy covering only wedding-app while other diff --git a/k8s/providers/hetzner/apps/business-site/certificate.yaml b/k8s/providers/hetzner/apps/business-site/certificate.yaml new file mode 100644 index 0000000000..f53a41e98e --- /dev/null +++ b/k8s/providers/hetzner/apps/business-site/certificate.yaml @@ -0,0 +1,23 @@ +# Platform-applied DNS-01 issuance for the names the business-site package +# routes: the public site (devantler.tech, www) and the portal. The shared +# Cloudflare ClusterIssuer already issues the zone's other names (see +# world-at-ruin/certificate.yaml); the Gateway listeners in +# infrastructure/patches/add-devantler-tech-listeners.yaml read this Secret +# through reference-grant.yaml. Issuance needs no listener and no DNS record, +# so it can complete before the apex and www leave GitHub Pages +# (devantler-tech/monorepo#3939). +apiVersion: cert-manager.io/v1 +kind: Certificate +metadata: + name: devantler-tech + namespace: business-site +spec: + secretName: devantler-tech-tls + dnsNames: + - devantler.tech + - www.devantler.tech + - portal.devantler.tech + issuerRef: + group: cert-manager.io + kind: ClusterIssuer + name: letsencrypt-prod diff --git a/k8s/providers/hetzner/apps/business-site/kustomization.yaml b/k8s/providers/hetzner/apps/business-site/kustomization.yaml index 0b4cd23c79..f57d63fa8f 100644 --- a/k8s/providers/hetzner/apps/business-site/kustomization.yaml +++ b/k8s/providers/hetzner/apps/business-site/kustomization.yaml @@ -4,3 +4,5 @@ resources: - tenant.yaml - cilium-network-policy-staging-hold.yaml - cilium-network-policy-customer-identity-hold.yaml + - certificate.yaml + - reference-grant.yaml diff --git a/k8s/providers/hetzner/apps/business-site/reference-grant.yaml b/k8s/providers/hetzner/apps/business-site/reference-grant.yaml new file mode 100644 index 0000000000..2a6fcf5670 --- /dev/null +++ b/k8s/providers/hetzner/apps/business-site/reference-grant.yaml @@ -0,0 +1,18 @@ +# Lets the shared platform Gateway (kube-system) terminate TLS for the +# devantler.tech listeners with the platform-issued certificate.yaml Secret. +# Gateway API refuses a cross-namespace certificateRef without this grant +# (ResolvedRefs=False / RefNotPermitted). It names that one Secret only. +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: ReferenceGrant +metadata: + name: platform-gateway-devantler-tech-tls + namespace: business-site +spec: + from: + - group: gateway.networking.k8s.io + kind: Gateway + namespace: kube-system + to: + - group: "" + kind: Secret + name: devantler-tech-tls diff --git a/k8s/providers/hetzner/apps/business-site/tenant.yaml b/k8s/providers/hetzner/apps/business-site/tenant.yaml index 035a31939e..7c57aac381 100644 --- a/k8s/providers/hetzner/apps/business-site/tenant.yaml +++ b/k8s/providers/hetzner/apps/business-site/tenant.yaml @@ -1,7 +1,8 @@ -# Public-only staging: the tenant reconciles its signed v3.0.0 package — the +# Public-only staging: the tenant reconciles its signed v3.2.2 package — the # WebApp at business-site.platform.devantler.tech, its network policy, budget # and disclosure input — while the platform-owned staging hold still denies -# gateway traffic. Portal identity, payments and devantler.tech stay off. +# gateway traffic. Portal identity and payments stay off, and devantler.tech +# keeps pointing at GitHub Pages until the DNS cutover. apiVersion: kro.run/v1alpha1 kind: Tenant metadata: @@ -13,6 +14,6 @@ spec: sops: false webApp: true source: - digest: sha256:7ec5b206635db783d8fd18789605a771cc772946f65339d3f0a2b4e08a14ebc6 - publisherRevision: d8b5d0e9429cebf12907e0d4cb448433d3108e4b + digest: sha256:78401ed9c68e66427e826bb610d42c6c307ec67135b99be4ce956f21073baaa8 + publisherRevision: af042c540ce8db4d64add98c34b5c57691e0e812 reconcileApplication: true diff --git a/k8s/providers/hetzner/infrastructure/kustomization.yaml b/k8s/providers/hetzner/infrastructure/kustomization.yaml index ac9829d3cb..9436680525 100644 --- a/k8s/providers/hetzner/infrastructure/kustomization.yaml +++ b/k8s/providers/hetzner/infrastructure/kustomization.yaml @@ -277,6 +277,14 @@ patches: kind: Gateway name: platform namespace: kube-system + # Adds HTTPS listeners for the business-site public and portal names; see the + # file header. + - path: patches/add-devantler-tech-listeners.yaml + target: + group: gateway.networking.k8s.io + kind: Gateway + name: platform + namespace: kube-system # Prod-only Coroot tuning: hcloud-backed persistent storage + Slack webhook # wiring. The CR it patches comes from ../../../bases/infrastructure/coroot/ # (the `infrastructure` layer); the strategic-merge patch matches on the diff --git a/k8s/providers/hetzner/infrastructure/patches/add-devantler-tech-listeners.yaml b/k8s/providers/hetzner/infrastructure/patches/add-devantler-tech-listeners.yaml new file mode 100644 index 0000000000..0982301794 --- /dev/null +++ b/k8s/providers/hetzner/infrastructure/patches/add-devantler-tech-listeners.yaml @@ -0,0 +1,83 @@ +# Serve the business-site package's public and portal names on the shared +# platform Gateway (platform#6177). SNI picks the most specific listener, so +# these terminate TLS with the names' own certificate while every other +# hostname keeps the hostname-less `https` listener and its ${domain} wildcard. +# JSON patch, not strategic merge: Gateway is a CRD, so a strategic-merge patch +# would replace the whole listeners list instead of appending. +# +# The section names are the ones the package's HTTPRoutes attach to +# (business-site deploy/http-route-public.yaml and http-route-portal.yaml). +# The certificateRefs point cross-namespace at the platform-issued +# business-site/devantler-tech-tls Secret (apps/business-site/certificate.yaml), +# which apps/business-site/reference-grant.yaml lets this Gateway read. Until the +# certificate issues, a listener stays ResolvedRefs=False while the Gateway +# stays Programmed, so it never gates reconciliation. +# +# external-dns creates portal.devantler.tech from its route. The apex and www +# keep their GitHub Pages records until the cutover hands them to external-dns +# (devantler-tech/monorepo#3939), because external-dns never overwrites a record +# it does not own. +# +# Each listener pins `allowedRoutes.kinds` to HTTPRoute, matching the base +# Gateway's listeners; see k8s/bases/infrastructure/gateway/gateway.yaml for why +# an unpinned HTTPS listener is a hostname-claiming gap. +- op: add + path: /spec/listeners/- + value: + name: https-devantler-tech + hostname: devantler.tech + port: 443 + protocol: HTTPS + tls: + mode: Terminate + certificateRefs: + - kind: Secret + group: "" + namespace: business-site + name: devantler-tech-tls + allowedRoutes: + namespaces: + from: All + kinds: + - group: gateway.networking.k8s.io + kind: HTTPRoute +- op: add + path: /spec/listeners/- + value: + name: https-www-devantler-tech + hostname: www.devantler.tech + port: 443 + protocol: HTTPS + tls: + mode: Terminate + certificateRefs: + - kind: Secret + group: "" + namespace: business-site + name: devantler-tech-tls + allowedRoutes: + namespaces: + from: All + kinds: + - group: gateway.networking.k8s.io + kind: HTTPRoute +- op: add + path: /spec/listeners/- + value: + name: https-portal-devantler-tech + hostname: portal.devantler.tech + port: 443 + protocol: HTTPS + tls: + mode: Terminate + certificateRefs: + - kind: Secret + group: "" + namespace: business-site + name: devantler-tech-tls + allowedRoutes: + namespaces: + from: All + kinds: + - group: gateway.networking.k8s.io + kind: HTTPRoute diff --git a/scripts/canonical-tenant-source-bindings.json b/scripts/canonical-tenant-source-bindings.json index 19b39111da..7265ac802b 100644 --- a/scripts/canonical-tenant-source-bindings.json +++ b/scripts/canonical-tenant-source-bindings.json @@ -5,7 +5,7 @@ "consumer": "business-site", "consumerRepository": "devantler-tech/business-site", "workflow": "publish-app", - "kind": "published-binding", + "kind": "published-upgrade", "sourcePath": "k8s/providers/hetzner/apps/business-site/tenant.yaml", "constructorSpecSha256": "f48b056756b6d49c9b3f741fd597b70ae7c195cadf1ba523a3fec63c1c336d8d", "tenantIdentity": { @@ -20,17 +20,55 @@ "namespace": "business-site", "name": "business-site", "artifactURL": "oci://ghcr.io/devantler-tech/business-site/manifests", - "digest": "sha256:7ec5b206635db783d8fd18789605a771cc772946f65339d3f0a2b4e08a14ebc6" + "digest": "sha256:78401ed9c68e66427e826bb610d42c6c307ec67135b99be4ce956f21073baaa8" }, "publication": { - "gitTag": "v3.0.0", - "sourceSHA": "84d4cc47b800597f7683e22dad1c23cfa320434f", - "publisherIdentity": "devantler-tech/.github/.github/workflows/publish-app.yaml@d8b5d0e9429cebf12907e0d4cb448433d3108e4b", + "gitTag": "v3.2.2", + "sourceSHA": "6fdbbf6db9357c8754e55be2c737308378690d20", + "publisherIdentity": "devantler-tech/.github/.github/workflows/publish-app.yaml@af042c540ce8db4d64add98c34b5c57691e0e812", "callerWorkflow": ".github/workflows/publish-runtime.yaml", "event": "release", - "workflowRunId": 41631861843, + "workflowRunId": 43435792740, "workflowRunAttempt": 1, - "verifiedOn": "2026-11-03" + "verifiedOn": "2026-11-13" + }, + "previousBinding": { + "consumer": "business-site", + "consumerRepository": "devantler-tech/business-site", + "workflow": "publish-app", + "kind": "published-binding", + "sourcePath": "k8s/providers/hetzner/apps/business-site/tenant.yaml", + "constructorSpecSha256": "f48b056756b6d49c9b3f741fd597b70ae7c195cadf1ba523a3fec63c1c336d8d", + "tenantIdentity": { + "apiVersion": "kro.run/v1alpha1", + "kind": "Tenant", + "namespace": "flux-system", + "name": "business-site" + }, + "sourceIdentity": { + "apiVersion": "source.toolkit.fluxcd.io/v1", + "kind": "OCIRepository", + "namespace": "business-site", + "name": "business-site", + "artifactURL": "oci://ghcr.io/devantler-tech/business-site/manifests", + "digest": "sha256:7ec5b206635db783d8fd18789605a771cc772946f65339d3f0a2b4e08a14ebc6" + }, + "publication": { + "gitTag": "v3.0.0", + "sourceSHA": "84d4cc47b800597f7683e22dad1c23cfa320434f", + "publisherIdentity": "devantler-tech/.github/.github/workflows/publish-app.yaml@d8b5d0e9429cebf12907e0d4cb448433d3108e4b", + "callerWorkflow": ".github/workflows/publish-runtime.yaml", + "event": "release", + "workflowRunId": 41631861843, + "workflowRunAttempt": 1, + "verifiedOn": "2026-11-03" + } + }, + "previousObservation": { + "uidSha256": "38aff5c8aafbd89fc51dbbe131d27c9a3fb0e78108a20779d0e7a5680a6cc2d2", + "generation": 3, + "snapshotSha256": "8b662b4f0b5ec50bd31eb3fbfc74eeb256288a2dbbae5f482d8f968eb6f2b33a", + "observedOn": "2026-11-13" } } ] diff --git a/scripts/publish-workflow-canonical-approvals.tsv b/scripts/publish-workflow-canonical-approvals.tsv index f471dac367..bdcd610e41 100644 --- a/scripts/publish-workflow-canonical-approvals.tsv +++ b/scripts/publish-workflow-canonical-approvals.tsv @@ -5,8 +5,8 @@ aws publish-manifests devantler-tech/.github bd24a3e1bbbf6aba2d7afd58a2fd8a3d67b .github publish-manifests devantler-tech/.github 2666baeaf1384d3c2d918e19692b8a6d9fb6fd78 ascoachingogvaner publish-app devantler-tech/.github 467f07582436a26b62cf4aa756423512f85ba0c0 ascoachingogvaner publish-app devantler-tech/.github af042c540ce8db4d64add98c34b5c57691e0e812 -business-site publish-app devantler-tech/.github 467f07582436a26b62cf4aa756423512f85ba0c0 business-site publish-app devantler-tech/.github d8b5d0e9429cebf12907e0d4cb448433d3108e4b +business-site publish-app devantler-tech/.github af042c540ce8db4d64add98c34b5c57691e0e812 data-product-controller publish-app devantler-tech/.github 467f07582436a26b62cf4aa756423512f85ba0c0 wedding-app publish-app devantler-tech/.github 467f07582436a26b62cf4aa756423512f85ba0c0 wedding-app publish-app devantler-tech/.github af042c540ce8db4d64add98c34b5c57691e0e812 diff --git a/scripts/rgd-template-static-scan-baseline.tsv b/scripts/rgd-template-static-scan-baseline.tsv index 75964bca40..9d49af176a 100644 --- a/scripts/rgd-template-static-scan-baseline.tsv +++ b/scripts/rgd-template-static-scan-baseline.tsv @@ -42,4 +42,4 @@ 1 k8s/bases/infrastructure/resource-graph-definitions/webapp/resource-graph-definition.yaml.resources/service.yaml KSV-0040 LOW CAUSE-SHA256:79c2597bf128e3ca530288250548c211e5e43a66a10d3c88748c6db4ac565920 1 k8s/providers/docker/apps/tenant-ascoachingogvaner.yaml INSTANCE-CONTENT SHA256 7e65481a62deb24c89dca2e5f83969e308e7604e770d97edb15e86ecc948f22c 1 k8s/providers/docker/apps/web-app-wedding-app.yaml INSTANCE-CONTENT SHA256 3d42027c7e549014cad1e717876a6eb72e0a6641f3bf181f7a0e1a70d94306d6 -1 k8s/providers/hetzner/apps/business-site/tenant.yaml INSTANCE-CONTENT SHA256 f41cf288531722e872f273a55d0ed3d8827c642f49d37341f9e7f4a88fd75d45 +1 k8s/providers/hetzner/apps/business-site/tenant.yaml INSTANCE-CONTENT SHA256 b9c7d9964a40b82db85da1784fbd8b0baf6f5e36f7de2c41f0a3c323e2c2fb46 diff --git a/scripts/tests/test-bootstrap-tenant-source.sh b/scripts/tests/test-bootstrap-tenant-source.sh index 5b16ecb65f..db62c99ac2 100755 --- a/scripts/tests/test-bootstrap-tenant-source.sh +++ b/scripts/tests/test-bootstrap-tenant-source.sh @@ -206,7 +206,7 @@ echo 'bootstrap requires complete inventory and a verified immutable publication biz_work="$test_work/business" mkdir -p "$biz_work/bin" export BIZ_WORK="$biz_work" -export BIZ_SIGNER=467f07582436a26b62cf4aa756423512f85ba0c0 +export BIZ_SIGNER=af042c540ce8db4d64add98c34b5c57691e0e812 for approval in publish-workflow-approved-revisions.tsv publish-workflow-approved-revisions.identities.tsv \ publish-workflow-canonical-approvals.tsv publish-workflow-bootstrap-publications.json; do cp "$test_repo_root/scripts/$approval" "$biz_work/before-$approval" @@ -320,7 +320,7 @@ jq -e 'keys == ["callerWorkflow","consumer","deploymentAuthorized","digest","eve .deploymentAuthorized==false and .gitTag=="v1.0.2" and .sourceSHA=="e5eb256dcb5dbf3857257e9072937ab95f1ea6c3" and .digest=="sha256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" and - .publisherIdentity=="devantler-tech/.github/.github/workflows/publish-app.yaml@467f07582436a26b62cf4aa756423512f85ba0c0" and + .publisherIdentity=="devantler-tech/.github/.github/workflows/publish-app.yaml@af042c540ce8db4d64add98c34b5c57691e0e812" and .callerWorkflow==".github/workflows/publish-runtime.yaml" and .event=="release" and .workflowRunId==39869859801 and .workflowRunAttempt==1' "$biz_work/receipt.json" >/dev/null if read_bound_publications "$test_repo_root" "$biz_work/receipt.json" >/dev/null 2>&1; then @@ -365,7 +365,7 @@ for BIZ_SIGNER in f5d078cc4b04ecb15432ed4e34cba1142a6279d4 111111111111111111111 fi test ! -s "$biz_work/refusal" done -BIZ_SIGNER=467f07582436a26b62cf4aa756423512f85ba0c0 +BIZ_SIGNER=af042c540ce8db4d64add98c34b5c57691e0e812 for BIZ_CASE in wrong-event wrong-caller wrong-source wrong-tag wrong-product wrong-publisher duplicate-publisher \ malformed-list trailing-list incomplete-list run-read-failure tag-read-failure wrong-caller-pin multi-document-caller \ signature-failure malformed-signature trailing-signature wrong-digest wrong-reference changed-attempt moved-tag withdrawn-release \ diff --git a/scripts/tests/test-tenant-controller-namespace-coverage.sh b/scripts/tests/test-tenant-controller-namespace-coverage.sh index b2e8a1c614..a1ca16a757 100755 --- a/scripts/tests/test-tenant-controller-namespace-coverage.sh +++ b/scripts/tests/test-tenant-controller-namespace-coverage.sh @@ -25,7 +25,7 @@ while IFS=$'\t' read -r family passed denied skipped; do done <<'CASES' restrict-tenant-secret-stores 5 7 0 restrict-tenant-issuer-refs 4 3 0 -restrict-tenant-route-hostnames 4 17 0 +restrict-tenant-route-hostnames 6 18 0 restrict-tenant-network-policies 19 80 1 restrict-tenant-image-repositories 7 11 0 CASES diff --git a/scripts/validate-eks-ci-role-policy/approved-surface.txt b/scripts/validate-eks-ci-role-policy/approved-surface.txt index 5e56ce68f9..4dae63aac3 100644 --- a/scripts/validate-eks-ci-role-policy/approved-surface.txt +++ b/scripts/validate-eks-ci-role-policy/approved-surface.txt @@ -132,7 +132,7 @@ iam.aws.m.upbound.io/v1beta1|Role|aws|ses-account-setup 7faa58457f4a17a3c14368d3 kro.run/v1alpha1|ResourceGraphDefinition||tenant.kro.run 72f3f972cecdf3ca2e315deb4224bd28c1df1244fc7973a88eb7f4fc03ac1d05 -kro.run/v1alpha1|Tenant|flux-system|business-site 47380ca8c8781c2de6b17226e44ac7cef030e13a89c8b41dae9ddf459304b3a4 +kro.run/v1alpha1|Tenant|flux-system|business-site e399acf3fa79ab13dfed2c6efe02840d963e97584bbdf29a85d247784348f6bb kustomize.toolkit.fluxcd.io/v1|Kustomization|ascoachingogvaner|ascoachingogvaner ac00ca29c04de8d2c30a045d583570536a97fc305a1b06c4300da018ecdfb864 diff --git a/tests/restrict-tenant-route-hostnames/kyverno-test.yaml b/tests/restrict-tenant-route-hostnames/kyverno-test.yaml index 85348979fb..bf1e655299 100644 --- a/tests/restrict-tenant-route-hostnames/kyverno-test.yaml +++ b/tests/restrict-tenant-route-hostnames/kyverno-test.yaml @@ -48,15 +48,18 @@ results: - ascoachingogvaner/approved-plus-wildcard kind: HTTPRoute result: fail - # --- business-site: one public staging hostname --- + # --- business-site: the staging, public and portal hostnames --- - policy: restrict-tenant-route-hostnames resources: - business-site/approved-staging-hostname + - business-site/approved-public-hostnames + - business-site/approved-portal-hostname kind: HTTPRoute result: pass - policy: restrict-tenant-route-hostnames resources: - - business-site/production-hostname + - business-site/unlisted-devantler-subdomain + - business-site/devantler-wildcard - business-site/steals-wedding-hostname - business-site/no-hostnames - business-site/wildcard-covering-approved diff --git a/tests/restrict-tenant-route-hostnames/resources.yaml b/tests/restrict-tenant-route-hostnames/resources.yaml index 6f0b492f11..932bc0e619 100644 --- a/tests/restrict-tenant-route-hostnames/resources.yaml +++ b/tests/restrict-tenant-route-hostnames/resources.yaml @@ -253,8 +253,8 @@ spec: - name: ascoachingogvaner port: 80 --- -# business-site — the KRO-rendered route from its tenant-owned WebApp. Only the -# public staging hostname is approved. +# business-site — the KRO-rendered route from its tenant-owned WebApp, on the +# public staging hostname. apiVersion: gateway.networking.k8s.io/v1 kind: HTTPRoute metadata: @@ -268,15 +268,58 @@ spec: - name: business-site port: 80 --- -# The production hostname stays on GitHub Pages until a separate cutover. +# The package-owned public route: the apex and www (platform#6177). apiVersion: gateway.networking.k8s.io/v1 kind: HTTPRoute metadata: - name: production-hostname + name: approved-public-hostnames namespace: business-site spec: hostnames: - devantler.tech + - www.devantler.tech + rules: + - backendRefs: + - name: business-site + port: 80 +--- +# The package-owned portal route (platform#6177). +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: approved-portal-hostname + namespace: business-site +spec: + hostnames: + - portal.devantler.tech + rules: + - backendRefs: + - name: business-site + port: 80 +--- +# Another devantler.tech name is not on the list. +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: unlisted-devantler-subdomain + namespace: business-site +spec: + hostnames: + - api.devantler.tech + rules: + - backendRefs: + - name: business-site + port: 80 +--- +# A wildcard covering the approved names is not itself an approved name. +apiVersion: gateway.networking.k8s.io/v1 +kind: HTTPRoute +metadata: + name: devantler-wildcard + namespace: business-site +spec: + hostnames: + - "*.devantler.tech" rules: - backendRefs: - name: business-site