Skip to content

kargo-api and external webhooks server never reload their TLS serving certificate #8238

In review

Description

@fuskovic

Pre-submission checklist

  • I have searched existing issues and confirmed this is not a duplicate.

Description

kargo-api and the external webhooks server load their TLS serving certificate once at startup and never reload it. Both call http.Server.ServeTLS(listener, certPath, keyPath) without setting TLSConfig.GetCertificate, so the certificate files are read once when the server starts:

  • pkg/server/server.go (TLS_CERT_PATH / TLS_KEY_PATH)
  • pkg/webhook/external/server.go (same variables)

When the certificate in the mounted Secret is renewed (by cert-manager, or any other rotation of a provided Secret), the kubelet updates the files on disk, but the running server keeps serving the old certificate. With the chart defaults (api.tls.enabled: true, externalWebhooksServer.tls.enabled: true, selfSignedCert: true), cert-manager renews these certificates at about 60 days and they expire at 90 days. A Pod that runs past the old certificate's expiry serves an expired certificate until it is restarted.

The Kubernetes webhooks server is not affected: controller-runtime's webhook server watches and reloads its certificate.

Found by code inspection while working on #6866, which is the same class of problem for kargo-api's trust of Dex's certificate (fixed in #8091).

Steps to Reproduce

  1. Install the chart with the defaults (TLS enabled on the API server and external webhooks server, self-signed certificates).
  2. Force cert-manager to reissue the kargo-api Certificate, e.g. by deleting its Secret, and wait for the kubelet to update the mounted files.
  3. Inspect the certificate served on the API server's port (e.g. openssl s_client -connect <host>:<port>). It is still the old certificate.

Expected Behavior

Both servers pick up a renewed certificate from disk without a restart, e.g. by serving through a tls.Config whose GetCertificate returns a certificate that is reloaded when the files change. controller-runtime's certwatcher already does this.

Actual Behavior

Both servers keep serving the certificate they loaded at startup until the Pod restarts, including after that certificate has expired.

Kargo Version

main (also present in release-1.12)

Activity

  1. added
    kind/bug
    area/api-server
    area/external-webhooks
    on Nov 30, 2026
  2. added
    needs/priority
    on Nov 30, 2026
  3. kargo-governance-bot commented on Nov 30, 2026

    @kargo-governance-bot

    Before Starting Work

    Thank you for opening this issue.

    Please do not start work on this issue, and please do not ask to be assigned to it, until a maintainer has triaged it and cleared it for contribution. This applies to bug reports too. A maintainer needs to confirm a bug, and usually reproduce it, before a fix is worth writing.

    An issue is cleared for contribution when none of the blocking labels remain on it. Pull requests that reference an issue that has not been cleared are automatically converted to drafts, which maintainers do not routinely review.

    Maintainers triage issues on a best-effort basis. See the Contributor Guide for details.

  4. self-assigned this
    on Nov 30, 2026
  5. added this to the v2.0.0 milestone on Dec 4, 2026
  6. added
    area/security
    priority/normal
    and removed
    needs/priority
    on Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/api-serverarea/external-webhooksarea/securitykind/bugpriority/normal

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions