diff --git a/.github/crossplane-validate/extensions.yaml b/.github/crossplane-validate/extensions.yaml index 30e1721..86d32b0 100644 --- a/.github/crossplane-validate/extensions.yaml +++ b/.github/crossplane-validate/extensions.yaml @@ -1,14 +1,21 @@ # The Crossplane packages whose schemas CI validates deploy/ against, offline, with # `crossplane resource validate` (scripts/validate-crossplane-schemas.sh). # -# This is the single place the provider version is declared. Keep it equal to the +# This is the single place the provider versions are declared. Keep each equal to the # platform's pin in devantler-tech/platform -# k8s/providers/hetzner/infrastructure/crossplane/provider-aws-iam.yaml: the `aws` tenant -# reconciles against that version. CI compares the two on every run and reports a +# k8s/providers/hetzner/infrastructure/crossplane/.yaml: the `aws` +# tenant reconciles against those versions. CI compares each on every run and reports a # mismatch as a warning on the run. apiVersion: pkg.crossplane.io/v1 kind: Provider metadata: name: provider-aws-iam spec: - package: xpkg.upbound.io/upbound/provider-aws-iam:v2.9.1 + package: xpkg.upbound.io/upbound/provider-aws-iam:v2.9.4 +--- +apiVersion: pkg.crossplane.io/v1 +kind: Provider +metadata: + name: provider-aws-sesv2 +spec: + package: xpkg.upbound.io/upbound/provider-aws-sesv2:v2.9.4 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 65d410e..0a3d09f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -139,27 +139,30 @@ jobs: - name: 🧩 Validate deploy/ and prove the gate blocks run: bash scripts/test-validate-crossplane-schemas.sh "$RUNNER_TEMP/crossplane" - - name: 🔎 Compare the provider version with the platform's pin - # Reported, not enforced: the platform moves its pin in its own repository, and a + - name: 🔎 Compare the provider versions with the platform's pins + # Reported, not enforced: the platform moves its pins in its own repository, and a # failure here would turn every unrelated pull request red until this file follows. + # Each declared provider is compared with the platform file of the same name. run: | pkg='^xpkg\.upbound\.io/[a-z0-9/-]+:v[0-9]+\.[0-9]+\.[0-9]+$' - url=https://raw.githubusercontent.com/devantler-tech/platform/main/k8s/providers/hetzner/infrastructure/crossplane/provider-aws-iam.yaml - ours=$(sed -n 's/^ package: //p' .github/crossplane-validate/extensions.yaml) - if ! platform=$(curl -fsSL --retry 3 "$url" | sed -n 's/^ package: //p'); then - echo "::warning title=Provider pin not compared::could not read the platform's provider-aws-iam pin" - exit 0 - fi - # Only a plain package reference is echoed, so file content cannot reach a workflow command. - if ! [[ $ours =~ $pkg && $platform =~ $pkg ]]; then - echo "::warning title=Provider pin not compared::a package line is missing or not a plain package reference" - exit 0 - fi - if [ "$ours" != "$platform" ]; then - echo "::warning title=Provider pin mismatch::validated against ${ours}, but the platform runs ${platform}; update .github/crossplane-validate/extensions.yaml" - else - echo "Provider pin matches the platform: ${ours}" - fi + base=https://raw.githubusercontent.com/devantler-tech/platform/main/k8s/providers/hetzner/infrastructure/crossplane + for name in provider-aws-iam provider-aws-sesv2; do + ours=$(awk -v n="$name" '/^ name: /{cur=$2} /^ package: / && cur == n {print $2}' .github/crossplane-validate/extensions.yaml) + if ! platform=$(curl -fsSL --retry 3 "$base/$name.yaml" | sed -n 's/^ package: //p'); then + echo "::warning title=Provider pin not compared::could not read the platform's $name pin" + continue + fi + # Only a plain package reference is echoed, so file content cannot reach a workflow command. + if ! [[ $ours =~ $pkg && $platform =~ $pkg ]]; then + echo "::warning title=Provider pin not compared::a $name package line is missing or not a plain package reference" + continue + fi + if [ "$ours" != "$platform" ]; then + echo "::warning title=Provider pin mismatch::validated against ${ours}, but the platform runs ${platform}; update .github/crossplane-validate/extensions.yaml" + else + echo "Provider pin matches the platform: ${ours}" + fi + done ci-required-checks: name: CI - Required Checks diff --git a/AGENTS.md b/AGENTS.md index e49d746..986e0cd 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -27,8 +27,10 @@ It mirrors the `devantler-tech/.github` repo's `github-config` tenant pattern. - **Layout:** all managed resources live under `deploy/`, referenced from `deploy/kustomization.yaml`. Keep manifests namespace-agnostic (the platform-side tenant Kustomization injects the namespace). -- **What this tenant may own:** today, only the account's GitHub Actions OIDC identity - provider (`OpenIDConnectProvider`). The platform decides which AWS resource kinds are +- **What this tenant may own:** the account's GitHub Actions OIDC identity provider + (`OpenIDConnectProvider`), and company Email's SES domain identity and its MAIL FROM + domain (`EmailIdentity`, `EmailIdentityMailFromAttributes`). The SMTP sending identity + (IAM user, policy and access key) is platform-owned. The platform decides which AWS resource kinds are active and which of them this tenant may write. The EKS CI `Role` and its permissions boundary stay platform-owned on purpose, because the cap on what that identity may create lives inside the `Role`. diff --git a/deploy/email/email-identity-mail-from-attributes.yaml b/deploy/email/email-identity-mail-from-attributes.yaml new file mode 100644 index 0000000..0c653f0 --- /dev/null +++ b/deploy/email/email-identity-mail-from-attributes.yaml @@ -0,0 +1,24 @@ +# A custom MAIL FROM domain for the company mail identity, so the envelope +# sender is under the mailbox domain and SPF aligns for DMARC. Its MX and SPF +# records are published by the DNS owner. Until they resolve, SES falls back to +# its own MAIL FROM domain (UseDefaultValue), so mail keeps flowing and DMARC +# still passes through the aligned DKIM signature. +apiVersion: sesv2.aws.m.upbound.io/v1beta1 +kind: EmailIdentityMailFromAttributes +metadata: + name: company-mail-domain + annotations: + crossplane.io/external-name: devantler.tech +spec: + managementPolicies: + - Observe + - Create + - Update + - LateInitialize + forProvider: + region: eu-central-1 + mailFromDomain: bounce.devantler.tech + behaviorOnMxFailure: UseDefaultValue + providerConfigRef: + kind: ProviderConfig + name: default diff --git a/deploy/email/email-identity.yaml b/deploy/email/email-identity.yaml new file mode 100644 index 0000000..f60344d --- /dev/null +++ b/deploy/email/email-identity.yaml @@ -0,0 +1,24 @@ +# The company mail domain as an SES identity, verified by Easy DKIM. SES signs +# every relayed message with this domain's 2048-bit key; the three DKIM tokens +# appear in status.atProvider.dkimSigningAttributes.tokens and are published as +# CNAME records by the DNS owner. Delete is omitted so a prune can never +# remove the identity that outbound company mail depends on. +apiVersion: sesv2.aws.m.upbound.io/v1beta1 +kind: EmailIdentity +metadata: + name: company-mail-domain + annotations: + crossplane.io/external-name: devantler.tech +spec: + managementPolicies: + - Observe + - Create + - Update + - LateInitialize + forProvider: + region: eu-central-1 + dkimSigningAttributes: + nextSigningKeyLength: RSA_2048_BIT + providerConfigRef: + kind: ProviderConfig + name: default diff --git a/deploy/email/kustomization.yaml b/deploy/email/kustomization.yaml new file mode 100644 index 0000000..0e4bba4 --- /dev/null +++ b/deploy/email/kustomization.yaml @@ -0,0 +1,13 @@ +# Company Email's outbound relay (devantler-tech/platform#5481): the Amazon SES +# domain identity that signs relayed mail with Easy DKIM, and its custom MAIL +# FROM domain so SPF aligns with the mailbox domain for DMARC. +# +# This repository owns only these two SES resources, which grant no AWS +# permission to anyone. The SMTP sending identity (IAM user, policy and access +# key) is owned by devantler-tech/platform, for the same reason the EKS CI role +# is: what caps a credential must not be editable by this public artifact. +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: + - email-identity.yaml + - email-identity-mail-from-attributes.yaml diff --git a/deploy/kustomization.yaml b/deploy/kustomization.yaml index 757e3d7..6c80f71 100644 --- a/deploy/kustomization.yaml +++ b/deploy/kustomization.yaml @@ -12,4 +12,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization resources: - eks-ci/ + - email/