Repository navigation
Helm chart postfix - #32
Conversation
…s and console configuration
…ng and configuration
… 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>
Co-authored-by: Copilot <copilot@github.com>
…eployment templates
There was a problem hiding this comment.
Code Review
This pull request transitions the API server to mandatory HTTPS, replaces local OAuth2 token introspection with downstream XOAUTH2 authentication for SMTP, and introduces support for multiple recipients in email notifications. Additionally, it includes a new Helm chart for the SMTP server and infrastructure bootstrap scripts. Feedback suggests merging recipient identity fields with custom template data in the notification handler to ensure both are available within email templates.
| templateData := any(recipient) | ||
| if len(req.TemplateData) > 0 { | ||
| templateData = req.TemplateData | ||
| } |
There was a problem hiding this comment.
When a custom template is used with template_data, the recipient's information (Name, Email, APP) is completely replaced by the provided data. This makes it impossible to use both the recipient's identity and custom data in the same template unless the identity is manually duplicated in the request payload.
Consider merging the recipient information into the template data map to provide a richer context for custom templates.
templateData := map[string]any{
"Name": recipient.Name,
"Email": recipient.Email,
"APP": recipient.APP,
}
if len(req.TemplateData) > 0 {
for k, v := range req.TemplateData {
templateData[k] = v
}
}…trypoint, and security context
…balancer configurations in service.yaml and values.yaml
Description
Adds a Helm chart that runs the Postfix-based SMTP server (
ghcr.io/lsflk/silver-smtp) on Kubernetes — the K8s counterpart of thesmtp-serverservice indocker-compose.yml. The chart rendersmain.cf/master.cf/recipient_accessfrom values, runspostmapin an init container so the lookup table is compiled before Postfix starts, wires Postfix toopendkim-server:8891andraven-sasl:12345, and persists the mail queue on a PVC.Type of Change
Changes Made
silver-smtpatmail-infra/helm/smtp-server/(Chart + values + templates + README).templates/configmap.yamlrendersmain.cf,master.cf,silver.yaml, andrecipient_accessfrom.Values.domainand.Values.postfix.*— replaces the host-sidegen-postfix-conf.shflow used by docker-compose.main.cfsetsmaillog_file = /dev/stdoutsokubectl logsworks.templates/deployment.yamluses an init container that seeds an emptyDir with the image's stock/etc/postfix/contents (postfix-script, postfix-files.d, dynamicmaps.cf.d), overlays the four rendered configs, and runspostmap recipient_accessso the lookup table is compiled before Postfix starts. This moves thepostmapstep from the post-startdocker execinstart-silver.shinto the pod lifecycle where it belongs.tls.crt → fullchain.pem,tls.key → privkey.pem, mounted at/etc/letsencrypt/live/<domain>/— exactly wheremain.cfexpects them. Compatible with thesilver-certificateschart's<dash-domain>-tlsSecrets out of the box.templates/service.yamlexposes:25(SMTP) and conditionally:587(submission, STARTTLS-enforced) onClusterIP(fullnameOverride: smtp-serverkeeps the Service DNS compatible with the existing docker-compose hostname).templates/pvc.yamlprovisions persistence for/var/spool/postfixso in-flight mail survives pod restarts.Recreatestrategy +replicaCount: 1because the queue PVC is RWO and Postfix is intrinsically single-writer.checksum/configannotation triggers a pod restart whenever rendered configs change.domainis intentionally empty invalues.yaml; chartfails with a clear message if missing. Alsofails whenpostfix.submission.enabled=truebuttlsSecret.nameis empty (submission/587 enforces STARTTLS — running it without a cert would CrashLoop)./var/lognamed volume — replaced by stdout logging./app/data/databases/shared.dbwarning path — the image entrypoint touches this best-effort but nothing actually shares it in docker-compose either (no cross-container volume mount), so the chart doesn't provision one.Testing
helm lint mail-infra/helm/smtp-server -f my-smtp-values.yaml→ passes.helm template ... --set domain=example.com --set tlsSecret.name=example-com-tls→ renders:myhostname=mail.example.com,mydomain=example.com, TLS cert paths under/etc/letsencrypt/live/example.com/,recipient_accesswith@example.com REJECT ….:25and:587.postmapand the main container mounting the prepared/etc/postfixemptyDir.domain→ fails with "domain is required …".postfix.submission.enabled=true(default) with emptytlsSecret.name→ fails with "tlsSecret.name is required when postfix.submission.enabled=true …".postfix.submission.enabled=falsecorrectly drops the:587port from the Service and lifts the TLS-required guard.helm upgrade --install smtp-server ./mail-infra/helm/smtp-server -n pingmailer --create-namespace -f my-smtp-values.yamlkubectl -n pingmailer logs deploy/smtp-server→ init container reports✓ /etc/postfix prepared, recipient_access compiled., main container reportsPostfix is running with PID ….kubectl -n pingmailer run -it --rm tmp --image=busybox --restart=Never -- nc -v smtp-server 25→ connection accepted,220 mail.example.com ESMTP Postfixbanner.smtpd_milters=inet:opendkim-server:8891andsmtpd_sasl_path=inet:raven-sasl:12345resolve cluster-internally with no edits.Checklist
Related Issues
Fixes #