webmail, console and routes (K-C3) #18

Merged
jcoffey-dev merged 1 commits from feat/webmail-console into main 2026-11-18 21:59:30 +00:00
14 changed files with 1232 additions and 1 deletions

No files matched your search

+3
View File
@@ -19,6 +19,9 @@ checks:
- no-anti-affinity
# core runs exactly one replica by design, and front and mta default to 2
- minimum-three-replicas
# Likewise for the webmail's and the console's autoscalers: two across
# nodes, with a PDB, is the floor; an operator may raise it
- hpa-minimum-three-replicas
# The mail Service is a LoadBalancer on purpose: it is how mail gets in
- exposed-services
# TODO(K-C4): NetworkPolicies come with the security defaults; take this
+9
View File
@@ -33,3 +33,12 @@ runs, pinned by digest.
can't run with older pods up, the server Deployments are scaled to 0
first, which a rolling update can't do. Then `--upgrade-store` upgrades
the store.
- `webmail` and `console`, off by default: Deployments, Services, optional
autoscalers and PodDisruptionBudgets, read-only root filesystems. The
webmail keeps sessions in sealed cookies, so any replica serves any
request, and signs in through the server's page. Its app and OAuth client
secrets are a Secret the chart makes (kept across upgrades) or
`webmail.existingSecret`. Every server pod is told both addresses, so it
registers them as OAuth clients.
- `routes`: the server's, the webmail's and the console's public addresses,
each by host name, as Gateway API HTTPRoutes or one Ingress.
+26
View File
@@ -61,3 +61,29 @@ server:
resources:
requests: {cpu: 100m, memory: 256Mi}
limits: {cpu: "1", memory: 1Gi}
webmail:
enabled: true
image:
digest: sha256:1111111111111111111111111111111111111111111111111111111111111111
publicUrl: https://webmail.example.org
existingSecret: webmail-secrets
trustedProxies: [10.0.0.0/8]
autoscaling:
enabled: true
podAnnotations: {example.org/team: mail}
nodeSelector: {example.org/tier: web}
tolerations: [{key: example.org/tier, operator: Exists, effect: NoSchedule}]
extraEnv: [{name: LOGIN_RATE_LIMIT, value: "10"}]
console:
enabled: true
image:
tag: 27.1-rc.21
publicUrl: https://admin.example.org
autoscaling:
enabled: true
podAnnotations: {example.org/team: mail}
routes:
gateway:
enabled: true
parentRefs: [{name: public, namespace: gateway, sectionName: https}]
annotations: {example.org/route: public}
+32
View File
@@ -0,0 +1,32 @@
# SPDX-FileCopyrightText: 2026 Coffey Labs LLC
# SPDX-License-Identifier: Apache-2.0
#
# The webmail and the console with their defaults, routed by an Ingress.
server:
dataStore:
"@type": PostgreSql
host: pg-rw.data.svc
port: 5432
database: inbuxa
authUsername: inbuxa
authSecret: {"@type": File, filePath: /etc/inbuxa/secrets/pg-password}
secretMounts:
- secretName: inbuxa-data
items: [{key: pg-password, path: pg-password}]
publicUrl: https://mail.example.org
webmail:
enabled: true
image:
tag: 27.1-rc.7
publicUrl: https://webmail.example.org
console:
enabled: true
image:
tag: 27.1-rc.21
publicUrl: https://admin.example.org
routes:
ingress:
enabled: true
className: nginx
annotations: {example.org/route: public}
tls: [{hosts: [mail.example.org, webmail.example.org, admin.example.org], secretName: mail-tls}]
+12
View File
@@ -7,6 +7,18 @@ Mail from outside reaches the {{ .Values.server.services.mail.type }} Service {{
kubectl -n {{ .Release.Namespace }} get service {{ include "inbuxa.fullname" . }}-mail
{{- end }}
{{- if .Values.webmail.enabled }}
The webmail ({{ .Values.webmail.replicas }} replicas) is at {{ .Values.webmail.publicUrl }}.
{{- end }}
{{- if .Values.console.enabled }}
The console is at {{ .Values.console.publicUrl }}.
{{- end }}
{{- if and (or .Values.webmail.enabled .Values.console.enabled) (not (or .Values.routes.gateway.enabled .Values.routes.ingress.enabled)) }}
No routes are turned on (routes.gateway or routes.ingress): route those
addresses, and the server's, to the Services yourself.
{{- end }}
{{ if .Values.server.seed.enabled -}}
The store was set up from server.seed before the server started (once: a
store that was set up already is left as it is).
+34
View File
@@ -71,3 +71,37 @@ inbuxa.org/group: {{ .group }}
{{- end -}}
{{- join "," $items -}}
{{- end -}}
{{/*
A front end's image, by digest when one is set. Its tag has no default: the
webmail and the console are versioned apart from the server. Call with
(dict "image" .Values.webmail.image "name" "webmail").
*/}}
{{- define "inbuxa.frontEnd.image" -}}
{{- $img := .image -}}
{{- if $img.digest -}}
{{- printf "%s@%s" $img.repository $img.digest -}}
{{- else if $img.tag -}}
{{- printf "%s:%s" $img.repository $img.tag -}}
{{- else -}}
{{- fail (printf "%s.image.tag: set the %s release to run (27.1-rc.N); it's versioned apart from the server" .name .name) -}}
{{- end -}}
{{- end -}}
{{/* The host name of an https://host[:port] address. */}}
{{- define "inbuxa.hostOf" -}}
{{- (urlParse .).hostname | default (regexReplaceAll ":[0-9]+$" (urlParse .).host "") -}}
{{- end -}}
{{/*
Checks a front end's publicUrl: required, and http(s)://host with no path.
Call with (dict "url" .Values.webmail.publicUrl "name" "webmail").
*/}}
{{- define "inbuxa.frontEnd.checkUrl" -}}
{{- if not .url -}}
{{- fail (printf "%s.publicUrl: set where browsers reach the %s, as https://host" .name .name) -}}
{{- end -}}
{{- if not (regexMatch "^https?://[A-Za-z0-9.-]+(:[0-9]+)?/?$" .url) -}}
{{- fail (printf "%s.publicUrl: %q should be https://host, with no path" .name .url) -}}
{{- end -}}
{{- end -}}
+190
View File
@@ -0,0 +1,190 @@
{{/*
SPDX-FileCopyrightText: 2026 Coffey Labs LLC
SPDX-License-Identifier: Apache-2.0
INBUXA Admin, the console: static files behind nginx. The browser loads it
from here and talks to the server's publicUrl directly; API_BASE_URL tells
it where that is, and the server lets the console's origin in because
INBUXA_ADMIN_URL names it.
*/}}
{{- $root := . }}
{{- $con := .Values.console }}
{{- if $con.enabled }}
{{- include "inbuxa.frontEnd.checkUrl" (dict "url" $con.publicUrl "name" "console") }}
{{- if not .Values.server.publicUrl }}
{{- fail "console: set server.publicUrl too; the console's browser calls the server there" }}
{{- end }}
{{- $name := printf "%s-console" (include "inbuxa.fullname" $root) }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ $name }}
namespace: {{ $root.Release.Namespace }}
labels:
{{- include "inbuxa.labels" $root | nindent 4 }}
app.kubernetes.io/component: console
spec:
{{- if not $con.autoscaling.enabled }}
replicas: {{ $con.replicas }}
{{- end }}
revisionHistoryLimit: 5
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 0
maxSurge: 1
selector:
matchLabels:
{{- include "inbuxa.selectorLabels" $root | nindent 6 }}
app.kubernetes.io/component: console
template:
metadata:
labels:
{{- include "inbuxa.labels" $root | nindent 8 }}
app.kubernetes.io/component: console
{{- with $con.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
automountServiceAccountToken: false
enableServiceLinks: false
restartPolicy: Always
{{- with $root.Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
runAsNonRoot: true
# nginx, in the nginx-unprivileged image
runAsUser: 101
runAsGroup: 101
seccompProfile:
type: RuntimeDefault
terminationGracePeriodSeconds: 10
topologySpreadConstraints:
- maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: ScheduleAnyway
labelSelector:
matchLabels:
{{- include "inbuxa.selectorLabels" $root | nindent 14 }}
app.kubernetes.io/component: console
{{- with $con.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with $con.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with $con.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: console
image: {{ include "inbuxa.frontEnd.image" (dict "image" $con.image "name" "console") }}
imagePullPolicy: {{ $con.image.pullPolicy }}
env:
- name: API_BASE_URL
value: {{ trimSuffix "/" $root.Values.server.publicUrl | quote }}
ports:
- name: http
containerPort: 8080
protocol: TCP
readinessProbe:
httpGet:
path: /
port: http
periodSeconds: 10
timeoutSeconds: 3
livenessProbe:
httpGet:
path: /
port: http
periodSeconds: 20
timeoutSeconds: 5
resources:
{{- toYaml $con.resources | nindent 12 }}
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop: [ALL]
volumeMounts:
# index.html, the policy and the pid file are written here at start
- name: tmp
mountPath: /tmp
- name: cache
mountPath: /var/cache/nginx
volumes:
- name: tmp
emptyDir:
sizeLimit: 16Mi
- name: cache
emptyDir:
sizeLimit: 64Mi
---
apiVersion: v1
kind: Service
metadata:
name: {{ $name }}
namespace: {{ $root.Release.Namespace }}
labels:
{{- include "inbuxa.labels" $root | nindent 4 }}
app.kubernetes.io/component: console
spec:
type: ClusterIP
selector:
{{- include "inbuxa.selectorLabels" $root | nindent 4 }}
app.kubernetes.io/component: console
ports:
- name: http
port: 8080
targetPort: http
protocol: TCP
{{- if $con.autoscaling.enabled }}
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ $name }}
namespace: {{ $root.Release.Namespace }}
labels:
{{- include "inbuxa.labels" $root | nindent 4 }}
app.kubernetes.io/component: console
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ $name }}
minReplicas: {{ $con.autoscaling.minReplicas }}
maxReplicas: {{ $con.autoscaling.maxReplicas }}
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ $con.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if and $con.podDisruptionBudget.enabled (or $con.autoscaling.enabled (gt (int $con.replicas) 1)) }}
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ $name }}
namespace: {{ $root.Release.Namespace }}
labels:
{{- include "inbuxa.labels" $root | nindent 4 }}
app.kubernetes.io/component: console
spec:
unhealthyPodEvictionPolicy: AlwaysAllow
maxUnavailable: {{ $con.podDisruptionBudget.maxUnavailable }}
selector:
matchLabels:
{{- include "inbuxa.selectorLabels" $root | nindent 6 }}
app.kubernetes.io/component: console
{{- end }}
{{- end }}
+102
View File
@@ -0,0 +1,102 @@
{{/*
SPDX-FileCopyrightText: 2026 Coffey Labs LLC
SPDX-License-Identifier: Apache-2.0
Routes from outside, one per public address, by host name: the server's
publicUrl to its HTTP Service, and the webmail's and the console's to
theirs. Gateway API HTTPRoutes, or an Ingress where there's no Gateway.
*/}}
{{- $root := . }}
{{- $routes := .Values.routes }}
{{- $full := include "inbuxa.fullname" . }}
{{- $backends := list }}
{{- if .Values.server.publicUrl }}
{{- $backends = append $backends (dict "name" "server" "host" (include "inbuxa.hostOf" .Values.server.publicUrl) "service" (printf "%s-http" $full)) }}
{{- end }}
{{- if .Values.webmail.enabled }}
{{- $backends = append $backends (dict "name" "webmail" "host" (include "inbuxa.hostOf" .Values.webmail.publicUrl) "service" (printf "%s-webmail" $full)) }}
{{- end }}
{{- if .Values.console.enabled }}
{{- $backends = append $backends (dict "name" "console" "host" (include "inbuxa.hostOf" .Values.console.publicUrl) "service" (printf "%s-console" $full)) }}
{{- end }}
{{- $hosts := dict }}
{{- range $backends }}
{{- if hasKey $hosts .host }}
{{- fail (printf "routes: %s and %s both have the host %s; each needs its own" (index $hosts .host) .name .host) }}
{{- end }}
{{- $_ := set $hosts .host .name }}
{{- end }}
{{- if and $routes.gateway.enabled $routes.ingress.enabled }}
{{- fail "routes: turn on gateway or ingress, not both" }}
{{- end }}
{{- if and (or $routes.gateway.enabled $routes.ingress.enabled) (not $backends) }}
{{- fail "routes: nothing to route; set server.publicUrl, or turn on the webmail or the console" }}
{{- end }}
{{- if $routes.gateway.enabled }}
{{- if not $routes.gateway.parentRefs }}
{{- fail "routes.gateway.parentRefs: name the Gateway (and listener) to attach to" }}
{{- end }}
{{- range $backends }}
---
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: {{ printf "%s-%s" $full .name }}
namespace: {{ $root.Release.Namespace }}
labels:
{{- include "inbuxa.labels" $root | nindent 4 }}
app.kubernetes.io/component: {{ .name }}
{{- with $routes.gateway.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
parentRefs:
{{- toYaml $routes.gateway.parentRefs | nindent 4 }}
hostnames:
- {{ .host | quote }}
rules:
- matches:
- path:
type: PathPrefix
value: /
backendRefs:
- name: {{ .service }}
port: 8080
{{- end }}
{{- end }}
{{- if $routes.ingress.enabled }}
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ $full }}
namespace: {{ $root.Release.Namespace }}
labels:
{{- include "inbuxa.labels" $root | nindent 4 }}
{{- with $routes.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- with $routes.ingress.className }}
ingressClassName: {{ . }}
{{- end }}
{{- with $routes.ingress.tls }}
tls:
{{- toYaml . | nindent 4 }}
{{- end }}
rules:
{{- range $backends }}
- host: {{ .host | quote }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ .service }}
port:
name: http
{{- end }}
{{- end }}
@@ -22,6 +22,15 @@ metadata:
{{- include "inbuxa.labels" $root | nindent 4 }}
app.kubernetes.io/component: server
inbuxa.org/group: {{ $group }}
{{- with $root.Values.webmail }}
{{- if .enabled }}
annotations:
ignore-check.kube-linter.io/read-secret-from-env-var: "TODO(K-S2): the webmail's OAuth client secret comes from the environment until the server takes *_FILE"
{{- if .existingSecret }}
ignore-check.kube-linter.io/env-value-from: "webmail.existingSecret is the operator's, made outside the chart"
{{- end }}
{{- end }}
{{- end }}
spec:
replicas: {{ $g.replicas }}
revisionHistoryLimit: 5
@@ -135,6 +144,22 @@ spec:
{{- end }}
- name: INBUXA_LISTENER_PORTS
value: {{ include "inbuxa.server.listenerPorts" $root | quote }}
{{- /* The front ends, registered as OAuth clients on every start */}}
{{- with $root.Values.webmail }}
{{- if .enabled }}
- name: INBUXA_WEBMAIL_URL
value: {{ trimSuffix "/" .publicUrl | quote }}
- name: INBUXA_WEBMAIL_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: {{ default (printf "%s-webmail" (include "inbuxa.fullname" $root)) .existingSecret }}
key: oauth-client-secret
{{- end }}
{{- end }}
{{- if $root.Values.console.enabled }}
- name: INBUXA_ADMIN_URL
value: {{ trimSuffix "/" $root.Values.console.publicUrl | quote }}
{{- end }}
{{- with $g.extraEnv }}
{{- toYaml . | nindent 12 }}
{{- end }}
+248
View File
@@ -0,0 +1,248 @@
{{/*
SPDX-FileCopyrightText: 2026 Coffey Labs LLC
SPDX-License-Identifier: Apache-2.0
The webmail. Sessions are sealed into the browser's cookie (SESSION_BACKEND
cookie), so any replica serves any request, and sign-in goes through the
server's own page (OAuth): the webmail never holds a password. It talks to
the server inside the cluster, through the HTTP Service.
*/}}
{{- $root := . }}
{{- $wm := .Values.webmail }}
{{- if $wm.enabled }}
{{- include "inbuxa.frontEnd.checkUrl" (dict "url" $wm.publicUrl "name" "webmail") }}
{{- if not .Values.server.publicUrl }}
{{- fail "webmail: set server.publicUrl too; sign-in sends the browser to the server's page there" }}
{{- end }}
{{- $name := printf "%s-webmail" (include "inbuxa.fullname" $root) }}
{{- $secretName := default $name $wm.existingSecret }}
{{- if not $wm.existingSecret }}
{{- /* Random once, then kept: a new APP_SECRET would sign everybody out */}}
{{- $existing := (lookup "v1" "Secret" $root.Release.Namespace $name).data | default dict }}
apiVersion: v1
kind: Secret
metadata:
name: {{ $name }}
namespace: {{ $root.Release.Namespace }}
labels:
{{- include "inbuxa.labels" $root | nindent 4 }}
app.kubernetes.io/component: webmail
type: Opaque
data:
app-secret: {{ index $existing "app-secret" | default (randAlphaNum 48 | b64enc) }}
oauth-client-secret: {{ index $existing "oauth-client-secret" | default (randAlphaNum 48 | b64enc) }}
---
{{- end }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ $name }}
namespace: {{ $root.Release.Namespace }}
labels:
{{- include "inbuxa.labels" $root | nindent 4 }}
app.kubernetes.io/component: webmail
annotations:
ignore-check.kube-linter.io/read-secret-from-env-var: "TODO(K-W4): the webmail reads its secrets from the environment until it takes *_FILE"
{{- if $wm.existingSecret }}
ignore-check.kube-linter.io/env-value-from: "existingSecret is the operator's, made outside the chart"
{{- end }}
spec:
{{- if not $wm.autoscaling.enabled }}
replicas: {{ $wm.replicas }}
{{- end }}
revisionHistoryLimit: 5
strategy:
type: RollingUpdate
rollingUpdate:
maxUnavailable: 0
maxSurge: 1
selector:
matchLabels:
{{- include "inbuxa.selectorLabels" $root | nindent 6 }}
app.kubernetes.io/component: webmail
template:
metadata:
labels:
{{- include "inbuxa.labels" $root | nindent 8 }}
app.kubernetes.io/component: webmail
{{- with $wm.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
spec:
automountServiceAccountToken: false
enableServiceLinks: false
restartPolicy: Always
{{- with $root.Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
securityContext:
runAsNonRoot: true
# node, in the image
runAsUser: 1000
runAsGroup: 1000
seccompProfile:
type: RuntimeDefault
terminationGracePeriodSeconds: 30
topologySpreadConstraints:
- maxSkew: 1
topologyKey: kubernetes.io/hostname
whenUnsatisfiable: ScheduleAnyway
labelSelector:
matchLabels:
{{- include "inbuxa.selectorLabels" $root | nindent 14 }}
app.kubernetes.io/component: webmail
{{- with $wm.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with $wm.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with $wm.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: webmail
image: {{ include "inbuxa.frontEnd.image" (dict "image" $wm.image "name" "webmail") }}
imagePullPolicy: {{ $wm.image.pullPolicy }}
env:
- name: MAIL_SERVER_URL
value: {{ printf "http://%s-http.%s.svc:8080" (include "inbuxa.fullname" $root) $root.Release.Namespace | quote }}
- name: PUBLIC_URL
value: {{ trimSuffix "/" $wm.publicUrl | quote }}
{{- if $root.Values.console.enabled }}
- name: ADMIN_URL
value: {{ trimSuffix "/" $root.Values.console.publicUrl | quote }}
{{- end }}
- name: SESSION_BACKEND
value: cookie
# Nothing on disk: the session is in the cookie
- name: SESSION_FILE
value: ""
- name: SECURE_COOKIES
value: {{ ternary "1" "0" (hasPrefix "https://" $wm.publicUrl) | quote }}
{{- with $wm.trustedProxies }}
- name: TRUSTED_PROXIES
value: {{ join "," . | quote }}
{{- end }}
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: APP_SECRET
valueFrom:
secretKeyRef:
name: {{ $secretName }}
key: app-secret
- name: APP_SECRET_PREVIOUS
valueFrom:
secretKeyRef:
name: {{ $secretName }}
key: app-secret-previous
optional: true
- name: OAUTH_CLIENT_SECRET
valueFrom:
secretKeyRef:
name: {{ $secretName }}
key: oauth-client-secret
{{- with $wm.extraEnv }}
{{- toYaml . | nindent 12 }}
{{- end }}
ports:
- name: http
containerPort: 8080
protocol: TCP
readinessProbe:
httpGet:
path: /api/health
port: http
periodSeconds: 10
timeoutSeconds: 3
livenessProbe:
httpGet:
path: /api/health
port: http
periodSeconds: 20
timeoutSeconds: 5
failureThreshold: 3
resources:
{{- toYaml $wm.resources | nindent 12 }}
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities:
drop: [ALL]
volumeMounts:
- name: tmp
mountPath: /tmp
volumes:
- name: tmp
emptyDir:
sizeLimit: 64Mi
---
apiVersion: v1
kind: Service
metadata:
name: {{ $name }}
namespace: {{ $root.Release.Namespace }}
labels:
{{- include "inbuxa.labels" $root | nindent 4 }}
app.kubernetes.io/component: webmail
spec:
type: ClusterIP
selector:
{{- include "inbuxa.selectorLabels" $root | nindent 4 }}
app.kubernetes.io/component: webmail
ports:
- name: http
port: 8080
targetPort: http
protocol: TCP
{{- if $wm.autoscaling.enabled }}
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ $name }}
namespace: {{ $root.Release.Namespace }}
labels:
{{- include "inbuxa.labels" $root | nindent 4 }}
app.kubernetes.io/component: webmail
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ $name }}
minReplicas: {{ $wm.autoscaling.minReplicas }}
maxReplicas: {{ $wm.autoscaling.maxReplicas }}
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ $wm.autoscaling.targetCPUUtilizationPercentage }}
{{- end }}
{{- if and $wm.podDisruptionBudget.enabled (or $wm.autoscaling.enabled (gt (int $wm.replicas) 1)) }}
---
apiVersion: policy/v1
kind: PodDisruptionBudget
metadata:
name: {{ $name }}
namespace: {{ $root.Release.Namespace }}
labels:
{{- include "inbuxa.labels" $root | nindent 4 }}
app.kubernetes.io/component: webmail
spec:
unhealthyPodEvictionPolicy: AlwaysAllow
maxUnavailable: {{ $wm.podDisruptionBudget.maxUnavailable }}
selector:
matchLabels:
{{- include "inbuxa.selectorLabels" $root | nindent 6 }}
app.kubernetes.io/component: webmail
{{- end }}
{{- end }}
+215
View File
@@ -0,0 +1,215 @@
# SPDX-FileCopyrightText: 2026 Coffey Labs LLC
# SPDX-License-Identifier: Apache-2.0
suite: webmail, console and routes
templates:
- webmail.yaml
- console.yaml
- routes.yaml
- server/deployment.yaml
release:
name: mail
namespace: inbuxa
values:
- ../ci/defaults-values.yaml
set:
server.publicUrl: https://mail.example.org
webmail.enabled: true
webmail.publicUrl: https://webmail.example.org
webmail.image.tag: 27.1-rc.7
console.enabled: true
console.publicUrl: https://admin.example.org/
console.image.tag: 27.1-rc.21
tests:
- it: is off by default
set:
webmail.enabled: false
console.enabled: false
template: webmail.yaml
asserts:
- hasDocuments:
count: 0
- it: runs the webmail with sealed-cookie sessions, talking to the server inside the cluster
template: webmail.yaml
documentSelector:
path: kind
value: Deployment
asserts:
- equal:
path: spec.template.spec.containers[0].image
value: ghcr.io/inbuxa/inbuxa-webmail:27.1-rc.7
- contains:
path: spec.template.spec.containers[0].env
content: {name: MAIL_SERVER_URL, value: "http://mail-inbuxa-http.inbuxa.svc:8080"}
- contains:
path: spec.template.spec.containers[0].env
content: {name: SESSION_BACKEND, value: cookie}
- contains:
path: spec.template.spec.containers[0].env
content: {name: SECURE_COOKIES, value: "1"}
- contains:
path: spec.template.spec.containers[0].env
content: {name: ADMIN_URL, value: "https://admin.example.org"}
- contains:
path: spec.template.spec.containers[0].env
content:
name: OAUTH_CLIENT_SECRET
valueFrom: {secretKeyRef: {name: mail-inbuxa-webmail, key: oauth-client-secret}}
- equal:
path: spec.replicas
value: 2
- equal:
path: spec.template.spec.containers[0].securityContext.readOnlyRootFilesystem
value: true
- it: makes the webmail's secrets when none is given
template: webmail.yaml
documentSelector:
path: kind
value: Secret
asserts:
- exists:
path: data["app-secret"]
- exists:
path: data["oauth-client-secret"]
- it: uses the operator's Secret when given one
template: webmail.yaml
set:
webmail.existingSecret: my-webmail
asserts:
- hasDocuments:
count: 3
- contains:
path: spec.template.spec.containers[0].env
content:
name: APP_SECRET
valueFrom: {secretKeyRef: {name: my-webmail, key: app-secret}}
documentSelector:
path: kind
value: Deployment
- it: tells every server pod about the webmail and the console, so it registers them
template: server/deployment.yaml
asserts:
- contains:
path: spec.template.spec.containers[0].env
content: {name: INBUXA_WEBMAIL_URL, value: "https://webmail.example.org"}
- contains:
path: spec.template.spec.containers[0].env
content:
name: INBUXA_WEBMAIL_CLIENT_SECRET
valueFrom: {secretKeyRef: {name: mail-inbuxa-webmail, key: oauth-client-secret}}
- contains:
path: spec.template.spec.containers[0].env
content: {name: INBUXA_ADMIN_URL, value: "https://admin.example.org"}
- it: points the console's browser at the server
template: console.yaml
documentSelector:
path: kind
value: Deployment
asserts:
- equal:
path: spec.template.spec.containers[0].env
value: [{name: API_BASE_URL, value: "https://mail.example.org"}]
- equal:
path: spec.template.spec.securityContext.runAsUser
value: 101
- it: scales with an autoscaler instead of a fixed count
template: webmail.yaml
set:
webmail.autoscaling.enabled: true
asserts:
- notExists:
path: spec.replicas
documentSelector:
path: kind
value: Deployment
- equal:
path: spec.minReplicas
value: 2
documentSelector:
path: kind
value: HorizontalPodAutoscaler
- it: needs a release to run, an address, and the server's address
template: webmail.yaml
set:
webmail.image.tag: ""
asserts:
- failedTemplate:
errorPattern: "webmail.image.tag: set the webmail release"
- it: refuses an address with a path (the schema)
template: console.yaml
set:
console.publicUrl: https://example.org/admin
asserts:
- failedTemplate:
errorPattern: "console.publicUrl"
- it: needs the server's publicUrl
template: webmail.yaml
set:
server.publicUrl: ""
asserts:
- failedTemplate:
errorPattern: "set server.publicUrl too"
- it: routes each address to its Service through a Gateway
template: routes.yaml
set:
routes.gateway.enabled: true
routes.gateway.parentRefs: [{name: public, namespace: gateway}]
asserts:
- hasDocuments:
count: 3
- equal:
path: spec.hostnames
value: [webmail.example.org]
documentIndex: 1
- equal:
path: spec.rules[0].backendRefs[0]
value: {name: mail-inbuxa-webmail, port: 8080}
documentIndex: 1
- equal:
path: spec.parentRefs
value: [{name: public, namespace: gateway}]
documentIndex: 2
- it: or through one Ingress
template: routes.yaml
set:
routes.ingress.enabled: true
routes.ingress.className: nginx
asserts:
- hasDocuments:
count: 1
- equal:
path: spec.rules[0].host
value: mail.example.org
- equal:
path: spec.rules[1].host
value: webmail.example.org
- equal:
path: spec.rules[2].http.paths[0].backend.service.name
value: mail-inbuxa-console
- it: refuses two front ends on one host name
template: routes.yaml
set:
console.publicUrl: https://webmail.example.org
routes.ingress.enabled: true
asserts:
- failedTemplate:
errorPattern: "webmail and console both have the host webmail.example.org"
- it: refuses a Gateway route with nothing to attach to
template: routes.yaml
set:
routes.gateway.enabled: true
asserts:
- failedTemplate:
errorPattern: "routes.gateway.parentRefs"
+237
View File
@@ -443,6 +443,243 @@
}
}
}
},
"webmail": {
"type": "object",
"additionalProperties": false,
"properties": {
"enabled": {
"type": "boolean"
},
"image": {
"type": "object",
"additionalProperties": false,
"properties": {
"repository": {
"type": "string",
"minLength": 1
},
"tag": {
"type": "string"
},
"digest": {
"type": "string",
"pattern": "^(sha256:[0-9a-f]{64})?$"
},
"pullPolicy": {
"enum": [
"Always",
"IfNotPresent",
"Never"
]
}
}
},
"publicUrl": {
"type": "string",
"pattern": "^(https?://[A-Za-z0-9.-]+(:[0-9]+)?/?)?$"
},
"replicas": {
"type": "integer",
"minimum": 1
},
"autoscaling": {
"type": "object",
"additionalProperties": false,
"properties": {
"enabled": {
"type": "boolean"
},
"minReplicas": {
"type": "integer",
"minimum": 1
},
"maxReplicas": {
"type": "integer",
"minimum": 1
},
"targetCPUUtilizationPercentage": {
"type": "integer",
"minimum": 1,
"maximum": 100
}
}
},
"resources": {
"type": "object"
},
"podDisruptionBudget": {
"type": "object",
"additionalProperties": false,
"properties": {
"enabled": {
"type": "boolean"
},
"maxUnavailable": {
"type": [
"integer",
"string"
]
}
}
},
"nodeSelector": {
"type": "object"
},
"tolerations": {
"type": "array"
},
"affinity": {
"type": "object"
},
"podAnnotations": {
"type": "object"
},
"existingSecret": {
"type": "string"
},
"trustedProxies": {
"type": "array",
"items": {
"type": "string"
}
},
"extraEnv": {
"type": "array"
}
}
},
"console": {
"type": "object",
"additionalProperties": false,
"properties": {
"enabled": {
"type": "boolean"
},
"image": {
"type": "object",
"additionalProperties": false,
"properties": {
"repository": {
"type": "string",
"minLength": 1
},
"tag": {
"type": "string"
},
"digest": {
"type": "string",
"pattern": "^(sha256:[0-9a-f]{64})?$"
},
"pullPolicy": {
"enum": [
"Always",
"IfNotPresent",
"Never"
]
}
}
},
"publicUrl": {
"type": "string",
"pattern": "^(https?://[A-Za-z0-9.-]+(:[0-9]+)?/?)?$"
},
"replicas": {
"type": "integer",
"minimum": 1
},
"autoscaling": {
"type": "object",
"additionalProperties": false,
"properties": {
"enabled": {
"type": "boolean"
},
"minReplicas": {
"type": "integer",
"minimum": 1
},
"maxReplicas": {
"type": "integer",
"minimum": 1
},
"targetCPUUtilizationPercentage": {
"type": "integer",
"minimum": 1,
"maximum": 100
}
}
},
"resources": {
"type": "object"
},
"podDisruptionBudget": {
"type": "object",
"additionalProperties": false,
"properties": {
"enabled": {
"type": "boolean"
},
"maxUnavailable": {
"type": [
"integer",
"string"
]
}
}
},
"nodeSelector": {
"type": "object"
},
"tolerations": {
"type": "array"
},
"affinity": {
"type": "object"
},
"podAnnotations": {
"type": "object"
}
}
},
"routes": {
"type": "object",
"additionalProperties": false,
"properties": {
"gateway": {
"type": "object",
"additionalProperties": false,
"properties": {
"enabled": {
"type": "boolean"
},
"parentRefs": {
"type": "array"
},
"annotations": {
"type": "object"
}
}
},
"ingress": {
"type": "object",
"additionalProperties": false,
"properties": {
"enabled": {
"type": "boolean"
},
"className": {
"type": "string"
},
"annotations": {
"type": "object"
},
"tls": {
"type": "array"
}
}
}
}
}
}
}
+95
View File
@@ -184,3 +184,98 @@ server:
imaps: 993
pop3s: 995
sieve: 4190
# The webmail, signing people in through the server's own page (OAuth). Off
# by default: it needs its own address, and the server's publicUrl.
webmail:
enabled: false
image:
repository: ghcr.io/inbuxa/inbuxa-webmail
# The webmail's own release (27.1-rc.N); it's versioned apart from the
# server, so there's no default. Needs 27.1-rc.7 or later.
tag: ""
digest: ""
pullPolicy: IfNotPresent
# Where browsers reach it, as https://host. Required. The server registers
# it as an OAuth client with this address.
publicUrl: ""
replicas: 2
# A Secret with app-secret (seals sessions; the same on every replica) and
# oauth-client-secret (the server holds it too), and optionally
# app-secret-previous (comma-separated secrets that still open sessions
# after a rotation). Empty: the chart makes one with random values and
# keeps them across upgrades.
existingSecret: ""
# Addresses whose X-Forwarded-For the webmail believes, as CIDRs. Empty:
# the private ranges, which covers an ingress inside the cluster.
trustedProxies: []
autoscaling:
enabled: false
minReplicas: 2
maxReplicas: 6
targetCPUUtilizationPercentage: 70
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: "1"
memory: 512Mi
podDisruptionBudget:
enabled: true
maxUnavailable: 1
nodeSelector: {}
tolerations: []
affinity: {}
podAnnotations: {}
extraEnv: []
# INBUXA Admin, the console, served as static files; the browser talks to
# the server's publicUrl directly. Off by default, like the webmail.
console:
enabled: false
image:
repository: ghcr.io/inbuxa/inbuxa-admin
# The console's own release (27.1-rc.N); no default, as for the webmail
tag: ""
digest: ""
pullPolicy: IfNotPresent
# Where browsers reach it, as https://host. Required. The server registers
# it as an OAuth client and lets its origin call the API.
publicUrl: ""
replicas: 2
autoscaling:
enabled: false
minReplicas: 2
maxReplicas: 4
targetCPUUtilizationPercentage: 70
resources:
requests:
cpu: 20m
memory: 32Mi
limits:
cpu: 500m
memory: 128Mi
podDisruptionBudget:
enabled: true
maxUnavailable: 1
nodeSelector: {}
tolerations: []
affinity: {}
podAnnotations: {}
# Routes from outside to the server's publicUrl, the webmail's and the
# console's, each by its host name. Gateway API where the cluster has it;
# an Ingress where it doesn't. TLS is the Gateway's or the Ingress's.
routes:
gateway:
enabled: false
# The Gateway listeners to attach to, e.g. [{name: public, namespace: gateway}]
parentRefs: []
annotations: {}
ingress:
enabled: false
className: ""
annotations: {}
# As an Ingress takes it, e.g. [{hosts: [mail.example.org], secretName: mail-tls}]
tls: []
+4 -1
View File
@@ -45,8 +45,11 @@ for values in "$CHART"/ci/*-values.yaml; do
for kube in "${KUBE_VERSIONS[@]}"; do
step "kubeconform: $name values on Kubernetes $kube"
helm template ci "$CHART" -n inbuxa -f "$values" --kube-version "$kube" >"$OUT/$name-$kube.yaml"
# HTTPRoute is a CRD: its schema comes from the CRDs catalog
kubeconform -strict -summary -kubernetes-version "$kube" \
-schema-location default "$OUT/$name-$kube.yaml"
-schema-location default \
-schema-location 'https://raw.githubusercontent.com/datreeio/CRDs-catalog/main/{{.Group}}/{{.ResourceKind}}_{{.ResourceAPIVersion}}.json' \
"$OUT/$name-$kube.yaml"
done
step "kube-linter: $name values"
rendered="$OUT/$name-${KUBE_VERSIONS[-1]}.yaml"