Skip to content
Edit this page

Owner reports by email

kubedelos can email each owner a weekly to-do list: the Critical and High findings in the images their namespaces run, fixable ones first. It is off until you turn it on, and only kubedelos serve sends. kubedelos ui previews the emails and never sends.

These emails are the one thing kubedelos sends out of the cluster that is about the cluster. Read The security model before you turn them on.

What an owner gets

One email per address, covering every namespace that address owns. It asks for one thing: fix the Critical and High findings that have a fix. It holds:

  • One line per namespace: Critical, High, fixable, and how many are new.
  • Fix these: the images in risk order. Under each image, every fixable package with the installed and the fixed version and the CVEs the upgrade closes. At most 50 images are listed; the attached CSV has all of them.
  • A count of the Critical and High findings that have no fix yet.
  • A count of accepted risks. They are left out of the list.
  • A footer saying why the owner got it and how to stop it: remove the annotation or ask the admin.

The subject reads kubedelos: N fixable Critical/High in my-cluster (team-a, team-b), with the first three namespaces and "and K more" after that. The CSV is attached as kubedelos-<cluster>-<date>.csv, with the same columns as the Findings CSV.

An email names only the recipient's own namespaces. Accepted risks are judged against those namespaces too: a finding accepted for all of them is left out, whatever other owners did.

New means not in the recipient's last report run. The first report a recipient gets marks nothing new, since "everything is new" is noise. A report that was only a dry run, or skipped because nothing was fixable, counts as the last report; a failed one does not, because the owner never saw it.

When KUBEDELOS_UI_URL is set, the email links to the findings of that run.

Who is an owner

A namespace names its owners in an annotation, kubedelos.io/owner-email by default (KUBEDELOS_OWNER_ANNOTATION). The value is one address or several, separated by commas:

kubectl annotate namespace team-a kubedelos.io/owner-email='alice@example.com,bob@example.com'
  • Each address is trimmed and lowercased. A namespace with two owners appears in both emails.
  • A value that is not one plain address is never mailed. The preview and the admin summary list it as unusable.
  • A namespace with no usable owner goes to the fallback recipient (KUBEDELOS_FALLBACK_RECIPIENT), so it does not drop out silently. Without one, it is only listed in the admin summary and the preview.
  • The admin recipient (KUBEDELOS_ADMIN_RECIPIENT) gets one summary after each round: the counts per namespace, the namespaces with no usable owner, and who was sent what, or skipped and why. It has no finding details.

Allowed domains

KUBEDELOS_REPORTS_ALLOWED_DOMAINS (a JSON list such as ["example.com"]) limits where mail can go. It is optional, and empty allows any address. A subdomain of a listed domain is allowed.

  • An owner address outside the list is never mailed. That namespace goes to the fallback recipient instead.
  • A fallback address outside the list is not mailed either.
  • An admin address outside the list gets no summary.

This stops an annotation from sending a namespace's findings to an outside address.

Modes

KUBEDELOS_REPORTS_MODE is one of:

Mode What happens
off The default. Nothing is built or sent.
dry-run Each round builds and records the emails and logs one line each. Nothing is sent, not even the admin summary.
send Owners get their emails.

The first round after you turn reports on is always a dry run, even in send mode. Owners get nothing. The admin summary is sent, marked as a dry run, when an admin recipient is set, so someone sees the list before any owner is mailed. Real owner email starts at the next round, once a round has finished and its admin summary was not failed or skipped. With no admin recipient, the first finished round is enough.

Turning reports off and on again does not repeat the dry run. A round in dry-run mode counts as the first round too.

The schedule

KUBEDELOS_REPORTS_SCHEDULE is a five-field cron, 0 7 * * 1 by default: Monday 07:00. It runs in KUBEDELOS_SWEEP_TIMEZONE. Weekday numbers are read as cron reads them, with 0 and 7 as Sunday and 1 as Monday.

A round uses the newest completed scheduled sweep run, not a scan started from the UI. A run still going is never used. If no sweep has finished yet, the round does nothing and is not counted as the first round.

A round is keyed by its scheduled time, and kubedelos never sends the same round twice. After a restart, a pod resumes a round that was missed or left unfinished within the last hour, and skips the recipients it already has a result for. A pod down for longer than that skips that week's round.

How many emails

  • Nothing fixable, no email. An owner with no fixable Critical or High finding gets nothing, and the admin summary says so. KUBEDELOS_REPORTS_SKIP_EMPTY=false sends the email anyway.
  • A limit per round. At most KUBEDELOS_REPORTS_MAX_PER_ROUND emails go out (default 200). The rest are recorded as skipped, and the admin summary says so. The admin summary does not count. This protects against an annotation typo that fans out.

SMTP

Variable Default
KUBEDELOS_SMTP_HOST none; required in send mode
KUBEDELOS_SMTP_PORT 587
KUBEDELOS_SMTP_SECURITY starttls; or tls (usually port 465), or none
KUBEDELOS_SMTP_USERNAME none
KUBEDELOS_SMTP_PASSWORD none
KUBEDELOS_SMTP_FROM_ADDRESS none; required in send mode
KUBEDELOS_SMTP_TIMEOUT_S 30
  • starttls refuses to go on when the server does not offer it. Certificates are always verified, with no option to skip it.
  • none is allowed only without a username, so a password never crosses in clear.
  • A failure that is about the connection or the login (a refused login, a failed TLS handshake, no STARTTLS) stops the round, and the rest of its emails are marked failed. Three dropped connections in a row stop it too. Any other failure belongs to one recipient and the round goes on.
  • A failed email is not retried in a loop. It is tried again at the next round.
  • Errors are stored and logged by class name only, never the server's message, which can echo addresses. Log lines mask addresses (a***@example.com).

In a cluster

The chart sets these from its reports: values. The password comes only from an existing Secret:

kubectl create secret generic kubedelos-smtp -n kubedelos --from-literal=password='...'
reports:
  mode: send
  schedule: "0 7 * * 1"
  uiUrl: https://kubedelos.example.com
  fallbackRecipient: security@example.com
  adminRecipient: platform@example.com
  allowedDomains: [example.com]
  smtp:
    host: smtp.example.com
    port: 587
    security: starttls
    username: kubedelos
    fromAddress: kubedelos@example.com
    existingSecret: kubedelos-smtp
    passwordKey: password

With reports on, the chart refuses mode: send without smtp.host and smtp.fromAddress, and a username without existingSecret. If networkPolicy.egress restricts egress, allow the SMTP host and port there; see Running kubedelos in a cluster.

The preview

Reports, then the Preview owner emails link (/reports/owners) shows what a round would do with the run shown: each email's recipient, kind (owner or fallback), namespaces and fixable count, whether it would go out, and if not, why (nothing fixable, over the limit, outside the allowed domains). It also lists the namespaces and values that cannot be mailed. Each email opens as plain text, and can be downloaded as an .eml file with its HTML body and CSV.

The preview is read-only and works in both kubedelos ui and kubedelos serve, whatever the mode. It uses the same code as a round, so its order, skips and limit match. Under serve it also shows the mode and the recent rounds: when, and how many were sent, dry run, skipped or failed.

What is recorded

The "new" markers compare a run with the run before it, so they need runs kept at least as long as the report interval (KUBEDELOS_RETENTION_DAYS, chart retentionDays). The history of report rounds is kept at least 35 days, whatever the retention, and the newest round that opened the dry-run gate is never pruned.

Each round and each email gets a row in the database: the round's scheduled time, the recipient, the kind, the run it used, the result (sent, dry-run, skipped or failed), and for a failure the exception class. That is what stops a restart from sending twice and what the preview's recent rounds show. The SMTP password is never stored.

The security model

  • Emails are the one new thing that leaves the cluster. An email holds image names, package versions and CVE ids of the recipient's own namespaces. Use allowedDomains to keep them inside your organisation.
  • The password reaches the pod only from a Secret you name (reports.smtp.existingSecret). It is never in the chart's values, the database, the logs or an error message, and the Settings page shows it as set (hidden).
  • The cluster stays read-only: reports read only the kubedelos database.