Kubernetes operator for managing mailcow resources with Custom Resource Definitions (CRDs). It reconciles Mailcow, Domain, Mailbox, Alias, and DomainAdmin resources.
- Declarative management of mailcow domains, mailboxes, aliases, and domain admins
- Finalizers to ensure clean deletion
- Kubernetes cluster
- mailcow deployment reachable from the operator
- helm (for installation via Helm)
The Helm chart lives in helm/chart.
Install CRDs and controller:
helm install mailcow-operator ./helm/chart \
--namespace mailcow-operator \
--create-namespaceor using the released version:
helm repo add mailcow-operator https://tarteo.github.io/mailcow-operator
helm install mailcow-operator mailcow-operator/mailcow-operator \
--namespace mailcow-operator \
--create-namespaceand to uninstall:
helm uninstall mailcow-operator --namespace mailcow-operatorThe operator manages these CRDs:
Mailcow— stores API endpoint and credentials referenceDomain— manages mail domainsMailbox— manages mailboxes for domainsAlias— manages aliasesDomainAdmin— manages domain administrators
apiVersion: mailcow.onestein.nl/v1
kind: Mailcow
metadata:
name: example-mailcow
spec:
endpoint: "https://mail.example.com"
secret:
name: mailcow-credentials
key: apiTokenapiVersion: mailcow.onestein.nl/v1
kind: Domain
metadata:
name: example-domain
spec:
mailcow: example-mailcow
domain: "example.com"
description: "Example Domain"
quota: 1000
defQuota: 500
maxQuota: 500
active: true
maxMailboxes: 60apiVersion: mailcow.onestein.nl/v1
kind: Mailbox
metadata:
name: example-mailbox
spec:
mailcow: example-mailcow
domain: example.com
localPart: "user"
name: "mr. example"
passwordSecret:
name: mailbox-password-secret
key: password
quota: 500
active: trueapiVersion: mailcow.onestein.nl/v1
kind: Alias
metadata:
name: example-alias
spec:
mailcow: example-mailcow
address: "@example.com" # Catch-all alias
goTo: "user@example.com"
active: trueapiVersion: mailcow.onestein.nl/v1
kind: DomainAdmin
metadata:
name: example-domainadmin
spec:
mailcow: example-mailcow
username: "test-example"
passwordSecret:
name: domainadmin-password-secret
key: password
domains:
- example.com
- example2.com
active: truemake manifests generatemake build
make runThe mailcow API is generated from the mailcow OpenAPI specification using oapi-codegen. The openapi.yaml is pulled from a mailcow version 2024-01d release. And then edited due to the specification not being fully correct and missing schemas for some endpoints.
oapi-codegen --config=mailcow/oapi-codegen.yaml mailcow/openapi.yaml- Add more controllers for other mailcow resources
- Add e2e tests
- Allow multiple goto addresses in aliases
- Make the created DKIM ConfigMap name configurable
- Add an option to force the password of mailbox resources to be updated on each reconciliation according to the secret
- Add an option to force the password and name of mailboxes to be updated on each reconciliation according to the secret and spec
- Add support for multiple mailcow versions
- Update status of mailboxes (quota used, etc.)
- Update status of domains (number of mailboxes, etc.)