Skip to content

Helm chart opendkim - #30

Merged
Aravinda-HWK merged 18 commits into
mainfrom
helm-chart-opendkim
Aug 7, 2026
Merged

Aravinda-HWK merged 18 commits into
mainfrom
helm-chart-opendkim

Conversation

@Aravinda-HWK

Copy link
Copy Markdown
Member

Description

Adds a Helm chart that runs the silver-dkim (OpenDKIM) milter on Kubernetes — the K8s counterpart of the opendkim-server service in docker-compose.yml. The chart generates opendkim.conf / KeyTable / SigningTable / TrustedHosts / silver.yaml deterministically from a domains list, persists DKIM private keys on a PVC, and exposes the Milter protocol on ClusterIP :8891 so Postfix can reach it as inet:opendkim-server:8891.

Type of Change

  • New feature
  • Bug fix
  • Documentation update
  • Code refactoring
  • Other (please describe):

Changes Made

  • New Helm chart silver-opendkim at mail-infra/helm/opendkim-server/ (Chart + values + templates + README).
  • templates/configmap.yaml renders all OpenDKIM config files (opendkim.conf, KeyTable, SigningTable, TrustedHosts, silver.yaml) from .Values.domains — replaces the host-side gen-opendkim-conf.sh flow used by docker-compose.
  • templates/deployment.yaml runs ghcr.io/lsflk/silver-dkim:main with runAsUser/Group: 999, fsGroup: 999, drop: [ALL], allowPrivilegeEscalation: false (mirrors the docker-compose cap_drop: all + no-new-privileges:true). Pod rolls automatically on config change via checksum/config annotation. Pinned to replicas: 1 with strategy: Recreate (DKIM is singleton + PVC is RWO).
  • templates/service.yaml exposes ClusterIP :8891; fullnameOverride: opendkim-server keeps the Service DNS name compatible with the existing Postfix master.cf (inet:opendkim-server:8891).
  • templates/pvc.yaml persists /etc/dkimkeys so opendkim-genkey only generates each domain's key once. persistence.existingClaim provided as an escape hatch for users who'd rather mount a Secret-backed CSI volume.
  • domains is intentionally empty in values.yaml; chart fails loudly if it isn't provided via -f / --set at install time.

Testing

  • helm lint mail-infra/helm/opendkim-server --set 'domains[0].domain=example.com' → passes.
  • helm template ... --set 'domains[0].domain=example.com' --set 'domains[1].domain=another.example.com' → renders one KeyTable / SigningTable entry per domain, auto-appends <domain> + *.<domain> to TrustedHosts, and emits a valid silver.yaml.
  • Negative test: helm template with no domains fails fast with a clear message.
  • persistence.existingClaim=byo-claim correctly skips PVC creation and mounts the supplied claim.
  • End-to-end install path:
    1. helm upgrade --install opendkim-server ./mail-infra/helm/opendkim-server -n pingmailer --create-namespace -f my-domains.yaml
    2. kubectl -n pingmailer logs deploy/opendkim-server shows opendkim-genkey creating per-domain keys, then OpenDKIM listening on :8891.
    3. kubectl -n pingmailer exec deploy/opendkim-server -- sh -c 'cat /etc/dkimkeys/*/*.txt' returns the DNS TXT records to publish.

Checklist

  • My code follows the project's coding standards
  • I have tested my changes
  • I have updated the documentation (if needed)
  • My changes don't introduce new warnings or errors

Related Issues

Fixes #

Aravinda-HWK and others added 15 commits April 23, 2026 16:00
… scripts for streamlined deployment

Co-authored-by: Copilot <copilot@github.com>
- Introduced `02-sample-resources.sh` to automate the creation of a SPA resource.
- The script sources common functions and loads environment variables from a `.env` file.
- It defines default parameters for the SPA and includes functions to extract JSON values, get organization unit IDs, and fetch flow IDs.
- Implements the `create_spa_application` function to handle the API call for creating the SPA with necessary configurations.
- Logs success or error messages based on the API response.
…rement

Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
…aven config script for OAUTHBEARER support

Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>
Co-authored-by: Copilot <copilot@github.com>

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request transitions the API server to an HTTPS-only configuration and implements SMTP XOAUTH2 authentication by passing through the Bearer token from the request. Key changes include adding support for multiple recipients in the /notify endpoint, removing the smtp_password requirement, and introducing a Helm chart for OpenDKIM along with bootstrap scripts for the Thunder service. Feedback identifies a high-severity issue where global template_data overrides recipient-specific context, preventing the use of per-recipient variables in custom templates. Additionally, it is recommended to use the provided smtp_username as the XOAUTH2 identity instead of the sender email to improve compatibility with different SMTP providers.

Comment on lines +202 to +205
templateData := any(recipient)
if len(req.TemplateData) > 0 {
templateData = req.TemplateData
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

When TemplateData is provided in the request, it completely overrides the per-recipient context (recipient) for the template execution. This means that in a multi-recipient notification, custom templates cannot access recipient-specific fields like {{.Name}} if global template_data is also present. Consider merging the recipient information into the template data or wrapping them in a common structure.

Comment on lines +29 to +34
func NewMailer(host string, port int, _ string, sender, accessToken string) Mailer {
dialer := mail.NewDialer(host, port, "", "")
dialer.Auth = &xoauth2Auth{
username: sender,
token: accessToken,
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The username parameter is currently ignored (marked as _), and the sender (email address) is used as the identity for the XOAUTH2 SASL exchange. While many providers use the email as the username, some SMTP servers might require the specific smtp_username provided in the API request for authentication. Since smtp_username is a required field in the API validation, it should be utilized here.

Suggested change
func NewMailer(host string, port int, _ string, sender, accessToken string) Mailer {
dialer := mail.NewDialer(host, port, "", "")
dialer.Auth = &xoauth2Auth{
username: sender,
token: accessToken,
}
func NewMailer(host string, port int, username, sender, accessToken string) Mailer {
dialer := mail.NewDialer(host, port, "", "")
dialer.Auth = &xoauth2Auth{
username: username,
token: accessToken,
}

@Aravinda-HWK
Aravinda-HWK requested a review from maneesha-xyz May 23, 2026 18:42
@Aravinda-HWK Aravinda-HWK self-assigned this May 23, 2026
@Aravinda-HWK
Aravinda-HWK merged commit d2c400b into main Aug 7, 2026
2 checks passed
@Aravinda-HWK
Aravinda-HWK deleted the helm-chart-opendkim branch August 7, 2026 03:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants