Skip to content

cert-manager: Add certificate expiry visibility and renewal status alerts (#705) - #1229

Open
harkirath1511 wants to merge 2 commits into
headlamp-k8s:mainfrom
harkirath1511:main
Open

cert-manager: Add certificate expiry visibility and renewal status alerts (#705)#1229
harkirath1511 wants to merge 2 commits into
headlamp-k8s:mainfrom
harkirath1511:main

Conversation

@harkirath1511

Copy link
Copy Markdown

Closes #705

Adds certificate expiry tracking and renewal status alerts to the cert-manager plugin. Certificates are now shown with color-coded expiry states and a new Overview dashboard surfaces certificates that need attention.

Changes

New: Certificate Expiry Utility (src/utils/certificateExpiry.ts)

  • Pure utility functions for computing expiry level, formatting human-readable labels, and filtering certificates that need attention
  • Thresholds: > 30 days → ok, ≤ 30 days → warning, < 7 days → critical, past date → expired

New: CertificateExpiryLabel Component

  • Tooltip-wrapped StatusLabel that renders color-coded expiry state
  • 🟢 Green for healthy, 🟡 Yellow for expiring soon, 🔴 Red for critical/expired

New: Overview Page (/cert-manager/overview)

  • Dashboard with 3 summary cards: Total certificates, Expiring soon (≤ 30 days), Expired
  • Table of certificates needing attention with direct links to their detail pages
  • The cert-manager sidebar entry now lands on this Overview page

Updated: Certificates List

  • Expires In column replaces the raw date with the new color-coded CertificateExpiryLabel
  • Secret column now links directly to the related Kubernetes Secret
  • Sort on Expires In handles missing/invalid dates gracefully (pushed to end)

Updated: Certificate Detail

  • Not After field replaced with CertificateExpiryLabel for visual consistency
  • Secret Name field now navigates to the Kubernetes Secret

Refactor: SecretNameLink

  • Extracted reusable SecretNameLink component in CommonComponents.tsx
  • Used across List, Detail, and SecretKeySelectorComponent (DRY)

Tests

Added 9 unit tests for the expiry utility covering all branches:

  • Unknown/invalid notAfter
  • ok / warning / critical / expired levels
  • Boundary conditions (exactly 7 days, exactly 30 days)
  • needsExpiryAttention helper
  • formatExpiryLabel formatting
Test Files  1 passed (1)
Tests       9 passed (9)

Screenshots

image image image

Checklist

  • Human-readable expiry column added
  • Expiry status colors work correctly
  • Overview widget shows expiring certificates
  • Secret links navigate correctly
  • i18n keys added to locales/en/translation.json
  • Unit tests added

Signed-off-by: Harkirat <singharkirath1511@gmail.com>
Signed-off-by: Harkirat <singharkirath1511@gmail.com>
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.

cert-manager: Add certificate expiry timeline view and renewal status alerts

1 participant