Skip to content

Controller never reloads the kargo-api CA certificate #8310

Todo

Description

@fuskovic

Pre-submission checklist

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

Description

The controller loads the CA it uses to verify kargo-api's TLS certificate once and never reloads it:

  • pkg/client/apiserver/client.go (NewAPIClient) reads API_SERVER_CA_CERT_PATH and builds the transport's RootCAs once, when the client is created.
  • charts/kargo/templates/controller/deployment.yaml mounts that file with subPath: ca.crt. The kubelet never updates subPath mounts, so the file on disk stays stale too.

With the chart defaults (api.tls.enabled: true, api.tls.selfSignedCert: true), the kargo-api certificate is self-signed, so its ca.crt changes on every renewal (about every 60 days). After a renewal, kargo-api serves a certificate the controller no longer trusts, and every controller request to the API fails TLS verification until the controller restarts.

#8092 issues the chart's certificates from a shared, long-lived CA, so ca.crt stays the same across renewals. That removes the recurring failure, but the controller can still be left with a stale CA:

  • during the upgrade that switches the kargo-api Certificate to the new issuer, if the controller starts before the certificate is reissued;
  • whenever the CA itself changes, or a user-provided certificate is rotated to a different CA.

This is the same class of problem as #6866 (kargo-api trusting Dex, fixed in #8091) and #8238 (serving certificates).

Raised in review of #8092 (#8092 (comment)).

Steps to Reproduce

  1. Install the chart from main with the defaults (self-signed API certificate).
  2. Force cert-manager to reissue the kargo-api Certificate, e.g. by deleting its Secret.
  3. Watch the controller's requests to the API server. They fail with x509: certificate signed by unknown authority until the controller Pod restarts.

Expected Behavior

The controller picks up a changed CA without a restart: the chart mounts the Secret without subPath, so the kubelet updates the file, and the client re-reads the CA, as dex.NewTransport (#8091) does for Dex.

Actual Behavior

The controller keeps the CA it loaded at startup and cannot reach kargo-api after the CA changes until the Pod restarts.

Kargo Version

main (unreleased; the controller-to-API client is not in any release branch)

Activity

  1. added
    kind/bug
    area/controller
    area/chart
    on Dec 4, 2026
  2. added
    needs/priority
    on Dec 4, 2026
  3. kargo-governance-bot commented on Dec 4, 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 Dec 4, 2026
  5. added
    priority/low
    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/chartarea/controllerkind/bugpriority/low

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions