ce7cb702218693d08ea6d83464d2457c9250027c

This commit is contained in:
ms2k 2026-11-12 20:46:28 +09:00
commit 34c5f8963c
13 changed files with 145336 additions and 0 deletions

View file

@ -0,0 +1,8 @@
apiVersion: v1
kind: ServiceAccount
metadata:
name: stalwart
namespace: stalwart
automountServiceAccountToken: false
imagePullSecrets:
- name: quay-cluster-pull

View file

@ -0,0 +1,57 @@
[
{
"clientIdFile": "/run/control/notifier_client_id",
"clientSecretFile": "/run/control/notifier_client_secret",
"username": "********",
"description": "zitadel-notification-v1",
"vaultPath": "secret/data/stalwart/zitadel-notification",
"vaultKey": "smtp_password",
"permissions": {
"@type": "Replace",
"permissions": {
"authenticate": true,
"emailSend": true
}
}
},
{
"clientIdFile": "/run/control/sender_client_id",
"clientSecretFile": "/run/control/sender_client_secret",
"username": "********",
"description": "alert-submit-v1",
"vaultPath": "secret/data/stalwart/alert-identity",
"vaultKey": "smtp_password",
"permissions": {
"@type": "Replace",
"permissions": {
"authenticate": true,
"emailSend": true
}
}
},
{
"clientIdFile": "/run/control/test_client_id",
"clientSecretFile": "/run/control/test_client_secret",
"username": "********",
"description": "test-mail-v1",
"vaultPath": "secret/data/stalwart/test-client",
"vaultKey": "password",
"permissions": {
"@type": "Replace",
"permissions": {
"authenticate": true,
"emailReceive": true,
"emailSend": true,
"imapAuthenticate": true,
"imapCapability": true,
"imapExamine": true,
"imapFetch": true,
"imapIdle": true,
"imapList": true,
"imapSearch": true,
"imapSelect": true,
"imapStatus": true
}
}
}
]

View file

@ -0,0 +1,8 @@
apiVersion: v1
kind: Secret
metadata:
name: stalwart-tls
namespace: stalwart
annotations:
reflector.v1.k8s.emberstack.com/reflects: kube-system/gateway-relay-tls
type: kubernetes.io/tls

View file

@ -0,0 +1,13 @@
{
"@type": "PostgreSql",
"host": "main-rw.postgres.svc.cluster.local",
"port": 5432,
"database": "stalwart",
"authUsername": "stalwart",
"authSecret": {
"@type": "EnvironmentVariable",
"variableName": "STALWART_DB_PASSWORD"
},
"useTls": false,
"allowInvalidCerts": false
}

View file

@ -0,0 +1,22 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- namespace.yaml
- account.yaml
- certificate.yaml
- vault/auth.yaml
- vault/quay-pull.yaml
- vault/database.yaml
- vault/delivery.yaml
- vault/identity.yaml
- vault/runtime.yaml
configMapGenerator:
- name: startup
namespace: stalwart
files:
- config.json
- name: desired
namespace: stalwart
files:
- app-passwords.json
- plan.json

View file

@ -0,0 +1,7 @@
apiVersion: v1
kind: Namespace
metadata:
name: stalwart
labels:
gateway.quorate.internal/allow-internal: "true"
security.quorate.internal/public-runtime: gvisor

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,12 @@
apiVersion: secrets.hashicorp.com/v1beta1
kind: VaultAuth
metadata:
name: default
namespace: stalwart
spec:
method: kubernetes
mount: kubernetes
kubernetes:
role: stalwart
serviceAccount: stalwart
vaultConnectionRef: vault/vault

View file

@ -0,0 +1,26 @@
apiVersion: secrets.hashicorp.com/v1beta1
kind: VaultDynamicSecret
metadata:
name: stalwart-db
namespace: stalwart
spec:
mount: database
path: static-creds/stalwart
allowStaticCreds: true
refreshAfter: 5m
destination:
name: stalwart-db
create: true
overwrite: true
transformation:
excludeRaw: true
excludes:
- .*
templates:
username:
text: '{{ get .Secrets "username" }}'
password:
text: '{{ get .Secrets "password" }}'
dsn:
text: 'postgresql://{{ get .Secrets "username" }}:{{ get .Secrets "password" }}@main-rw.postgres.svc.cluster.local:5432/stalwart?sslmode=disable'
vaultAuthRef: default

View file

@ -0,0 +1,25 @@
apiVersion: secrets.hashicorp.com/v1beta1
kind: VaultStaticSecret
metadata:
name: stalwart-delivery
namespace: stalwart
spec:
type: kv-v2
mount: secret
path: stalwart/oci-email-delivery
refreshAfter: 1h
destination:
name: stalwart-delivery
create: true
transformation:
excludeRaw: true
excludes:
- .*
templates:
relay_endpoint:
text: '{{ get .Secrets "endpoint" }}'
relay_password:
text: '{{ get .Secrets "password" }}'
relay_username:
text: '{{ get .Secrets "username" }}'
vaultAuthRef: default

View file

@ -0,0 +1,65 @@
apiVersion: secrets.hashicorp.com/v1beta1
kind: VaultStaticSecret
metadata:
name: stalwart-alert
namespace: stalwart
spec:
type: kv-v2
mount: secret
path: stalwart/alert-identity
refreshAfter: 1h
destination:
name: stalwart-alert
create: true
vaultAuthRef: default
---
apiVersion: secrets.hashicorp.com/v1beta1
kind: VaultStaticSecret
metadata:
name: mail-web
namespace: stalwart
spec:
type: kv-v2
mount: secret
path: stalwart/oidc/zitadel
refreshAfter: 1h
destination:
name: mail-web
create: true
transformation:
excludeRaw: true
excludes: [.*]
templates:
config.json:
text: '{{ dict "issuer" (get .Secrets "issuer_url") "clientId" (get .Secrets "account_client_id") "scope" (printf "openid profile urn:zitadel:iam:org:project:id:%s:aud" (get .Secrets "audience")) | toJson }}'
vaultAuthRef: default
---
apiVersion: secrets.hashicorp.com/v1beta1
kind: VaultStaticSecret
metadata:
name: stalwart-test-client
namespace: stalwart
spec:
type: kv-v2
mount: secret
path: stalwart/test-client
refreshAfter: 1h
destination:
name: stalwart-test-client
create: true
vaultAuthRef: default
---
apiVersion: secrets.hashicorp.com/v1beta1
kind: VaultStaticSecret
metadata:
name: stalwart-oidc
namespace: stalwart
spec:
type: kv-v2
mount: secret
path: stalwart/oidc/zitadel
refreshAfter: 1h
destination:
name: stalwart-oidc
create: true
vaultAuthRef: default

View file

@ -0,0 +1,29 @@
apiVersion: secrets.hashicorp.com/v1beta1
kind: VaultStaticSecret
metadata:
name: quay-cluster-pull
namespace: stalwart
spec:
type: kv-v2
mount: secret
path: quay/robots/cluster_pull
destination:
name: quay-cluster-pull
create: true
overwrite: true
type: kubernetes.io/dockerconfigjson
transformation:
excludeRaw: true
excludes:
- .*
templates:
.dockerconfigjson:
text: >-
{"auths":{"registry.quorate.internal":{"auth":"{{ printf "%s:%s" (get .Secrets "username") (get .Secrets "token") | b64enc }}"}}}
refreshAfter: 1h
rolloutRestartTargets:
- kind: Deployment
name: stalwart
- kind: Deployment
name: stalwart-controller
vaultAuthRef: default

View file

@ -0,0 +1,18 @@
apiVersion: secrets.hashicorp.com/v1beta1
kind: VaultStaticSecret
metadata:
name: stalwart-runtime
namespace: stalwart
spec:
type: kv-v2
mount: secret
path: stalwart/runtime
refreshAfter: 1h
destination:
name: stalwart-runtime
create: true
transformation:
templates:
dragonfly_url:
text: 'redis://default:{{ get .Secrets "dragonfly_password" }}@stalwart.dragonfly.svc.cluster.local:6379'
vaultAuthRef: default