cyclops

by sakshitposting-irl

Helm chartv1.0.4App v1.0.4Apache-2.0Verified publisher

Daily backstop report for cert-manager renewals that silently fail

About this chart

cyclops Helm chart

Installs the cyclops controller, its CRD (CertReport), RBAC, and the install-level mail settings (ADR 0014). Beta (v1alpha1). The chart is published to GHCR as an OCI chart:

helm install cyclops oci://ghcr.io/sakshitposting-irl/charts/cyclops --version 1.0.4 \
  -n cyclops-system --create-namespace \
  --set email.smtp.host=smtp.example.com

or install it from a checkout with helm install cyclops ./charts/cyclops ... (same flags).

cert-manager must already be installed. Mail credentials are never set through values: create the Secret yourself in the release namespace and reference it by name (email.smtp.credentialsSecretName with keys username/password, or email.ses.credentialsSecretName with keys access-key-id/secret-access-key; for SES, leave it empty to use IRSA or Pod Identity).

Email is optional. Leave email.smtp.host (or, for SES, email.ses.region) empty and the chart installs no mail settings: an install that only posts to webhooks (Slack) needs none. A CertReport with an Email notifier then fails its runs, saying email is not configured.

Create a CertReport

The chart installs the CertReport CRD but no CertReport: that is where you say when to look, which namespaces to cover, and who to tell. helm install prints a complete, commented example at the end (it is files/certreport-example.yaml in this chart). The smallest valid one is:

apiVersion: cyclops.sakshitposting-irl.github.io/v1alpha1
kind: CertReport
metadata: {name: cluster-certs}
spec:
  notifiers:
    - type: Email
      email: {from: [email protected], to: [[email protected]]}

Everything else has a default (every namespace, daily at 08:00 UTC). Every field, its default and its rules are described in the cluster itself, generated from the CRD, so they cannot go stale:

kubectl explain certreport.spec
kubectl explain certreport.spec.notifiers

Customising the email

The chart ships the built-in template as files/default.html.tmpl and renders it into a ConfigMap (<release>-email-template, key template.html). It is used only when a CertReport points at it; without the reference, the template compiled into the image is used (the same text).

  1. Edit the template. Either change files/default.html.tmpl in your copy of the chart, or keep your own file and pass it with --set-file emailTemplate.content=my.html (or put it in your values file as a block scalar). An empty emailTemplate.content means the shipped default.
  2. helm upgrade the release.
  3. Tell cyclops to use it. Either set emailTemplate.useAsDefault: true (default false), which makes it the template for every CertReport without its own reference, or reference it from each CertReport that should use it:
apiVersion: cyclops.sakshitposting-irl.github.io/v1alpha1
kind: CertReport
metadata:
  name: prod
spec:
  emailTemplateConfigMapRef:
    name: cyclops-email-template   # <release>-email-template, or emailTemplate.name
    key: template.html
  notifiers:
    - type: Email
      email:
        from: [email protected]
        to: [[email protected]]

With useAsDefault: false, editing the template changes only the ConfigMap; reports keep using the template built into the image until a CertReport references the ConfigMap. A CertReport's own emailTemplateConfigMapRef always wins over the default. useAsDefault: true needs emailTemplate.create: true (the install fails otherwise).

files/default.html.tmpl is a copy of internal/render/default.html.tmpl; make helm-crd re-syncs it (maintainers: do not edit it in the repo, edit the source).

The welcome email

The one-time welcome email has its own template, files/default-welcome.html.tmpl, shipped in the same ConfigMap under the key welcome.html. It uses the same reference as the report template, so whichever ConfigMap a CertReport (or useAsDefault) points at supplies both. Change it with --set-file emailTemplate.welcomeContent=welcome.html, or by editing the file in your copy of the chart. A ConfigMap without a welcome.html key falls back to the built-in welcome template. The TemplateValid condition parses the key when it is there. The template's header comment lists its data (.ReportName, .GeneratedAt, .Schedule, .Namespaces, .Findings).

What you can change

Nothing in the template is required. The whole file is the email body, sent as a single text/html part (there is no plain-text alternative), so you can restyle, restructure, shorten or replace all of it. The shipped file starts with a comment block (it produces no output) that lists the available data, and marks the parts people usually edit (the empty branch, the table rows and the footer):

Part of the defaultEdit it to
Title and "Generated" lineRename the heading, drop or reformat the timestamp
Empty branch ({{ if not .Findings }})Reword the "nothing needs attention" message
Table ({{ range .Findings }} and its header row)Add, remove or reorder columns. Change the header row and the row body together
Footer paragraphEdit or remove

What is fixed:

  • The subject line is set by cyclops, not the template.
  • The data is only what is listed under "Template data" below. A template that names any other field fails the run.

Recommendations, not requirements:

  • Keep styling inline (style="..."). Email clients ignore <style> blocks and scripts.
  • Keep the empty-findings branch. A day with nothing to report must still render.
  • Keep .Reason, .State and .IssuerError, since they are the only place cert-manager's own diagnostics appear.

Template language

Templates are Go html/template: every value is escaped for its context, so text from cert-manager (which can come from an external CA) cannot inject markup. Only the standard actions and functions are available (if, range, with, len, eq, and, or, printf, ...); cyclops adds none. The subject line is not templated: it is set by cyclops ([cyclops] 3 certificates need attention, or [cyclops] All certificates healthy).

If the ConfigMap or key is missing, or the template fails to parse or execute, the run fails and no email is sent, and the CertReport shows ReportSucceeding=False. The template is only loaded on a day when something needs attention, so a broken template can stay hidden until then. Test changes on a non-production CertReport with a certificate that is reported.

Template data

The root value (.) is:

FieldTypeMeaning
.ReportNamestringThe CertReport's name
.GeneratedAttime.Time (UTC)When the report ran
.Findingslist of rowsCertificates that need attention, most urgent first. May be empty

Each row in .Findings:

FieldTypeMeaning
.KindstringWhy it is listed: NeverIssued, Expired or RenewalOverdue
.Namespace, .NamestringThe cert-manager Certificate
.NotAftertime.Time (UTC)Expiry. Zero if never issued: test with .NotAfter.IsZero
.DaysLeftintWhole days until NotAfter, rounded down; negative once expired. Only meaningful when NotAfter is set
.RenewalTimetime.Time (UTC)When cert-manager is due to renew. Zero if none scheduled
.FailedIssuanceAttemptsintcert-manager's failed issuance count
.Ingresses[]stringNames of the annotated Ingresses that put the certificate in scope (annotation mode). Empty otherwise
.State, .Reasonstringcert-manager's own diagnostics, verbatim. Either may be empty. Reason is untrusted text
.IssuerErrorstringwhy the certificate's Issuer or ClusterIssuer is not ready (its Ready condition), verbatim, e.g. Issuer broken-ca: ErrGetKeyPair: .... Empty when the issuer is ready. Untrusted text

Times are time.Time, so format them with .NotAfter.Format "2006-01-02".

This is a public contract (ADR 0013): fields may be added in later versions, but none will be renamed or removed, so a custom template keeps working across upgrades. Unknown fields are an execution error, so do not reference fields not listed here.

A minimal template:

<h2>{{ .ReportName }}: {{ len .Findings }} need attention</h2>
<ul>
{{- range .Findings }}
  <li>{{ .Namespace }}/{{ .Name }}: {{ .Kind }}{{ with .Reason }} ({{ . }}){{ end }}</li>
{{- end }}
</ul>

Values

See values.yaml (commented) and values.schema.json, which rejects bad combinations at helm install/upgrade: SMTP without a host, SES without a region, and tls: None together with a credentials Secret.

KeyDefaultMeaning
image.repository, image.tagghcr.io/sakshitposting-irl/cyclops, chart appVersionController and report image (same binary)
email.providerSMTPSES or SMTP; one per install
email.smtp.*host requiredhost, port (default from tls), tls (StartTLS/TLS/None), credentialsSecretName
email.ses.*region requiredregion, credentialsSecretName (empty = ambient AWS identity)
reportServiceAccount.annotations{}e.g. the IRSA role ARN
emailTemplate.create / .name / .content / .welcomeContenttrue / derived / shipped default / shipped defaultThe template ConfigMap above (.welcomeContent is the welcome.html key)
emailTemplate.useAsDefaultfalseUse that ConfigMap for every CertReport without its own reference
crd.enabled / crd.keeptrue / trueInstall the CRD; keep it (and every CertReport) on uninstall
rbac.userRolestrueAdmin/editor/viewer ClusterRoles for CertReport
rbac.ingressAccesstrueLet report Pods read Ingresses; needed only for spec.ingressAnnotationMode
metrics.enabled / .porttrue / 8443HTTPS metrics endpoint
controller.*replicas, leader election, resources, scheduling

Artifact Hub

The chart is listed on Artifact Hub as repository cyclop. To be a verified publisher, Artifact Hub reads artifacthub-repo.yml (in the repository root) from the OCI repository itself, under the tag artifacthub.io. It is not read from git, and releases do not touch it. It was pushed once with oras:

oras push ghcr.io/sakshitposting-irl/charts/cyclops:artifacthub.io \
  --config /dev/null:application/vnd.cncf.artifacthub.config.v1+yaml \
  artifacthub-repo.yml:application/vnd.cncf.artifacthub.repository-metadata.layer.v1.yaml

Artifact Hub checks it on its next scan of the repository, which can take a while.

Verifying the chart signature

Each release signs the chart in GHCR with keyless cosign, which is what gives the package its Signed badge on Artifact Hub. To check one yourself:

cosign verify ghcr.io/sakshitposting-irl/charts/cyclops:<version> \
  --certificate-identity-regexp '^https://github.com/sakshitposting-irl/cyclops/\.github/workflows/release\.yml@' \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com

Deploy cyclops with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has cyclops on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartcyclops is pinned at v1.0.4 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply